# SignFile

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.SignFile>

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

| Name                                              | Description                                                                                                                                                                                                                                                                                                                           |
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SourceFilePath : `String`                         | <p>Full path to the file for signing.</p><p><br>Default: <code>-</code><br>Example: <code>C:\temp\message.txt</code></p>                                                                                                                                                                                                              |
| OutputFilePath : `String`                         | <p>Full path for the signing 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> |
| {% endtab %}                                      |                                                                                                                                                                                                                                                                                                                                       |

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

| Name                                                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| DetachedSignature : `Boolean`                        | <p>Create a detached signature (true) or attached signature (false).</p><p>Detached signature creates a separate .sig file, attached signature embeds the signature with the data.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| UseArmor : `Boolean`                                 | <p>Use ascii armor or not.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| SignatureHashAlgorithm : `PgpSignatureHashAlgorithm` | <p>Hash algorithm to use with signature</p><p>Possible values:</p><ul><li><code>Md2</code>:</li></ul><p>Hash algorithm to use with signature</p><ul><li><code>Md5</code>:</li></ul><p>Hash algorithm to use with signature</p><ul><li><code>RipeMd160</code>:</li></ul><p>Hash algorithm to use with signature</p><ul><li><code>Sha1</code>:</li></ul><p>Hash algorithm to use with signature</p><ul><li><code>Sha224</code>:</li></ul><p>Hash algorithm to use with signature</p><ul><li><code>Sha256</code>:</li></ul><p>Hash algorithm to use with signature</p><ul><li><code>Sha384</code>:</li></ul><p>Hash algorithm to use with signature</p><ul><li><code>Sha512</code>:</li></ul><p>Hash algorithm to use with signature</p><p><br>Default: <code>5</code><br>Example: <code>PgpSignatureHashAlgorithm.Sha256</code></p> |
| UseFileKey : `Boolean`                               | <p>If true, PrivateKey is treated as a file path. If false, treated as raw key string.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| PrivateKey : `String`                                | <p>Private key file path or ASCII-armored private key content</p><p><br>Default: <code>-</code><br>Example: <code>C:\temp\privatekey.asc</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| 🗝PrivateKeyPassword : `String`                      | <p>Password/passphrase for the private key</p><p><br>Default: <code>-</code><br>Example: <code>MySecurePassphrase123</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| UseCompression : `Boolean`                           | <p>Whether to compress the signed data (only applies to attached signatures)</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| SignatureBufferSize : `Int32`                        | <p>Buffer size in KB for reading the file during signature generation</p><p><br>Default: <code>16</code><br>Example: <code>16</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ThrowErrorOnFailure : `Boolean`                      | <p>Whether to throw an error on failure.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ErrorMessageOnFailure : `String`                     | <p>Overrides the error message on failure.</p><p><br>Default: <code>-</code><br>Example: <code>Custom error message</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| {% endtab %}                                         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

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

| Name                | Description                                                                                                                    |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Success : `Boolean` | <p>Indicates if the task completed successfully.<br>Example: <code>true</code></p>                                             |
| FilePath : `String` | <p>File path to the signed 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, Exception AdditionalInfo }</code></p> |
| {% endtab %}        |                                                                                                                                |

{% tab title="Changelog" %}

## Changelog

### \[1.2.0] - 2026-02-23

#### Fixed

* Ensure FrendsTaskMetadata.json is included in NuGet package

### \[1.1.0] - 2026-01-21

#### Added

* Add UseCompression option for compressing attached signature data. Default is false.

### \[1.0.0] - 2026-01-05

#### Added

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