- 06 Sep 2023
- 2 Minutes to read
- Print
- DarkLight
Encrypt File
- Updated on 06 Sep 2023
- 2 Minutes to read
- Print
- DarkLight
Step Details | |
Introduced in Version | 4.0.0 |
Last Modified in Version | 8.5.0 |
Location | PGP Steps |
The Encrypt File step allows a user to use the PGP module to encrypt a file.
Prerequisites
This step requires the PGP module to be installed before it will be available in the toolbox.
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 |
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:
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:
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:
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 ---
Documentation:
PGP Module
Forum Posts:
Email Encrypt / Decrypt With PGP Module
Error While Encrypting A File Using PGP
PGP Issues With Decrypting Using Private Key