PGP

Frends.Pgp.DecryptFile / 1.5.0

Summary

Decrypts a PGP-encrypted file with a private key, taken from a file or from a string, into a plaintext file.

Typical use — the inbound half of PGP exchange with a partner; the passphrase belongs in an environment variable, not the Process

Details

Frends version
5.7 and newer
Agent
Crossplatform
Target framework
net8.0

Essential parameters.

Name Type Default Example Description
SourceFilePath String – C:\secrets\message.gpg

Path to the file containing the data to be decrypted.

OutputFilePath String – C:\messages\result.txt

Path where the decrypted file will be saved to.

DecryptBufferSize Int32 64 64

Buffer size in KB that will be used when decrypting the file.

PrivateKeySource PrivateKeySource – PrivateKeySource.File

Source of the private key - file path or string.

Possible values:

  • File: Private key is read from a file.

  • String: Private key is provided directly as a string.

PrivateKeyPath String – C:\keys\my_key.asc

Path to the private key file.

PrivateKeyStringSecret String – -----BEGIN PGP PRIVATE KEY BLOCK----- ... -----END PGP PRIVATE KEY BLOCK-----

Private key as a string, including the BEGIN/END PGP PRIVATE KEY BLOCK lines.

PassphraseEncoding PassphraseEncoding – PassphraseEncoding.Utf8

Encoding used for the private key passphrase. Defaults to Utf8. Use Legacy if the passphrase contains non-ASCII characters and the key was created with an older PGP tool.

Possible values:

  • Utf8: Standard encoding used by modern PGP tools (GnuPG, Kleopatra).

  • Legacy: Older encoding, only needed for keys created with legacy tools.

PrivateKeyPassphraseSecret String – P@ssw0rd

Passphrase for the private key.

An unhandled error has occurred. Reload 🗙