The OpenPGP class is used to encrypt/decrypt and sign/verify PGP messages.
The OpenPGP class supports encrypting/decrypting and signing/verifying OpenPGP messages in the format specified by RFC 4880.
The Encrypt, Sign, and SignAndEncrypt methods are used to create a message to be sent to your partner. You can additionally create messages bound for multiple recipients with different keys, simultaneously encrypt and compress with the most popular compression algorithms, and control other aspects such as the encrypting algorithm to use.
The Key* properties specify the key (with private key) used to sign and decrypt.
The SignerKey* properties specify the key used to verify a signature.
The RecipientKey* properties specify the key used to encrypt.
Input and Output Properties
The class will determine the source and destination of the input and output based on which properties are set.
The order in which the input properties are checked is as follows:
When a valid source is found the search stops. The order in which the output properties are checked is as follows:
- OutputMessage: The output data is written to this property if no other destination is specified.
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
|- ASCIIArmor||Specifies whether to use ASCII armor to encode the output message.|
|- autoSelectAlgorithms||Whether to automatically select algorithms when encrypting or signing.|
|- clearSignature||Specifies whether or not to create a cleartext signature.|
|- compressionMethod||The compression algorithm used.|
|- detachedSignature||Specifies whether or not to generate a detached signature when signing a message.|
|- encryptingAlgorithm||The encryption algorithm used when encrypting.|
|- inputFile||The file to process.|
|- inputMessage||The message to process.|
|- keyCount||The number of records in the Key arrays.|
|- keyEncoded:(int)keyIndex||The key.|
|- keyKeyring:(int)keyIndex||The location of the keyring.|
|- keyPassphrase:(int)keyIndex||The passphrase for the key's secret key (if any).|
|- keyUserId:(int)keyIndex||The user Id of the key.|
|- messageHeaderCount||The number of records in the MessageHeader arrays.|
|- messageHeaderField:(int)messageHeaderIndex||This property contains the name of the HTTP header (same case as it is delivered).|
|- messageHeaderValue:(int)messageHeaderIndex||This property contains the header contents.|
|- outputFile||The output file.|
|- outputMessage||The output message after processing.|
|- overwrite||Indicates whether or not the class should overwrite files.|
|- recipientKeyCount||The number of records in the RecipientKey arrays.|
|- recipientKeyEncoded:(int)recipientKeyIndex||The key.|
|- recipientKeyKeyring:(int)recipientKeyIndex||The location of the keyring.|
|- recipientKeyUserId:(int)recipientKeyIndex||The user Id of the key.|
|- signerKeyCount||The number of records in the SignerKey arrays.|
|- signerKeyEncoded:(int)signerKeyIndex||The key.|
|- signerKeyKeyring:(int)signerKeyIndex||The location of the keyring.|
|- signerKeyUserId:(int)signerKeyIndex||The user Id of the key.|
|- signingAlgorithm||The signature hash algorithm used when signing.|
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
|- config||Sets or retrieves a configuration setting.|
|- decrypt||Decrypts the message.|
|- decryptAndVerifySignature||Decrypts and verifies the signature of the message.|
|- encrypt||Encrypts the message.|
|- getRecipientInfo||Gets recipient information for an encrypted message.|
|- reset||Resets the class properties.|
|- sign||Signs the message.|
|- signAndEncrypt||Signs and encrypts the current message.|
|- verifySignature||Verifies the signature of the current message.|
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
|- onError||Information about errors during data delivery.|
|- onKeyPassphrase||Fired if the passphrase of current key is incorrect or empty.|
|- onProgress||Fired as progress is made.|
|- onRecipientInfo||Fired for each recipient key of the encrypted message.|
|- onSignatureInfo||Fired during verification of the signed message.|
|- onStatus||Shows the progress of the operation.|
|- onVerificationStatus||Fired after verification of the signed message.|
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
|AllowEmptyInput||Whether to allow empty files for input.|
|AllowOldPacketType||Whether to allow the older encrypted packet type.|
|CompressionLevel||The level of compression used.|
|DeleteOutputFileOnError||Whether to delete the output file on an error.|
|DetachedSignatureData||The detached signature.|
|EnsureValidDSASignatureHashAlgorithm||Whether or not to select a suitable signature hash algorithm automatically.|
|FileName||The original name of the encrypted file.|
|KeyIdLength||The length of the KeyId available.|
|KeySelectionMethod||The method used to select a key for encryption or signing.|
|LogLevel||Specifies the level of detail that is logged.|
|PGPZipDir||The directory used when creating or extracting a PGP zip file.|
|ProgressEventThreshold||The amount of data in bytes to process before firing the progress event.|
|PublicKeyringFile||The file name of the public keyring file.|
|ReadFromProgressEvent||Whether to read input data from inside the progress event.|
|RecursiveDecryptMode||Whether the encrypted data should be decrypted recursively.|
|RequireEncryption||Whether to throw an error when decrypting and encryption is not detected.|
|RequireIntegrityProtectedPacket||Whether an MDC packet is required for decryption.|
|RequireSignature||Whether to throw an error when verifying a signature and no signature is found.|
|RequireValidSignature||Specifies if an invalid signature is considered an error condition.|
|SecretKeyringFile||The file name of the secret keyring file.|
|SplitHeaders||Controls whether ASCII Armor headers are split or not.|
|SymmetricPassphrase||The password used for symmetric encryption or decryption.|
|UseFipsCompliantAlgorithms||Restricts the usage to FIPS compliant algorithms only.|
|UsePlatformAES||Whether to use the platform AES implementation.|
|VersionHeader||The Version header value in the ASCII armored OpenPGP message.|
|WriteToProgressEvent||Whether to write output data so it is accessible from inside the progress event.|
|BuildInfo||Information about the product's build.|
|CodePage||The system code page used for Unicode to Multibyte translations.|
|LicenseInfo||Information about the current license.|
|ProcessIdleEvents||Whether the class uses its internal event loop to process events when the main thread is idle.|
|SelectWaitMillis||The length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.|
|UseInternalSecurityAPI||Tells the class whether or not to use the system security libraries or an internal implementation.|