--- title: "Encrypt File" slug: "encrypt-file-1" updated: 2025-12-08T20:19:43Z published: 2025-12-08T20:19:43Z canonical: "documentation.decisions.com/encrypt-file-1" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt > Use this file to discover all available pages before exploring further. # Encrypt File | ## Step Details | | --- | | **Introduced in Version** | 9.18.0 | | **Last Modified in Version** | -- | | **Location** | PGP | The **Encrypt File** step allows a user to use the PGP module to encrypt a file. ### Prerequisites - This step requires the [PGP module](https://documentation.decisions.com/docs/pgp-module-overview#overview) to be [installed](https://documentation.decisions.com/docs/installing-modules-decisions) before it will be available in the toolbox. - Users must download [GPG](https://www.gnupg.org/download/) before utilizing this and other PGP steps. ### Considerations In v9.18, PGP steps were moved to a legacy category, and new steps were added. While the new PGP steps use an updated encryption/decryption approach (based on **AEAD/OCB** **mode**), both categories of steps can be utilized as they have the same functionality. --- ## Properties #### Inputs | Property | Description | Data Type | | --- | --- | --- | | Binary | Defines whether the output file is encrypted as bytes or raw text/ascii | Boolean | | Data | The desired file to encrypt | List of Byte | | Internal File Name | Specifies the filename and file type extension of the file when decrypting the file (i.e., text.pdf). It is best practice to have this match what is entered in the Data field. | String | | Output File Name | Specifies the file name and file type extension of the encrypted file (i.e., newFile.pdf) | String | | Public Key | Generated PGP public key file used to encrypt file | List of Byte | #### Outputs | Property | Description | Data Type | | --- | --- | --- | | Output | Outputs the encrypted file as the specified output file name | String | --- ## Example Inputs and Outputs | Binary | Data | Internal File Name | Output File Name | Public Key | Output | | --- | --- | --- | --- | --- | --- | | False | Content | image.png | encryptedImageFile.png | pub.asc | id:"f196435c-2f2d-4667-98b6-a5d36a3f88a8",FileName:"encryptedImageFile.png",Length:70451 ,Filetype:".png" | | True | Null | example.txt | encryptex.txt | pub.asc | EXCEPTION MESSAGE | | Empty | Content | new.txt | encr.txt | pub.asc | EXCEPTION MESSAGE | | False | Content | Null | file.docx | pub.asc | id:"dbb01f7c-2ebe-4ea7-bf56-2467ce731c67",FileName:"file.docx",Length:3687,Filetype:".docx" | | True | Content | example.pdf | Null | pub.asc | EXCEPTION MESSAGE | | False | Content | read.pdf | file.pdf | Null | EXCEPTION MESSAGE | #### ![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/image-1675284049182.png) --- ## Common Errors ### Buffer can't be null If the Data field or the Public Key fields are null or empty, the step will cause an error. To correct this, ensure that a File is uploaded and that the appropriate Public Key file is uploaded to the fields. #### Exception Message: ```csharp Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step Encrypt File 1[EncryptFile] in flow [Flow 2]: Exception invoking method EncryptFile on class PGPSteps ---> DecisionsFramework.LoggedException: Exception invoking method EncryptFile on class PGPSteps ---> System.ArgumentNullException: Buffer cannot be null. (Parameter 'buffer' at System.IO.MemoryStream..ctor(Byte[] buffer at Decsisions.PGP.Steps.PGPSteps.EncryptFile(Byte[] publicKey, Byte[] data, Boolean binary, String outputFileName, String internalFileName) --- End of inner exception stack trace --- at DecisionsFramework.Design.Flow.StepImplementations.InvokeMethodStep.Run(StepStartData data at DecisionsFramework.Design.Flow.FlowStep.RunStepInternal(String flowTrackingID, String stepTrackingID, KeyValuePairDataStructure[] stepRunDataValues, AbstractFlowTrackingData trackingData at DecisionsFramework.Design.Flow.FlowStep.Start(String flowTrackingID, String stepTrackingID, FlowStateData data, AbstractFlowTrackingData trackingData, RunningStepData currentStepData) --- End of inner exception stack trace --- ``` --- ### Parameter 'binary' of 'EncryptFile' can not be null If the Binary field is empty or null, the step will cause an error. To correct this, set the input mapping of the Binary field to Constant. #### Exception Message: ```csharp Exception Stack Trace: DecisionsFramework.BusinessRuleException: [BusinessRule] Parameter 'binary' of 'EncryptFile' can not be null at DecisionsFramework.Design.Flow.CoreSteps.InvokeMethodUtility.ThrowErrorIfNullIsNotAllowed(MethodInfo methodInfo, Object[] parameterValues, String errorMessage at DecisionsFramework.Design.Flow.StepImplementations.InvokeMethodStep.Run(StepStartData data at DecisionsFramework.Design.Flow.FlowStep.RunStepInternal(String flowTrackingID, String stepTrackingID, KeyValuePairDataStructure[] stepRunDataValues, AbstractFlowTrackingData trackingData at DecisionsFramework.Design.Flow.FlowStep.Start(String flowTrackingID, String stepTrackingID, FlowStateData data, AbstractFlowTrackingData trackingData, RunningStepData currentStepData) ``` --- ### Object reference not set to an instance of an object. If the Output File Name field is empty or null, the step will cause an error. To correct this, ensure that the value is correctly entered or mapped and includes the file extension (ie. .txt, .pdf, etc.). #### Exception Message: ```csharp Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step Encrypt File 1[EncryptFile] in flow [Flow 2]: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DecisionsFramework.Data.DataTypes.FileData.ProcessValueAddedToFlowData(String filePath, Boolean isFilePathFromSearch at DecisionsFramework.Data.DataTypes.FileData.ValueAdded( at DecisionsFramework.Design.Flow.Mapping.KeyValueDictionary.Add(KeyValuePairDataStructure item at DecisionsFramework.Design.Flow.StepImplementations.InvokeMethodStep.Run(StepStartData data at DecisionsFramework.Design.Flow.FlowStep.RunStepInternal(String flowTrackingID, String stepTrackingID, KeyValuePairDataStructure[] stepRunDataValues, AbstractFlowTrackingData trackingData at DecisionsFramework.Design.Flow.FlowStep.Start(String flowTrackingID, String stepTrackingID, FlowStateData data, AbstractFlowTrackingData trackingData, RunningStepData currentStepData) --- End of inner exception stack trace --- ``` --- ## Step Changes | Description | Version | Date | Developer Task | | --- | --- | --- | --- | | New steps have been added to the PGP Module. Existing steps have been added to the PGP Legacy category in the step toolbox. | [9.18](https://documentation.decisions.com/v99/docs/en/2ebf7a4c-e925-4e8f-9fd4-ff94a14910cc?isPreview=true&versionNumber=1) | December 2025 | [DT-046254] | Related Information Documentation: [PGP Module](https://documentation.decisions.com/docs/pgp-module-overview) Forum Posts: [Email Encrypt / Decrypt With PGP Module](https://support.decisions.com/forum/topic1520-email-encrypt--decrypt-with-pgp-module.aspx) [Error While Encrypting A File Using PGP](https://support.decisions.com/forum/topic1814-error-while-encrypting-a-file-using-pgp.aspx) [PGP Issues With Decrypting Using Private Key](https://support.decisions.com/forum/topic2522-pgp-issues-with-decrypting-using-private-key.aspx)