# EncryptFile

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Unknown

Source code: <https://github.com/FrendsPlatform/Frends.Pgp/tree/main/Frends.Pgp.EncryptFile>

{% tabs %}
{% tab title="Parameter: Input" %}

| Name                                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SourceFilePath : `String`                             | <p>Full path to the file for encryption.</p><p><br>Default: <code>-</code><br>Example: <code>C:\temp\message.txt</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| OutputFilePath : `String`                             | <p>Full path for the encrypted file.</p><p><br>Default: <code>-</code><br>Example: <code>C:\temp\message.pgp</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| OutputFileExistsAction : `OutputFileExistsAction`     | <p>Action for if the output file exists.</p><p>Possible values:</p><ul><li><code>Overwrite</code>:</li></ul><p>Action for if the output file exists.</p><ul><li><code>Error</code>:</li></ul><p>Action for if the output file exists.</p><p><br>Default: <code>-</code><br>Example: <code>OutputFileExistsAction.Overwrite</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| PublicKeyFile : `String`                              | <p>Full path for the public key.</p><p><br>Default: <code>-</code><br>Example: <code>C:\temp\publicKey.asc</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| PublicKeyId : `String`                                | <p>ID of the correct key in the key ring (Optional).</p><p>If left empty first suitable key in key ring is used.</p><p><br>Default: <code>-</code><br>Example: <code>0x1234567890ABCDEF 1234567890ABCDEF</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| EncryptionAlgorithm : `PgpEncryptEncryptionAlgorithm` | <p>Encryption algorithm to use</p><p>Possible values:</p><ul><li><code>Aes128</code>:</li></ul><p>Encryption algorithm to use</p><ul><li><code>Aes192</code>:</li></ul><p>Encryption algorithm to use</p><ul><li><code>Aes256</code>:</li></ul><p>Encryption algorithm to use</p><ul><li><code>Blowfish</code>:</li></ul><p>Encryption algorithm to use</p><ul><li><code>Camellia128</code>:</li></ul><p>Encryption algorithm to use</p><ul><li><code>Camellia192</code>:</li></ul><p>Encryption algorithm to use</p><ul><li><code>Camellia256</code>:</li></ul><p>Encryption algorithm to use</p><ul><li><code>Cast5</code>:</li></ul><p>Encryption algorithm to use</p><ul><li><code>Des</code>:</li></ul><p>Encryption algorithm to use</p><ul><li><code>Idea</code>:</li></ul><p>Encryption algorithm to use</p><ul><li><code>TripleDes</code>:</li></ul><p>Encryption algorithm to use</p><ul><li><code>Twofish</code>:</li></ul><p>Encryption algorithm to use</p><p><br>Default: <code>7</code><br>Example: <code>PgpEncryptEncryptionAlgorithm.Cast5</code></p> |
| {% endtab %}                                          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

{% tab title="Parameter: Options" %}

| Name                                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ThrowErrorOnFailure : `Boolean`               | <p>Whether to throw an error on failure. True by default.</p><p><br>Default: <code>True</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                             |
| UseArmor : `Boolean`                          | <p>Use ascii armor or not.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                             |
| UseIntegrityCheck : `Boolean`                 | <p>Check integrity of output file or not.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                              |
| UseCompression : `Boolean`                    | <p>Should compression be used?</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                         |
| CompressionType : `PgpEncryptCompressionType` | <p>Type of compression to use</p><p>Possible values:</p><ul><li><code>BZip2</code>:</li></ul><p>Type of compression to use</p><ul><li><code>Uncompressed</code>:</li></ul><p>Type of compression to use</p><ul><li><code>Zip</code>:</li></ul><p>Type of compression to use</p><ul><li><code>ZLib</code>:</li></ul><p>Type of compression to use</p><p><br>Default: <code>2</code><br>Example: <code>PgpEncryptCompressionType.Zip</code></p> |
| EncryptBufferSize : `Int32`                   | <p>Buffer size in KB that will be used when encrypting the file.</p><p><br>Default: <code>64</code><br>Example: <code>64</code></p>                                                                                                                                                                                                                                                                                                           |
| SignWithPrivateKey : `Boolean`                | <p>Should the encrypted file be signed with private key?</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                              |
| SigningSettings : `PgpEncryptSigningSettings` | <p>File signing related settings</p><p><br>Default: <code>-</code><br>Example: <code>PrivateKeyFile: C:\temp\privateKeyFile.gpg, PrivateKeyPassword: passphrase, SignatureHashAlgorithm: PgpEncryptSignatureHashAlgorithm.Sha1</code></p>                                                                                                                                                                                                     |
| ErrorMessageOnFailure : `String`              | <p>Overrides the error message on failure.</p><p><br>Default: <code>-</code><br>Example: <code>Failed to encrypt file.</code></p>                                                                                                                                                                                                                                                                                                             |
| {% endtab %}                                  |                                                                                                                                                                                                                                                                                                                                                                                                                                               |

{% tab title="Result: Result" %}

| Name                | Description                                                                                                                                         |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Success : `Boolean` | <p>Indicates whether the encryption was successful.<br>Example: <code>true</code></p>                                                               |
| FilePath : `String` | <p>File path to the encrypted file.<br>Example: <code>C:\temp\message.pgp</code></p>                                                                |
| Error : `Error`     | <p>Error that occurred during task execution.<br>Example: <code>object { string Message, object { Exception Exception } AdditionalInfo }</code></p> |
| {% endtab %}        |                                                                                                                                                     |

{% tab title="Changelog" %}

## Changelog

### \[1.0.0] - 2025-12-12

#### Added

* Initial implementation
  {% endtab %}
  {% endtabs %}
