Struct ipworkspgp::OpenPGP
Properties Methods Events Config Settings Errors
The OpenPGP struct is used to encrypt/decrypt and sign/verify PGP messages.
Syntax
ipworkspgp::OpenPGP
Remarks
The OpenPGP struct supports encrypting/decrypting and signing/verifying OpenPGP messages. Supported message formats are specified by RFC 4880, in addition to RFC 9580, which introduces support for OpenPGP Version 6.
GnuPG (2.5.x and later) uses its own Version 5 message format (LibrePGP). The struct supports creating and processing LibrePGP-formatted messages as well, for interoperability with GnuPG. See CompatibilityProfile for details on choosing between the two formats.
The encrypt, sign, and sign_and_encrypt 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.
When a message is received, the decrypt, verify_signature, and decrypt_and_verify_signature methods are used to process the incoming message.
The keys property holds the key (with private key) used to sign and decrypt.
The signer_keys property holds the key used to verify a signature.
The recipient_keys property holds the key used to encrypt.
Input and Output Properties
The struct 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:
- output_file
- output_message: The output data is written to this property if no other destination is specified.
Object Lifetime
The new() method returns a mutable reference to a struct instance. The object itself is kept in the global list maintained by IPWorksPGP. Due to this, the OpenPGP struct cannot be disposed of automatically. Please, call the dispose(&mut self) method of OpenPGP when you have finished using the instance.
Property List
The following is the full list of the properties of the struct with short descriptions. Click on the links for further details.
| ascii_armor | Specifies whether to use ASCII armor to encode the output message. |
| auto_select_algorithms | Whether to automatically select algorithms when encrypting or signing. |
| clear_signature | Specifies whether or not to create a cleartext signature. |
| compression_method | The compression algorithm used. |
| detached_signature | Specifies whether or not to generate a detached signature when signing a message. |
| encrypting_algorithm | The encryption algorithm used when encrypting. |
| input_file | The file to process. |
| input_message | The message to process. |
| key_count | The number of records in the Key arrays. |
| key_curve | This property specifies the elliptic curve if PublicKeyAlgorithm is ECDSA , EdDSA , Ed25519 , Ed448 , ML-DSA-65+Ed25519 , or ML-DSA-87+Ed448 . |
| key_effective_date | The date when this key becomes valid. |
| key_expiration_date | The date the key expires. |
| keyring | The location of the keyring. |
| key_other_user_ids | If the specified key has alternate user Ids associated with it, this property returns a comma-separated list of the other user Ids. |
| key_passphrase | The passphrase for the key's secret key (if any). |
| key_public_key | The public key of the key. |
| key_public_key_algorithm | A text description of the public key algorithm of the key. |
| key_public_key_length | The length of the public key in bits. |
| key_revoked | Whether or not the key is revoked. |
| key_secret_key | The secret key of the key (if available). |
| key_secret_key_available | Whether or not a secret key is available for the selected key. |
| key_usage | A text description of UsageFlags . |
| key_usage_flags | Flags that show the intended use for the key. |
| key_version | This property can be used to query the OpenPGP version of the currently selected Key . |
| key_user_id | The user Id of the key. |
| key_id | The hex-encoded, 4-byte or 8-byte key Id. |
| key_fingerprint | The hex-encoded, 20-byte fingerprint of the key. |
| key_encoded | The key. |
| message_header_count | The number of records in the MessageHeader arrays. |
| message_header_field | This property contains the name of the HTTP header (this is the same case as it is delivered). |
| message_header_value | This property contains the header contents. |
| output_file | The output file. |
| output_message | The output message after processing. |
| overwrite | Indicates whether or not the struct should overwrite files. |
| recipient_key_count | The number of records in the RecipientKey arrays. |
| recipient_key_curve | This property specifies the elliptic curve if PublicKeyAlgorithm is ECDSA , EdDSA , Ed25519 , Ed448 , ML-DSA-65+Ed25519 , or ML-DSA-87+Ed448 . |
| recipient_key_effective_date | The date when this key becomes valid. |
| recipient_key_expiration_date | The date the key expires. |
| recipient_key_keyring | The location of the keyring. |
| recipient_key_other_user_ids | If the specified key has alternate user Ids associated with it, this property returns a comma-separated list of the other user Ids. |
| recipient_key_passphrase | The passphrase for the key's secret key (if any). |
| recipient_key_public_key | The public key of the key. |
| recipient_key_public_key_algorithm | A text description of the public key algorithm of the key. |
| recipient_key_public_key_length | The length of the public key in bits. |
| recipient_key_revoked | Whether or not the key is revoked. |
| recipient_key_secret_key | The secret key of the key (if available). |
| recipient_key_secret_key_available | Whether or not a secret key is available for the selected key. |
| recipient_key_usage | A text description of UsageFlags . |
| recipient_key_usage_flags | Flags that show the intended use for the key. |
| recipient_key_version | This property can be used to query the OpenPGP version of the currently selected Key . |
| recipient_key_user_id | The user Id of the key. |
| recipient_key_id | The hex-encoded, 4-byte or 8-byte key Id. |
| recipient_key_fingerprint | The hex-encoded, 20-byte fingerprint of the key. |
| recipient_key_encoded | The key. |
| signer_key_count | The number of records in the SignerKey arrays. |
| signer_key_curve | This property specifies the elliptic curve if PublicKeyAlgorithm is ECDSA , EdDSA , Ed25519 , Ed448 , ML-DSA-65+Ed25519 , or ML-DSA-87+Ed448 . |
| signer_key_effective_date | The date when this key becomes valid. |
| signer_key_expiration_date | The date the key expires. |
| signer_key_keyring | The location of the keyring. |
| signer_key_other_user_ids | If the specified key has alternate user Ids associated with it, this property returns a comma-separated list of the other user Ids. |
| signer_key_passphrase | The passphrase for the key's secret key (if any). |
| signer_key_public_key | The public key of the key. |
| signer_key_public_key_algorithm | A text description of the public key algorithm of the key. |
| signer_key_public_key_length | The length of the public key in bits. |
| signer_key_revoked | Whether or not the key is revoked. |
| signer_key_secret_key | The secret key of the key (if available). |
| signer_key_secret_key_available | Whether or not a secret key is available for the selected key. |
| signer_key_usage | A text description of UsageFlags . |
| signer_key_usage_flags | Flags that show the intended use for the key. |
| signer_key_version | This property can be used to query the OpenPGP version of the currently selected Key . |
| signer_key_user_id | The user Id of the key. |
| signer_key_id | The hex-encoded, 4-byte or 8-byte key Id. |
| signer_key_fingerprint | The hex-encoded, 20-byte fingerprint of the key. |
| signer_key_encoded | The key. |
| signing_algorithm | The signature hash algorithm used when signing. |
Method List
The following is the full list of the methods of the struct with short descriptions. Click on the links for further details.
| config | Sets or retrieves a configuration setting. |
| decrypt | Decrypts the message. |
| decrypt_and_verify_signature | Decrypts and verifies the signature of the message. |
| encrypt | Encrypts the message. |
| get_recipient_info | Gets recipient information for an encrypted message. |
| interrupt | Interrupt the current method. |
| reset | Resets the struct properties. |
| sign | Signs the message. |
| sign_and_encrypt | Signs and encrypts the current message. |
| verify_signature | Verifies the signature of the current message. |
Event List
The following is the full list of the events fired by the struct with short descriptions. Click on the links for further details.
| on_error | Fired when information is available about errors during data delivery. |
| on_key_passphrase | Fired if the passphrase of current key is incorrect or empty. |
| on_progress | Fired as progress is made. |
| on_recipient_info | Fired for each recipient key of the encrypted message. |
| on_signature_info | Fired during verification of the signed message. |
| on_status | Shows the progress of the operation. |
| on_verification_status | Fired after verification of the signed message. |
Config Settings
The following is a list of config settings for the struct with short descriptions. Click on the links for further details.
| AEADChunkSizeExp | Specifies the exponent used to calculate the plaintext chunk size for encryption. |
| AllowEmptyInput | Whether to allow empty files for input. |
| AllowOldPacketType | Whether to allow the older encrypted packet type. |
| Argon2Iterations | Specifies the number of iterations used for Argon2. |
| Argon2MemorySizeExp | Specifies the exponent used to calculate the memory size used when creating a key. |
| Argon2Parallelism | Specifies the degree of parallelism used for Argon2. |
| CloseInputStreamAfterProcessing | Determines whether or not the input stream is closed after processing. |
| CloseOutputStreamAfterProcessing | Determines whether or not the output stream is closed after processing. |
| CompatibilityProfile | Specifies the OpenPGP compatibility profile used when creating messages. |
| 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. |
| S2KAlgorithm | Specifies the algorithm for S2K key derivation. |
| S2KIterations | Sets the number of iterations for S2K key derivation. |
| 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. |
| UseArgon2 | Whether to use Argon2 for key derivation during symmetric encryption or decryption. |
| UseMemoryMode | Determines whether the entire message is loaded into memory prior to encryption or decryption. |
| VerifyClearTextSignatureWithCache | Whether the cleartext message is cached in memory when verifying a cleartext signature. |
| 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. |
| MaskSensitiveData | Whether sensitive data is masked in log messages. |
| UseInternalSecurityAPI | Whether or not to use the system security libraries or an internal implementation. |
ascii_armor property (OpenPGP Struct)
Specifies whether to use ASCII armor to encode the output message.
Syntax
fn ascii_armor(&self ) -> Result<bool, IPWorksPGPError>
fn set_ascii_armor(&self, value : bool) -> Option<IPWorksPGPError>
Default Value
false
Remarks
This property controls whether or not ASCII armoring is used on the output message. The default value is False.
Data Type
bool
auto_select_algorithms property (OpenPGP Struct)
Whether to automatically select algorithms when encrypting or signing.
Syntax
fn auto_select_algorithms(&self ) -> Result<i32, IPWorksPGPError>
fn set_auto_select_algorithms(&self, value : i32) -> Option<IPWorksPGPError>
Default Value
0
Remarks
This property is set to the binary 'OR' of one or more options indicating which algorithms to automatically select.
When enabled automatic selection is performed by examining the preferred algorithms specified by the key.
When encrypt is called the struct will read the preferred encryption algorithm and compression method from the key specified in the RecipientKey* properties.
If multiple keys are specified the preferred encryption algorithm and compression method from the last key is used. The encrypting_algorithm and compression_method properties are ignored.
When sign is called the struct will read the preferred MAC algorithm and compression method from the private key specified in the Key* properties. If multiple keys are specified the preferred MAC algorithm and compression method from the last key is used. The signing_algorithm and compression_method properties are ignored.
The list below defines available options.
| Compression Algorithm | 1 (Hex 0x01) |
| Cipher Algorithm | 2 (Hex 0x02) |
| MAC Algorithm | 4 (Hex 0x04) |
The default value is 0 which means algorithms are not automatically selected.
Data Type
i32
clear_signature property (OpenPGP Struct)
Specifies whether or not to create a cleartext signature.
Syntax
fn clear_signature(&self ) -> Result<bool, IPWorksPGPError>
fn set_clear_signature(&self, value : bool) -> Option<IPWorksPGPError>
Default Value
false
Remarks
This property controls whether or not a cleartext signature is created during signing. The default value is False. When set to true a clear text signature will be created when sign is called.
Data Type
bool
compression_method property (OpenPGP Struct)
The compression algorithm used.
Syntax
fn compression_method(&self ) -> Result<String, IPWorksPGPError>
fn set_compression_method(&self, value : &str) -> Option<IPWorksPGPError> fn set_compression_method_ref(&self, value : &String) -> Option<IPWorksPGPError>
Default Value
"zip"
Remarks
This property specifies which compression method is used when generating output. Possible values are:
- zip (default)
- zlib
- bzip2
- none or uncompressed
Data Type
String
detached_signature property (OpenPGP Struct)
Specifies whether or not to generate a detached signature when signing a message.
Syntax
fn detached_signature(&self ) -> Result<bool, IPWorksPGPError>
fn set_detached_signature(&self, value : bool) -> Option<IPWorksPGPError>
Default Value
false
Remarks
This property specifies whether or not a detached signature is created when signing a message. The default value is False.
If set to true the output will only be the signature. The data being signed will not be included in the output. If set to true clear_signature will be ignored.
When this property is false (default) the signature is not detached. The output will contain both the signed data and the signature.
Data Type
bool
encrypting_algorithm property (OpenPGP Struct)
The encryption algorithm used when encrypting.
Syntax
fn encrypting_algorithm(&self ) -> Result<String, IPWorksPGPError>
fn set_encrypting_algorithm(&self, value : &str) -> Option<IPWorksPGPError> fn set_encrypting_algorithm_ref(&self, value : &String) -> Option<IPWorksPGPError>
Default Value
"AES128"
Remarks
This property specifies the encryption algorithm used when encrypting. Possible values are:
- CAST5
- 3DES or TripleDES
- AES256
- AES192
- AES128 (default)
- BLOWFISH
- TWOFISH
- IDEA
- AES256-OCB (AEAD)
- AES192-OCB (AEAD)
- AES128-OCB (AEAD)
- AES256-GCM (AEAD)
- AES192-GCM (AEAD)
- AES128-GCM (AEAD)
Note that for AES256, AES192, and AES128, the struct uses a modified form of CFB mode in accordance with the OpenPGP standard.
Note that if UseArgon2 is enabled, and SymmetricPassphrase is specified, an AEAD encryption algorithm (AES*-OCB and AES*-GCM) must be specified for symmetric encryption. If UseArgon2 is disabled, and an AEAD encryption algorithm is specified, the AEAD mode (OCB or GCM) will be ignored when performing symmetric encryption.
An AEAD encryption algorithm may optionally be utilized when encrypting messages (when calling encrypt). In this case, the AEADChunkSizeExp configuration will specify the chunk size for splitting plaintext for encryption. Please see AEADChunkSizeExp for additional details.
Data Type
String
input_file property (OpenPGP Struct)
The file to process.
Syntax
fn input_file(&self ) -> Result<String, IPWorksPGPError>
fn set_input_file(&self, value : &str) -> Option<IPWorksPGPError> fn set_input_file_ref(&self, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
This property specifies the file to be processed. Set this property to the full or relative path to the file which will be processed.
Input and Output Properties
The struct 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:
- input_file
- input_message
When a valid source is found the search stops. The order in which the output properties are checked is as follows:
- output_file
- output_message: The output data is written to this property if no other destination is specified.
Data Type
String
input_message property (OpenPGP Struct)
The message to process.
Syntax
fn input_message(&self ) -> Result<Vec<u8>, IPWorksPGPError>
fn set_input_message(&self, value : Vec<u8>) -> Option<IPWorksPGPError> fn set_input_message_ref(&self, value : &[u8]) -> Option<IPWorksPGPError>
Default Value
""
Remarks
This property specifies the message to be processed. Set this property to the OpenPGP message content.
Input and Output Properties
The struct 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:
- input_file
- input_message
When a valid source is found the search stops. The order in which the output properties are checked is as follows:
- output_file
- output_message: The output data is written to this property if no other destination is specified.
Data Type
Vec
key_count property (OpenPGP Struct)
The number of records in the Key arrays.
Syntax
fn key_count(&self ) -> Result<i32, IPWorksPGPError>
fn set_key_count(&self, value : i32) -> Option<IPWorksPGPError>
Default Value
0
Remarks
This property controls the size of the following arrays:
- key_curve
- key_effective_date
- key_encoded
- key_expiration_date
- key_fingerprint
- key_id
- key_other_user_ids
- key_passphrase
- key_public_key
- key_public_key_algorithm
- key_public_key_length
- key_revoked
- keyring
- key_secret_key
- key_secret_key_available
- key_usage
- key_usage_flags
- key_user_id
- key_version
Data Type
i32
key_curve property (OpenPGP Struct)
This property specifies the elliptic curve if PublicKeyAlgorithm is ECDSA , EdDSA , Ed25519 , Ed448 , ML-DSA-65+Ed25519 , or ML-DSA-87+Ed448 .
Syntax
fn key_curve(&self , KeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
This property specifies the elliptic curve if key_public_key_algorithm is ECDSA, EdDSA, Ed25519, Ed448, ML-DSA-65+Ed25519, or ML-DSA-87+Ed448. Possible values are:
| Curve | Valid Public Key Algorithms | Description |
| secp256r1 | ECDSA | NIST curve P-256 |
| secp384r1 | ECDSA | NIST curve P-384 |
| secp521r1 | ECDSA | NIST curve P-521 |
| secp256k1 | ECDSA | Secp256k1 |
| brainpoolP256r1 | ECDSA | Brainpool curve P-256r1 |
| brainpoolP384r1 | ECDSA | Brainpool curve P-384r1 |
| brainpoolP512r1 | ECDSA | Brainpool curve P-512r1 |
| Ed25519 | EdDSA, Ed25519, ML-DSA-65+Ed25519 | Ed25519 |
| Ed448 | Ed448, ML-DSA-87+Ed448 | Ed448 |
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
This property is read-only.
Data Type
String
key_effective_date property (OpenPGP Struct)
The date when this key becomes valid.
Syntax
fn key_effective_date(&self , KeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
The date when this key becomes valid. Prior to this it is not valid. The following is an example of a valid encoded date:
23-Jan-2000 15:00:00.
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
This property is read-only.
Data Type
String
key_expiration_date property (OpenPGP Struct)
The date the key expires.
Syntax
fn key_expiration_date(&self , KeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
The date the key expires. After this date the key will no longer be valid. The following is an example of a valid encoded date:
23-Jan-2001 15:00:00.
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
This property is read-only.
Data Type
String
keyring property (OpenPGP Struct)
The location of the keyring.
Syntax
fn keyring(&self , KeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_keyring(&self, KeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_keyring_ref(&self, KeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The location of the keyring.
If the keyring is stored in a directory, set this property to the directory. The directory must contain the files "secring.gpg" and "pubring.gpg". A keyring may also be stored in a single file. If the keyring is a file this property should be set to the path of the file.
When This property is set the struct will read the keyring and populate the key property with the first key found in the keyring. Set key_user_id to select a different key in the current keyring.
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
Data Type
String
key_other_user_ids property (OpenPGP Struct)
If the specified key has alternate user Ids associated with it, this property returns a comma-separated list of the other user Ids.
Syntax
fn key_other_user_ids(&self , KeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
If the specified key has alternate user Ids associated with it, this property returns a comma-separated list of the other user Ids.
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
This property is read-only.
Data Type
String
key_passphrase property (OpenPGP Struct)
The passphrase for the key's secret key (if any).
Syntax
fn key_passphrase(&self , KeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_key_passphrase(&self, KeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_key_passphrase_ref(&self, KeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The passphrase for the key's secret key (if any). This must be specified before operations requiring the secret key are attempted. The passphrase may be supplied in this property or through the on_key_passphrase event, which will fire when a passphrase is required.
The passphrase is required when using the following methods in KeyMgr:
- add_user_id
- sign_user_id
- change_expiration_date
- change_passphrase
When using the OpenPGP struct, or an email-based struct, the following methods require a passphrase for the key:
- decrypt
- sign
- sign_and_encrypt
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
Data Type
String
key_public_key property (OpenPGP Struct)
The public key of the key.
Syntax
fn key_public_key(&self , KeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
The public key of the key. The key is provided as ASCII armored data.
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
This property is read-only.
Data Type
String
key_public_key_algorithm property (OpenPGP Struct)
A text description of the public key algorithm of the key.
Syntax
fn key_public_key_algorithm(&self , KeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
A text description of the public key algorithm of the key. Possible values are:
- RSA
- DSA
- ECDSA
- EdDSA
- Ed25519
- Ed448
- ML-DSA-65+Ed25519
- ML-DSA-87+Ed448
- RSA-Legacy
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
This property is read-only.
Data Type
String
key_public_key_length property (OpenPGP Struct)
The length of the public key in bits.
Syntax
fn key_public_key_length(&self , KeyIndex : i32) -> Result<i32, IPWorksPGPError>
Default Value
0
Remarks
The length of the public key in bits. Common values are 1024, 2048, and 3072.
If the key_public_key_algorithm property is ECDSA, EdDSA, Ed25519, Ed448, ML-DSA-65+Ed25519, or ML-DSA-87+Ed448, the length of the public key is determined by the key_curve. Possible lengths are:
| Curve | Public Key Length (bits) |
| secp256r1 | 256 |
| secp384r1 | 384 |
| secp521r1 | 528 |
| secp256k1 | 256 |
| Ed25519 | 256 |
| Ed448 | 456 |
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
This property is read-only.
Data Type
i32
key_revoked property (OpenPGP Struct)
Whether or not the key is revoked.
Syntax
fn key_revoked(&self , KeyIndex : i32) -> Result<bool, IPWorksPGPError>
Default Value
false
Remarks
Whether or not the key is revoked.
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
This property is read-only.
Data Type
bool
key_secret_key property (OpenPGP Struct)
The secret key of the key (if available).
Syntax
fn key_secret_key(&self , KeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
The secret key of the key (if available). The key is provided as ASCII armored data.
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
This property is read-only.
Data Type
String
key_secret_key_available property (OpenPGP Struct)
Whether or not a secret key is available for the selected key.
Syntax
fn key_secret_key_available(&self , KeyIndex : i32) -> Result<bool, IPWorksPGPError>
Default Value
false
Remarks
Whether or not a secret key is available for the selected key.
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
This property is read-only.
Data Type
bool
key_usage property (OpenPGP Struct)
A text description of UsageFlags .
Syntax
fn key_usage(&self , KeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
A text description of key_usage_flags.
The value will be of one or more of the following strings, separated by commas:
- Certifying Other Certificates
- Signing Emails and Files
- Encrypting Emails and Files
- Split Key
- Authenticate Against Servers
- Group Key
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
This property is read-only.
Data Type
String
key_usage_flags property (OpenPGP Struct)
Flags that show the intended use for the key.
Syntax
fn key_usage_flags(&self , KeyIndex : i32) -> Result<i32, IPWorksPGPError>
Default Value
47
Remarks
Flags that show the intended use for the key. The default value is 0x0F. The value of key_usage_flags is a combination of the following flags:
| 0x01 | This key may be used to certify other keys. |
| 0x02 | This key may be used to sign data. |
| 0x0C | This key may be used to encrypt communications and encrypt storage. |
| 0x10 | The private component of this key may have been split by a secret-sharing mechanism. |
| 0x20 | This key may be used for authentication. |
| 0x80 | The private component of this key may be in the possession of more than one person. |
Please refer to the key_usage property for a text representation of key_usage_flags.
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
This property is read-only.
Data Type
i32
key_version property (OpenPGP Struct)
This property can be used to query the OpenPGP version of the currently selected Key .
Syntax
fn key_version(&self , KeyIndex : i32) -> Result<i32, IPWorksPGPError>
Default Value
4
Remarks
This property can be used to query the OpenPGP version of the currently selected key. Possible values are:
- 4 - OpenPGP v4 (default)
- 5 - LibrePGP v5
- 6 - OpenPGP v6
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
This property is read-only.
Data Type
i32
key_user_id property (OpenPGP Struct)
The user Id of the key.
Syntax
fn key_user_id(&self , KeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_key_user_id(&self, KeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_key_user_id_ref(&self, KeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The user Id of the key. When a key is loaded this property is populated with the user Id associated with the key. This property may be set to load a key from the key_keyring. When this property is set the struct will search the key_keyring for a key associated with the UserId specified.
When loading a key with multiple user Ids, this property will be populated with the UserId that was most recently added to the key. To discover all of the UserIds associated with a key query this property and key_other_user_ids after loading the key.
The UserId format is:
FirstName LastName (Comment) <Email>Not all values are required when selecting or generating a key, but at least FirstName or Email are required.
Note that for OpenPGP v6, a key may be created with or without a UserId, as the field is optional. If a key was created without a UserId, the key's Fingerprint can be used as its identifier instead.
When using this property to select a key you may also specify the key's Id, or any of its subkeys' Ids, instead of a user Id. The struct will then search for a key with a matching Id. This is helpful in situations where you do not have the UserId but still need to load the key, such as within the OpenPGP struct's on_recipient_info event.
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
Data Type
String
key_id property (OpenPGP Struct)
The hex-encoded, 4-byte or 8-byte key Id.
Syntax
fn key_id(&self , KeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_key_id(&self, KeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_key_id_ref(&self, KeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The hex-encoded, 4-byte or 8-byte key Id. For OpenPGP v4 keys and earlier, the key Id corresponds to the last 4 or 8 bytes of the key's Fingerprint. For OpenPGP v6 keys, the key Id corresponds to the first 8 bytes of the key's Fingerprint instead. For instance:
5E70662EA810E768
When a key is loaded, this property is populated with the Id associated with the key. This property may be set to load a key from the key_keyring. When this property is set the struct will search the key_keyring for a key associated with the Id specified.
The KeyIdLength setting may be set to control the length of the returned key Id.
NOTE: It is recommended to use the key_fingerprint property when loading a key from the key_keyring, as it is possible for different keys to have the same Id.
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
Data Type
String
key_fingerprint property (OpenPGP Struct)
The hex-encoded, 20-byte fingerprint of the key.
Syntax
fn key_fingerprint(&self , KeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_key_fingerprint(&self, KeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_key_fingerprint_ref(&self, KeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The hex-encoded, 20-byte fingerprint of the key.
When a key is loaded, this property is populated with the Fingerprint associated with the key. This property may be set to load a key from the key_keyring. When this property is set the struct will search the key_keyring for a key associated with the Fingerprint specified.
This is in the form:
5E70662EA810E768391A2FE8F7B7D49C89C9D7B1
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
Data Type
String
key_encoded property (OpenPGP Struct)
The key.
Syntax
fn key_encoded(&self , KeyIndex : i32) -> Result<Vec<u8>, IPWorksPGPError>
fn set_key_encoded(&self, KeyIndex : i32, value : Vec<u8>) -> Option<IPWorksPGPError> fn set_key_encoded_ref(&self, KeyIndex : i32, value : &[u8]) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The key. This property can be used to assign a specific key. The key_fingerprint, key_id, and key_user_id properties may also be used to specify a key.
The KeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the KeyCount property.
Data Type
Vec
message_header_count property (OpenPGP Struct)
The number of records in the MessageHeader arrays.
Syntax
fn message_header_count(&self ) -> Result<i32, IPWorksPGPError>
fn set_message_header_count(&self, value : i32) -> Option<IPWorksPGPError>
Default Value
0
Remarks
This property controls the size of the following arrays:
The array indices start at 0 and end at message_header_count - 1.Data Type
i32
message_header_field property (OpenPGP Struct)
This property contains the name of the HTTP header (this is the same case as it is delivered).
Syntax
fn message_header_field(&self , MessageHeaderIndex : i32) -> Result<String, IPWorksPGPError>
fn set_message_header_field(&self, MessageHeaderIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_message_header_field_ref(&self, MessageHeaderIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
This property contains the name of the HTTP Header (this is the same case as it is delivered).
The MessageHeaderIndex parameter specifies the index of the item in the array. The size of the array is controlled by the MessageHeaderCount property.
Data Type
String
message_header_value property (OpenPGP Struct)
This property contains the header contents.
Syntax
fn message_header_value(&self , MessageHeaderIndex : i32) -> Result<String, IPWorksPGPError>
fn set_message_header_value(&self, MessageHeaderIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_message_header_value_ref(&self, MessageHeaderIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
This property contains the Header contents.
The MessageHeaderIndex parameter specifies the index of the item in the array. The size of the array is controlled by the MessageHeaderCount property.
Data Type
String
output_file property (OpenPGP Struct)
The output file.
Syntax
fn output_file(&self ) -> Result<String, IPWorksPGPError>
fn set_output_file(&self, value : &str) -> Option<IPWorksPGPError> fn set_output_file_ref(&self, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
This property specifies the file to which the output will be written. This may be set to an absolute or relative path.
Input and Output Properties
The struct 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:
- output_file
- output_message: The output data is written to this property if no other destination is specified.
Data Type
String
output_message property (OpenPGP Struct)
The output message after processing.
Syntax
fn output_message(&self ) -> Result<Vec<u8>, IPWorksPGPError>
fn set_output_message(&self, value : Vec<u8>) -> Option<IPWorksPGPError> fn set_output_message_ref(&self, value : &[u8]) -> Option<IPWorksPGPError>
Default Value
""
Remarks
This property will be populated with the output from the operation if output_file is not set.
Input and Output Properties
The struct 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:
- output_file
- output_message: The output data is written to this property if no other destination is specified.
Data Type
Vec
overwrite property (OpenPGP Struct)
Indicates whether or not the struct should overwrite files.
Syntax
fn overwrite(&self ) -> Result<bool, IPWorksPGPError>
fn set_overwrite(&self, value : bool) -> Option<IPWorksPGPError>
Default Value
false
Remarks
This property indicates whether or not the struct will overwrite output_file. If overwrite is False, an error will be thrown whenever output_file exists before an operation. The default value is False.
Data Type
bool
recipient_key_count property (OpenPGP Struct)
The number of records in the RecipientKey arrays.
Syntax
fn recipient_key_count(&self ) -> Result<i32, IPWorksPGPError>
fn set_recipient_key_count(&self, value : i32) -> Option<IPWorksPGPError>
Default Value
0
Remarks
This property controls the size of the following arrays:
- recipient_key_curve
- recipient_key_effective_date
- recipient_key_encoded
- recipient_key_expiration_date
- recipient_key_fingerprint
- recipient_key_id
- recipient_key_keyring
- recipient_key_other_user_ids
- recipient_key_passphrase
- recipient_key_public_key
- recipient_key_public_key_algorithm
- recipient_key_public_key_length
- recipient_key_revoked
- recipient_key_secret_key
- recipient_key_secret_key_available
- recipient_key_usage
- recipient_key_usage_flags
- recipient_key_user_id
- recipient_key_version
Data Type
i32
recipient_key_curve property (OpenPGP Struct)
This property specifies the elliptic curve if PublicKeyAlgorithm is ECDSA , EdDSA , Ed25519 , Ed448 , ML-DSA-65+Ed25519 , or ML-DSA-87+Ed448 .
Syntax
fn recipient_key_curve(&self , RecipientKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
This property specifies the elliptic curve if recipient_key_public_key_algorithm is ECDSA, EdDSA, Ed25519, Ed448, ML-DSA-65+Ed25519, or ML-DSA-87+Ed448. Possible values are:
| Curve | Valid Public Key Algorithms | Description |
| secp256r1 | ECDSA | NIST curve P-256 |
| secp384r1 | ECDSA | NIST curve P-384 |
| secp521r1 | ECDSA | NIST curve P-521 |
| secp256k1 | ECDSA | Secp256k1 |
| brainpoolP256r1 | ECDSA | Brainpool curve P-256r1 |
| brainpoolP384r1 | ECDSA | Brainpool curve P-384r1 |
| brainpoolP512r1 | ECDSA | Brainpool curve P-512r1 |
| Ed25519 | EdDSA, Ed25519, ML-DSA-65+Ed25519 | Ed25519 |
| Ed448 | Ed448, ML-DSA-87+Ed448 | Ed448 |
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
This property is read-only.
Data Type
String
recipient_key_effective_date property (OpenPGP Struct)
The date when this key becomes valid.
Syntax
fn recipient_key_effective_date(&self , RecipientKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
The date when this key becomes valid. Prior to this it is not valid. The following is an example of a valid encoded date:
23-Jan-2000 15:00:00.
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
This property is read-only.
Data Type
String
recipient_key_expiration_date property (OpenPGP Struct)
The date the key expires.
Syntax
fn recipient_key_expiration_date(&self , RecipientKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
The date the key expires. After this date the key will no longer be valid. The following is an example of a valid encoded date:
23-Jan-2001 15:00:00.
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
This property is read-only.
Data Type
String
recipient_key_keyring property (OpenPGP Struct)
The location of the keyring.
Syntax
fn recipient_key_keyring(&self , RecipientKeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_recipient_key_keyring(&self, RecipientKeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_recipient_key_keyring_ref(&self, RecipientKeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The location of the keyring.
If the keyring is stored in a directory, set this property to the directory. The directory must contain the files "secring.gpg" and "pubring.gpg". A keyring may also be stored in a single file. If the keyring is a file this property should be set to the path of the file.
When This property is set the struct will read the keyring and populate the key property with the first key found in the keyring. Set key_user_id to select a different key in the current keyring.
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
Data Type
String
recipient_key_other_user_ids property (OpenPGP Struct)
If the specified key has alternate user Ids associated with it, this property returns a comma-separated list of the other user Ids.
Syntax
fn recipient_key_other_user_ids(&self , RecipientKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
If the specified key has alternate user Ids associated with it, this property returns a comma-separated list of the other user Ids.
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
This property is read-only.
Data Type
String
recipient_key_passphrase property (OpenPGP Struct)
The passphrase for the key's secret key (if any).
Syntax
fn recipient_key_passphrase(&self , RecipientKeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_recipient_key_passphrase(&self, RecipientKeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_recipient_key_passphrase_ref(&self, RecipientKeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The passphrase for the key's secret key (if any). This must be specified before operations requiring the secret key are attempted. The passphrase may be supplied in this property or through the on_key_passphrase event, which will fire when a passphrase is required.
The passphrase is required when using the following methods in KeyMgr:
- add_user_id
- sign_user_id
- change_expiration_date
- change_passphrase
When using the OpenPGP struct, or an email-based struct, the following methods require a passphrase for the key:
- decrypt
- sign
- sign_and_encrypt
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
Data Type
String
recipient_key_public_key property (OpenPGP Struct)
The public key of the key.
Syntax
fn recipient_key_public_key(&self , RecipientKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
The public key of the key. The key is provided as ASCII armored data.
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
This property is read-only.
Data Type
String
recipient_key_public_key_algorithm property (OpenPGP Struct)
A text description of the public key algorithm of the key.
Syntax
fn recipient_key_public_key_algorithm(&self , RecipientKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
A text description of the public key algorithm of the key. Possible values are:
- RSA
- DSA
- ECDSA
- EdDSA
- Ed25519
- Ed448
- ML-DSA-65+Ed25519
- ML-DSA-87+Ed448
- RSA-Legacy
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
This property is read-only.
Data Type
String
recipient_key_public_key_length property (OpenPGP Struct)
The length of the public key in bits.
Syntax
fn recipient_key_public_key_length(&self , RecipientKeyIndex : i32) -> Result<i32, IPWorksPGPError>
Default Value
0
Remarks
The length of the public key in bits. Common values are 1024, 2048, and 3072.
If the recipient_key_public_key_algorithm property is ECDSA, EdDSA, Ed25519, Ed448, ML-DSA-65+Ed25519, or ML-DSA-87+Ed448, the length of the public key is determined by the recipient_key_curve. Possible lengths are:
| Curve | Public Key Length (bits) |
| secp256r1 | 256 |
| secp384r1 | 384 |
| secp521r1 | 528 |
| secp256k1 | 256 |
| Ed25519 | 256 |
| Ed448 | 456 |
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
This property is read-only.
Data Type
i32
recipient_key_revoked property (OpenPGP Struct)
Whether or not the key is revoked.
Syntax
fn recipient_key_revoked(&self , RecipientKeyIndex : i32) -> Result<bool, IPWorksPGPError>
Default Value
false
Remarks
Whether or not the key is revoked.
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
This property is read-only.
Data Type
bool
recipient_key_secret_key property (OpenPGP Struct)
The secret key of the key (if available).
Syntax
fn recipient_key_secret_key(&self , RecipientKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
The secret key of the key (if available). The key is provided as ASCII armored data.
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
This property is read-only.
Data Type
String
recipient_key_secret_key_available property (OpenPGP Struct)
Whether or not a secret key is available for the selected key.
Syntax
fn recipient_key_secret_key_available(&self , RecipientKeyIndex : i32) -> Result<bool, IPWorksPGPError>
Default Value
false
Remarks
Whether or not a secret key is available for the selected key.
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
This property is read-only.
Data Type
bool
recipient_key_usage property (OpenPGP Struct)
A text description of UsageFlags .
Syntax
fn recipient_key_usage(&self , RecipientKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
A text description of recipient_key_usage_flags.
The value will be of one or more of the following strings, separated by commas:
- Certifying Other Certificates
- Signing Emails and Files
- Encrypting Emails and Files
- Split Key
- Authenticate Against Servers
- Group Key
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
This property is read-only.
Data Type
String
recipient_key_usage_flags property (OpenPGP Struct)
Flags that show the intended use for the key.
Syntax
fn recipient_key_usage_flags(&self , RecipientKeyIndex : i32) -> Result<i32, IPWorksPGPError>
Default Value
47
Remarks
Flags that show the intended use for the key. The default value is 0x0F. The value of recipient_key_usage_flags is a combination of the following flags:
| 0x01 | This key may be used to certify other keys. |
| 0x02 | This key may be used to sign data. |
| 0x0C | This key may be used to encrypt communications and encrypt storage. |
| 0x10 | The private component of this key may have been split by a secret-sharing mechanism. |
| 0x20 | This key may be used for authentication. |
| 0x80 | The private component of this key may be in the possession of more than one person. |
Please refer to the recipient_key_usage property for a text representation of recipient_key_usage_flags.
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
This property is read-only.
Data Type
i32
recipient_key_version property (OpenPGP Struct)
This property can be used to query the OpenPGP version of the currently selected Key .
Syntax
fn recipient_key_version(&self , RecipientKeyIndex : i32) -> Result<i32, IPWorksPGPError>
Default Value
4
Remarks
This property can be used to query the OpenPGP version of the currently selected key. Possible values are:
- 4 - OpenPGP v4 (default)
- 5 - LibrePGP v5
- 6 - OpenPGP v6
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
This property is read-only.
Data Type
i32
recipient_key_user_id property (OpenPGP Struct)
The user Id of the key.
Syntax
fn recipient_key_user_id(&self , RecipientKeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_recipient_key_user_id(&self, RecipientKeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_recipient_key_user_id_ref(&self, RecipientKeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The user Id of the key. When a key is loaded this property is populated with the user Id associated with the key. This property may be set to load a key from the recipient_key_keyring. When this property is set the struct will search the recipient_key_keyring for a key associated with the UserId specified.
When loading a key with multiple user Ids, this property will be populated with the UserId that was most recently added to the key. To discover all of the UserIds associated with a key query this property and key_other_user_ids after loading the key.
The UserId format is:
FirstName LastName (Comment) <Email>Not all values are required when selecting or generating a key, but at least FirstName or Email are required.
Note that for OpenPGP v6, a key may be created with or without a UserId, as the field is optional. If a key was created without a UserId, the key's Fingerprint can be used as its identifier instead.
When using this property to select a key you may also specify the key's Id, or any of its subkeys' Ids, instead of a user Id. The struct will then search for a key with a matching Id. This is helpful in situations where you do not have the UserId but still need to load the key, such as within the OpenPGP struct's on_recipient_info event.
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
Data Type
String
recipient_key_id property (OpenPGP Struct)
The hex-encoded, 4-byte or 8-byte key Id.
Syntax
fn recipient_key_id(&self , RecipientKeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_recipient_key_id(&self, RecipientKeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_recipient_key_id_ref(&self, RecipientKeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The hex-encoded, 4-byte or 8-byte key Id. For OpenPGP v4 keys and earlier, the key Id corresponds to the last 4 or 8 bytes of the key's Fingerprint. For OpenPGP v6 keys, the key Id corresponds to the first 8 bytes of the key's Fingerprint instead. For instance:
5E70662EA810E768
When a key is loaded, this property is populated with the Id associated with the key. This property may be set to load a key from the recipient_key_keyring. When this property is set the struct will search the recipient_key_keyring for a key associated with the Id specified.
The KeyIdLength setting may be set to control the length of the returned key Id.
NOTE: It is recommended to use the recipient_key_fingerprint property when loading a key from the recipient_key_keyring, as it is possible for different keys to have the same Id.
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
Data Type
String
recipient_key_fingerprint property (OpenPGP Struct)
The hex-encoded, 20-byte fingerprint of the key.
Syntax
fn recipient_key_fingerprint(&self , RecipientKeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_recipient_key_fingerprint(&self, RecipientKeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_recipient_key_fingerprint_ref(&self, RecipientKeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The hex-encoded, 20-byte fingerprint of the key.
When a key is loaded, this property is populated with the Fingerprint associated with the key. This property may be set to load a key from the recipient_key_keyring. When this property is set the struct will search the recipient_key_keyring for a key associated with the Fingerprint specified.
This is in the form:
5E70662EA810E768391A2FE8F7B7D49C89C9D7B1
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
Data Type
String
recipient_key_encoded property (OpenPGP Struct)
The key.
Syntax
fn recipient_key_encoded(&self , RecipientKeyIndex : i32) -> Result<Vec<u8>, IPWorksPGPError>
fn set_recipient_key_encoded(&self, RecipientKeyIndex : i32, value : Vec<u8>) -> Option<IPWorksPGPError> fn set_recipient_key_encoded_ref(&self, RecipientKeyIndex : i32, value : &[u8]) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The key. This property can be used to assign a specific key. The recipient_key_fingerprint, recipient_key_id, and recipient_key_user_id properties may also be used to specify a key.
The RecipientKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RecipientKeyCount property.
Data Type
Vec
signer_key_count property (OpenPGP Struct)
The number of records in the SignerKey arrays.
Syntax
fn signer_key_count(&self ) -> Result<i32, IPWorksPGPError>
fn set_signer_key_count(&self, value : i32) -> Option<IPWorksPGPError>
Default Value
0
Remarks
This property controls the size of the following arrays:
- signer_key_curve
- signer_key_effective_date
- signer_key_encoded
- signer_key_expiration_date
- signer_key_fingerprint
- signer_key_id
- signer_key_keyring
- signer_key_other_user_ids
- signer_key_passphrase
- signer_key_public_key
- signer_key_public_key_algorithm
- signer_key_public_key_length
- signer_key_revoked
- signer_key_secret_key
- signer_key_secret_key_available
- signer_key_usage
- signer_key_usage_flags
- signer_key_user_id
- signer_key_version
Data Type
i32
signer_key_curve property (OpenPGP Struct)
This property specifies the elliptic curve if PublicKeyAlgorithm is ECDSA , EdDSA , Ed25519 , Ed448 , ML-DSA-65+Ed25519 , or ML-DSA-87+Ed448 .
Syntax
fn signer_key_curve(&self , SignerKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
This property specifies the elliptic curve if signer_key_public_key_algorithm is ECDSA, EdDSA, Ed25519, Ed448, ML-DSA-65+Ed25519, or ML-DSA-87+Ed448. Possible values are:
| Curve | Valid Public Key Algorithms | Description |
| secp256r1 | ECDSA | NIST curve P-256 |
| secp384r1 | ECDSA | NIST curve P-384 |
| secp521r1 | ECDSA | NIST curve P-521 |
| secp256k1 | ECDSA | Secp256k1 |
| brainpoolP256r1 | ECDSA | Brainpool curve P-256r1 |
| brainpoolP384r1 | ECDSA | Brainpool curve P-384r1 |
| brainpoolP512r1 | ECDSA | Brainpool curve P-512r1 |
| Ed25519 | EdDSA, Ed25519, ML-DSA-65+Ed25519 | Ed25519 |
| Ed448 | Ed448, ML-DSA-87+Ed448 | Ed448 |
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
This property is read-only.
Data Type
String
signer_key_effective_date property (OpenPGP Struct)
The date when this key becomes valid.
Syntax
fn signer_key_effective_date(&self , SignerKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
The date when this key becomes valid. Prior to this it is not valid. The following is an example of a valid encoded date:
23-Jan-2000 15:00:00.
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
This property is read-only.
Data Type
String
signer_key_expiration_date property (OpenPGP Struct)
The date the key expires.
Syntax
fn signer_key_expiration_date(&self , SignerKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
The date the key expires. After this date the key will no longer be valid. The following is an example of a valid encoded date:
23-Jan-2001 15:00:00.
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
This property is read-only.
Data Type
String
signer_key_keyring property (OpenPGP Struct)
The location of the keyring.
Syntax
fn signer_key_keyring(&self , SignerKeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_signer_key_keyring(&self, SignerKeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_signer_key_keyring_ref(&self, SignerKeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The location of the keyring.
If the keyring is stored in a directory, set this property to the directory. The directory must contain the files "secring.gpg" and "pubring.gpg". A keyring may also be stored in a single file. If the keyring is a file this property should be set to the path of the file.
When This property is set the struct will read the keyring and populate the key property with the first key found in the keyring. Set key_user_id to select a different key in the current keyring.
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
Data Type
String
signer_key_other_user_ids property (OpenPGP Struct)
If the specified key has alternate user Ids associated with it, this property returns a comma-separated list of the other user Ids.
Syntax
fn signer_key_other_user_ids(&self , SignerKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
If the specified key has alternate user Ids associated with it, this property returns a comma-separated list of the other user Ids.
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
This property is read-only.
Data Type
String
signer_key_passphrase property (OpenPGP Struct)
The passphrase for the key's secret key (if any).
Syntax
fn signer_key_passphrase(&self , SignerKeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_signer_key_passphrase(&self, SignerKeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_signer_key_passphrase_ref(&self, SignerKeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The passphrase for the key's secret key (if any). This must be specified before operations requiring the secret key are attempted. The passphrase may be supplied in this property or through the on_key_passphrase event, which will fire when a passphrase is required.
The passphrase is required when using the following methods in KeyMgr:
- add_user_id
- sign_user_id
- change_expiration_date
- change_passphrase
When using the OpenPGP struct, or an email-based struct, the following methods require a passphrase for the key:
- decrypt
- sign
- sign_and_encrypt
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
Data Type
String
signer_key_public_key property (OpenPGP Struct)
The public key of the key.
Syntax
fn signer_key_public_key(&self , SignerKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
The public key of the key. The key is provided as ASCII armored data.
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
This property is read-only.
Data Type
String
signer_key_public_key_algorithm property (OpenPGP Struct)
A text description of the public key algorithm of the key.
Syntax
fn signer_key_public_key_algorithm(&self , SignerKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
A text description of the public key algorithm of the key. Possible values are:
- RSA
- DSA
- ECDSA
- EdDSA
- Ed25519
- Ed448
- ML-DSA-65+Ed25519
- ML-DSA-87+Ed448
- RSA-Legacy
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
This property is read-only.
Data Type
String
signer_key_public_key_length property (OpenPGP Struct)
The length of the public key in bits.
Syntax
fn signer_key_public_key_length(&self , SignerKeyIndex : i32) -> Result<i32, IPWorksPGPError>
Default Value
0
Remarks
The length of the public key in bits. Common values are 1024, 2048, and 3072.
If the signer_key_public_key_algorithm property is ECDSA, EdDSA, Ed25519, Ed448, ML-DSA-65+Ed25519, or ML-DSA-87+Ed448, the length of the public key is determined by the signer_key_curve. Possible lengths are:
| Curve | Public Key Length (bits) |
| secp256r1 | 256 |
| secp384r1 | 384 |
| secp521r1 | 528 |
| secp256k1 | 256 |
| Ed25519 | 256 |
| Ed448 | 456 |
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
This property is read-only.
Data Type
i32
signer_key_revoked property (OpenPGP Struct)
Whether or not the key is revoked.
Syntax
fn signer_key_revoked(&self , SignerKeyIndex : i32) -> Result<bool, IPWorksPGPError>
Default Value
false
Remarks
Whether or not the key is revoked.
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
This property is read-only.
Data Type
bool
signer_key_secret_key property (OpenPGP Struct)
The secret key of the key (if available).
Syntax
fn signer_key_secret_key(&self , SignerKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
The secret key of the key (if available). The key is provided as ASCII armored data.
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
This property is read-only.
Data Type
String
signer_key_secret_key_available property (OpenPGP Struct)
Whether or not a secret key is available for the selected key.
Syntax
fn signer_key_secret_key_available(&self , SignerKeyIndex : i32) -> Result<bool, IPWorksPGPError>
Default Value
false
Remarks
Whether or not a secret key is available for the selected key.
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
This property is read-only.
Data Type
bool
signer_key_usage property (OpenPGP Struct)
A text description of UsageFlags .
Syntax
fn signer_key_usage(&self , SignerKeyIndex : i32) -> Result<String, IPWorksPGPError>
Default Value
""
Remarks
A text description of signer_key_usage_flags.
The value will be of one or more of the following strings, separated by commas:
- Certifying Other Certificates
- Signing Emails and Files
- Encrypting Emails and Files
- Split Key
- Authenticate Against Servers
- Group Key
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
This property is read-only.
Data Type
String
signer_key_usage_flags property (OpenPGP Struct)
Flags that show the intended use for the key.
Syntax
fn signer_key_usage_flags(&self , SignerKeyIndex : i32) -> Result<i32, IPWorksPGPError>
Default Value
47
Remarks
Flags that show the intended use for the key. The default value is 0x0F. The value of signer_key_usage_flags is a combination of the following flags:
| 0x01 | This key may be used to certify other keys. |
| 0x02 | This key may be used to sign data. |
| 0x0C | This key may be used to encrypt communications and encrypt storage. |
| 0x10 | The private component of this key may have been split by a secret-sharing mechanism. |
| 0x20 | This key may be used for authentication. |
| 0x80 | The private component of this key may be in the possession of more than one person. |
Please refer to the signer_key_usage property for a text representation of signer_key_usage_flags.
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
This property is read-only.
Data Type
i32
signer_key_version property (OpenPGP Struct)
This property can be used to query the OpenPGP version of the currently selected Key .
Syntax
fn signer_key_version(&self , SignerKeyIndex : i32) -> Result<i32, IPWorksPGPError>
Default Value
4
Remarks
This property can be used to query the OpenPGP version of the currently selected key. Possible values are:
- 4 - OpenPGP v4 (default)
- 5 - LibrePGP v5
- 6 - OpenPGP v6
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
This property is read-only.
Data Type
i32
signer_key_user_id property (OpenPGP Struct)
The user Id of the key.
Syntax
fn signer_key_user_id(&self , SignerKeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_signer_key_user_id(&self, SignerKeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_signer_key_user_id_ref(&self, SignerKeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The user Id of the key. When a key is loaded this property is populated with the user Id associated with the key. This property may be set to load a key from the signer_key_keyring. When this property is set the struct will search the signer_key_keyring for a key associated with the UserId specified.
When loading a key with multiple user Ids, this property will be populated with the UserId that was most recently added to the key. To discover all of the UserIds associated with a key query this property and key_other_user_ids after loading the key.
The UserId format is:
FirstName LastName (Comment) <Email>Not all values are required when selecting or generating a key, but at least FirstName or Email are required.
Note that for OpenPGP v6, a key may be created with or without a UserId, as the field is optional. If a key was created without a UserId, the key's Fingerprint can be used as its identifier instead.
When using this property to select a key you may also specify the key's Id, or any of its subkeys' Ids, instead of a user Id. The struct will then search for a key with a matching Id. This is helpful in situations where you do not have the UserId but still need to load the key, such as within the OpenPGP struct's on_recipient_info event.
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
Data Type
String
signer_key_id property (OpenPGP Struct)
The hex-encoded, 4-byte or 8-byte key Id.
Syntax
fn signer_key_id(&self , SignerKeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_signer_key_id(&self, SignerKeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_signer_key_id_ref(&self, SignerKeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The hex-encoded, 4-byte or 8-byte key Id. For OpenPGP v4 keys and earlier, the key Id corresponds to the last 4 or 8 bytes of the key's Fingerprint. For OpenPGP v6 keys, the key Id corresponds to the first 8 bytes of the key's Fingerprint instead. For instance:
5E70662EA810E768
When a key is loaded, this property is populated with the Id associated with the key. This property may be set to load a key from the signer_key_keyring. When this property is set the struct will search the signer_key_keyring for a key associated with the Id specified.
The KeyIdLength setting may be set to control the length of the returned key Id.
NOTE: It is recommended to use the signer_key_fingerprint property when loading a key from the signer_key_keyring, as it is possible for different keys to have the same Id.
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
Data Type
String
signer_key_fingerprint property (OpenPGP Struct)
The hex-encoded, 20-byte fingerprint of the key.
Syntax
fn signer_key_fingerprint(&self , SignerKeyIndex : i32) -> Result<String, IPWorksPGPError>
fn set_signer_key_fingerprint(&self, SignerKeyIndex : i32, value : &str) -> Option<IPWorksPGPError> fn set_signer_key_fingerprint_ref(&self, SignerKeyIndex : i32, value : &String) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The hex-encoded, 20-byte fingerprint of the key.
When a key is loaded, this property is populated with the Fingerprint associated with the key. This property may be set to load a key from the signer_key_keyring. When this property is set the struct will search the signer_key_keyring for a key associated with the Fingerprint specified.
This is in the form:
5E70662EA810E768391A2FE8F7B7D49C89C9D7B1
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
Data Type
String
signer_key_encoded property (OpenPGP Struct)
The key.
Syntax
fn signer_key_encoded(&self , SignerKeyIndex : i32) -> Result<Vec<u8>, IPWorksPGPError>
fn set_signer_key_encoded(&self, SignerKeyIndex : i32, value : Vec<u8>) -> Option<IPWorksPGPError> fn set_signer_key_encoded_ref(&self, SignerKeyIndex : i32, value : &[u8]) -> Option<IPWorksPGPError>
Default Value
""
Remarks
The key. This property can be used to assign a specific key. The signer_key_fingerprint, signer_key_id, and signer_key_user_id properties may also be used to specify a key.
The SignerKeyIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SignerKeyCount property.
Data Type
Vec
signing_algorithm property (OpenPGP Struct)
The signature hash algorithm used when signing.
Syntax
fn signing_algorithm(&self ) -> Result<String, IPWorksPGPError>
fn set_signing_algorithm(&self, value : &str) -> Option<IPWorksPGPError> fn set_signing_algorithm_ref(&self, value : &String) -> Option<IPWorksPGPError>
Default Value
"SHA256"
Remarks
This property specifies the signature hash algorithm used when signing. Possible values are:
- SHA1
- MD5
- SHA256 (default)
- SHA384
- SHA512
- SHA224
- RIPEMD160
- SHA3-256
- SHA3-512
Data Type
String
config method (OpenPGP Struct)
Sets or retrieves a configuration setting.
Syntax
fn config(&self, configuration_string : &str) -> Result<String, IPWorksPGPError>
Remarks
config is a generic method available in every struct. It is used to set and retrieve configuration settings for the struct.
These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the struct, access to these internal properties is provided through the config method.
To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.
decrypt method (OpenPGP Struct)
Decrypts the message.
Syntax
fn decrypt(&self) -> Result<(), IPWorksPGPError>
Remarks
This method decrypts the specified message.
The message will be decrypted using the keys specified in keys. Before decryption begins the struct will fire the on_recipient_info event with information about the encrypted message, including the key used to encrypt the message. Within this event you may use the available information to load the correct key into keys.
decrypt_and_verify_signature method (OpenPGP Struct)
Decrypts and verifies the signature of the message.
Syntax
fn decrypt_and_verify_signature(&self) -> Result<(), IPWorksPGPError>
Remarks
This method attempts to both decrypt and verify the signature of the message. All of the properties affected by calling the decrypt and verify_signature methods are affected in the same manner.
This method may be used when the data is signed, encrypted, or signed and encrypted. For instance, if the data is encrypted but not signed you may still use this method and the struct will perform the decryption without error.
The message will be decrypted using the keys specified in keys. Before decryption begins the struct will fire the on_recipient_info event with information about the encrypted message, including the key used to encrypt the message. Within this event you may use the available information to load the correct key into keys.
The message will be verified using the keys specified in signer_keys. Before verification begins the struct will fire the on_signature_info event with information about the signature including the key used to sign the message. Within this event you may use the information available to load the correct key into signer_keys.
By default, if the signature is not valid the struct fails with an error. The configuration setting RequireValidSignature may be set to False to disable this requirement. When RequireValidSignature is set to False, the Status parameter of the on_verification_status event should be checked to determine the result of the operation.
NOTE: This method does not attempt to check the validity of the signing key itself.
encrypt method (OpenPGP Struct)
Encrypts the message.
Syntax
fn encrypt(&self) -> Result<(), IPWorksPGPError>
Remarks
This method encrypts the specified message.
The message is encrypted with the public keys specified in recipient_keys.
When encrypting, the following properties may be used to further configure the struct:
Additionally, CompatibilityProfile may be set to control whether the encrypted message uses RFC 9580 or GnuPG's LibrePGP format; see CompatibilityProfile for details.
get_recipient_info method (OpenPGP Struct)
Gets recipient information for an encrypted message.
Syntax
fn get_recipient_info(&self) -> Result<(), IPWorksPGPError>
Remarks
This method will fire a on_recipient_info event for every recipient key for which the message has been encrypted. The event will provide the KeyId and Fingerprint, which can be used to identify the correct key to be used for decryption.
interrupt method (OpenPGP Struct)
Interrupt the current method.
Syntax
fn interrupt(&self) -> Result<(), IPWorksPGPError>
Remarks
If there is no method in progress, interrupt simply returns, doing nothing.
reset method (OpenPGP Struct)
Resets the struct properties.
Syntax
fn reset(&self) -> Result<(), IPWorksPGPError>
Remarks
This method resets all message and key properties to their default values.
sign method (OpenPGP Struct)
Signs the message.
Syntax
fn sign(&self) -> Result<(), IPWorksPGPError>
Remarks
This method signs the specified message.
The message is signed with the private key specified in the Key* properties.
When signing, the following properties may be used to further configure the struct:
Additionally, CompatibilityProfile may be set to control whether the signature uses RFC 9580 or GnuPG's LibrePGP format; see CompatibilityProfile for details.
sign_and_encrypt method (OpenPGP Struct)
Signs and encrypts the current message.
Syntax
fn sign_and_encrypt(&self) -> Result<(), IPWorksPGPError>
Remarks
This method signs and encrypts the specified message.
The message is encrypted with the public keys specified in recipient_keys and signed with the private key specified in keys.
When encrypting, the following properties may be used to further configure the struct:
Additionally, CompatibilityProfile may be set to control whether the encrypted message uses RFC 9580 or GnuPG's LibrePGP format; see CompatibilityProfile for details.
When signing, the following properties may be used to further configure the struct:
Additionally, CompatibilityProfile may be set to control whether the signature uses RFC 9580 or GnuPG's LibrePGP format; see CompatibilityProfile for details.
verify_signature method (OpenPGP Struct)
Verifies the signature of the current message.
Syntax
fn verify_signature(&self) -> Result<(), IPWorksPGPError>
Remarks
This method verifies the signature of the message.
The message will be verified using the keys specified in signer_keys. Before verification begins the struct will fire the on_signature_info event with information about the signature including the key used to sign the message. Within this event you may use the information available to load the correct key into signer_keys.
By default, if the signature is not valid the struct fails with an error. The configuration setting RequireValidSignature may be set to False to disable this requirement. When RequireValidSignature is set to False, the Status parameter of the on_verification_status event should be checked to determine the result of the operation.
on_error event (OpenPGP Struct)
Fired when information is available about errors during data delivery.
Syntax
// OpenPGPErrorEventArgs carries the OpenPGP Error event's parameters.
pub struct OpenPGPErrorEventArgs {
fn error_code(&self) -> i32
fn description(&self) -> &String
}
// OpenPGPErrorEvent defines the signature of the OpenPGP Error event's handler function.
pub trait OpenPGPErrorEvent {
fn on_error(&self, sender : OpenPGP, e : &mut OpenPGPErrorEventArgs);
}
impl <'a> OpenPGP<'a> {
pub fn on_error(&self) -> &'a dyn OpenPGPErrorEvent;
pub fn set_on_error(&mut self, value : &'a dyn OpenPGPErrorEvent);
...
}
Remarks
The on_error event is fired in case of exceptional conditions during message processing. Normally the struct fails with an error.
The error_code parameter contains an error code, and the description parameter contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Codes section.
on_key_passphrase event (OpenPGP Struct)
Fired if the passphrase of current key is incorrect or empty.
Syntax
// OpenPGPKeyPassphraseEventArgs carries the OpenPGP KeyPassphrase event's parameters.
pub struct OpenPGPKeyPassphraseEventArgs {
fn user_id(&self) -> &String
fn key_id(&self) -> &String
fn fingerprint(&self) -> &String
fn passphrase(&self) -> &String
fn set_passphrase(&self, value : &str)
fn set_passphrase_ref(&self, value : &String)
}
// OpenPGPKeyPassphraseEvent defines the signature of the OpenPGP KeyPassphrase event's handler function.
pub trait OpenPGPKeyPassphraseEvent {
fn on_key_passphrase(&self, sender : OpenPGP, e : &mut OpenPGPKeyPassphraseEventArgs);
}
impl <'a> OpenPGP<'a> {
pub fn on_key_passphrase(&self) -> &'a dyn OpenPGPKeyPassphraseEvent;
pub fn set_on_key_passphrase(&mut self, value : &'a dyn OpenPGPKeyPassphraseEvent);
...
}
Remarks
This event fires when the passphrase for the key is required. The passphrase must be specified before operations requiring the secret key are attempted. The passphrase may be supplied by setting the Passphrase parameter in this event, or by specifying the key_passphrase property before attempting the operation.
The passphrase is required when using the following methods in KeyMgr:
- add_user_id
- sign_user_id
- change_expiration_date
- change_passphrase
When using the OpenPGP struct, or an email-based struct, the following methods require a passphrase for the key:
UserId holds the user Id of the key the passphrase is required for.
The UserId format is:
FirstName LastName (Comment) <Email>Not all values are required when selecting or generating a key, but at least FirstName or Email are required.
Note that for OpenPGP v6, a key may be created with or without a UserId, as the field is optional. If a key was created without a UserId, the key's Fingerprint can be used as its identifier instead.
KeyId is the hex-encoded, 4-byte or 8-byte Id of the key the passphrase is required for. For OpenPGP v4 keys and earlier, the key Id corresponds to the last 4 or 8 bytes of the key's Fingerprint. For OpenPGP v6 keys, the key Id corresponds to the first 8 bytes of the key's Fingerprint instead. For instance:
5E70662EA810E768
Fingerprint holds the hex-encoded, 20-byte fingerprint of the key the passphrase is required for. This is in the form:
5E70662EA810E768391A2FE8F7B7D49C89C9D7B1
on_progress event (OpenPGP Struct)
Fired as progress is made.
Syntax
// OpenPGPProgressEventArgs carries the OpenPGP Progress event's parameters.
pub struct OpenPGPProgressEventArgs {
fn bytes_processed(&self) -> i64
fn percent_processed(&self) -> i32
fn operation(&self) -> i32
fn is_eof(&self) -> bool
fn set_is_eof(&self, value : bool)
}
// OpenPGPProgressEvent defines the signature of the OpenPGP Progress event's handler function.
pub trait OpenPGPProgressEvent {
fn on_progress(&self, sender : OpenPGP, e : &mut OpenPGPProgressEventArgs);
}
impl <'a> OpenPGP<'a> {
pub fn on_progress(&self) -> &'a dyn OpenPGPProgressEvent;
pub fn set_on_progress(&mut self, value : &'a dyn OpenPGPProgressEvent);
...
}
Remarks
This event is fired automatically as data is processed by the struct.
The PercentProcessed parameter indicates the current status of the operation.
The BytesProcessed parameter holds the total number of bytes processed so far.
The Operation parameter is only applicable when either ReadFromProgressEvent or WriteToProgressEvent is set to True. This parameter defines whether a Read or Write operation is required. If the configuration settings are not set this parameter will always return 0. Possible values are:
| 0 | None |
| 1 | Read |
| 2 | Write |
The IsEOF parameter is only applicable when either ReadFromProgressEvent or WriteToProgressEvent is set to True. This parameter defines whether the Read or Write operation is complete. When the Operation is Read (1) this parameter must be set to indicate that all data has been supplied to the struct. When the Operation is Write (2) this value may be queried to determine when all data has been processed.
on_recipient_info event (OpenPGP Struct)
Fired for each recipient key of the encrypted message.
Syntax
// OpenPGPRecipientInfoEventArgs carries the OpenPGP RecipientInfo event's parameters.
pub struct OpenPGPRecipientInfoEventArgs {
fn key_id(&self) -> &String
fn fingerprint(&self) -> &String
fn public_key_algorithm(&self) -> &String
}
// OpenPGPRecipientInfoEvent defines the signature of the OpenPGP RecipientInfo event's handler function.
pub trait OpenPGPRecipientInfoEvent {
fn on_recipient_info(&self, sender : OpenPGP, e : &mut OpenPGPRecipientInfoEventArgs);
}
impl <'a> OpenPGP<'a> {
pub fn on_recipient_info(&self) -> &'a dyn OpenPGPRecipientInfoEvent;
pub fn set_on_recipient_info(&mut self, value : &'a dyn OpenPGPRecipientInfoEvent);
...
}
Remarks
This event fires when the decrypt or decrypt_and_verify_signature method is called.
KeyId is the hex-encoded 4- or 8-byte Id of the key used to encrypt the message. If a subkey was used to encrypt the message this will be the Id of that subkey. For OpenPGP v4 keys and earlier, the key Id corresponds to the last 4 or 8 bytes of the key's Fingerprint. For OpenPGP v6 keys, the key Id corresponds to the first 8 bytes of the key's Fingerprint instead. For instance:
5E70662EA810E768
Fingerprint holds the hex-encoded, 20-byte fingerprint of the key. This is in the form:
5E70662EA810E768391A2FE8F7B7D49C89C9D7B1
The KeyId and Fingerprint parameters can be used to identify the correct key to specify in the Key* properties. The Key* properties can be set from within this event as this event fires directly before the decryption process begins.
It is recommended to use the Fingerprint to identify the correct key, as it is possible for different keys to have the same KeyId.
PublicKeyAlgorithm is the algorithm of the public key used to encrypt the message. Possible values are:
- RSA
- DSA
- ECDSA
- EdDSA
- Ed25519
- Ed448
- RSA-Legacy
- ECDH (Subkeys only)
- X25519 (Subkeys only)
- X448 (Subkeys only)
- ML-KEM (Subkeys only; LibrePGP/GnuPG)
- ML-KEM-768+X25519 (Subkeys only)
- ML-KEM-1024+X448 (Subkeys only)
on_signature_info event (OpenPGP Struct)
Fired during verification of the signed message.
Syntax
// OpenPGPSignatureInfoEventArgs carries the OpenPGP SignatureInfo event's parameters.
pub struct OpenPGPSignatureInfoEventArgs {
fn key_id(&self) -> &String
fn fingerprint(&self) -> &String
fn signing_algorithm(&self) -> &String
fn public_key_algorithm(&self) -> &String
}
// OpenPGPSignatureInfoEvent defines the signature of the OpenPGP SignatureInfo event's handler function.
pub trait OpenPGPSignatureInfoEvent {
fn on_signature_info(&self, sender : OpenPGP, e : &mut OpenPGPSignatureInfoEventArgs);
}
impl <'a> OpenPGP<'a> {
pub fn on_signature_info(&self) -> &'a dyn OpenPGPSignatureInfoEvent;
pub fn set_on_signature_info(&mut self, value : &'a dyn OpenPGPSignatureInfoEvent);
...
}
Remarks
This event fires when the verify_signature or decrypt_and_verify_signature method is called. It provides information about the signature of the message.
KeyId is the hex-encoded 4- or 8-byte Id of the key used to sign the message. If a subkey was used to sign the message this will be the Id of that subkey. For OpenPGP v4 keys and earlier, the key Id corresponds to the last 4 or 8 bytes of the key's Fingerprint. For OpenPGP v6 keys, the key Id corresponds to the first 8 bytes of the key's Fingerprint instead. For instance:
5E70662EA810E768
Fingerprint holds the hex-encoded, 20-byte fingerprint of the key. This is in the form:
5E70662EA810E768391A2FE8F7B7D49C89C9D7B1
The KeyId and Fingerprint parameters can be used to identify the correct key to specify in the SignerKey* properties. The SignerKey* properties can be set from within this event as this event fires directly before the verification process begins.
It is recommended to use the Fingerprint to identify the correct key, as it is possible for different keys to have the same KeyId.
SigningAlgorithm describes the hash algorithm used when the message was originally signed. This value is applicable only to the message signature, not the key used to sign the message. Possible values are:
- SHA1
- MD5
- SHA256
- SHA384
- SHA512
- SHA224
- RIPEMD160
- SHA3-256
- SHA3-512
PublicKeyAlgorithm is the algorithm of the public key used to sign the message. Possible values are:
- RSA
- DSA
- ECDSA
- EdDSA
- Ed25519
- Ed448
- RSA-Legacy
- ML-DSA-65+Ed25519
- ML-DSA-87+Ed448
- ECDH (Subkeys only)
- X25519 (Subkeys only)
- X448 (Subkeys only)
on_status event (OpenPGP Struct)
Shows the progress of the operation.
Syntax
// OpenPGPStatusEventArgs carries the OpenPGP Status event's parameters.
pub struct OpenPGPStatusEventArgs {
fn message(&self) -> &String
}
// OpenPGPStatusEvent defines the signature of the OpenPGP Status event's handler function.
pub trait OpenPGPStatusEvent {
fn on_status(&self, sender : OpenPGP, e : &mut OpenPGPStatusEventArgs);
}
impl <'a> OpenPGP<'a> {
pub fn on_status(&self) -> &'a dyn OpenPGPStatusEvent;
pub fn set_on_status(&mut self, value : &'a dyn OpenPGPStatusEvent);
...
}
Remarks
The event is fired for informational and logging purposes only. It may be used to track the progress of an operation.
The level of detail is controlled by the LogLevel setting.
on_verification_status event (OpenPGP Struct)
Fired after verification of the signed message.
Syntax
// OpenPGPVerificationStatusEventArgs carries the OpenPGP VerificationStatus event's parameters.
pub struct OpenPGPVerificationStatusEventArgs {
fn key_id(&self) -> &String
fn fingerprint(&self) -> &String
fn status(&self) -> i32
}
// OpenPGPVerificationStatusEvent defines the signature of the OpenPGP VerificationStatus event's handler function.
pub trait OpenPGPVerificationStatusEvent {
fn on_verification_status(&self, sender : OpenPGP, e : &mut OpenPGPVerificationStatusEventArgs);
}
impl <'a> OpenPGP<'a> {
pub fn on_verification_status(&self) -> &'a dyn OpenPGPVerificationStatusEvent;
pub fn set_on_verification_status(&mut self, value : &'a dyn OpenPGPVerificationStatusEvent);
...
}
Remarks
This event fires when verify_signature or decrypt_and_verify_signature is called. It provides information about the result.
KeyId is the hex-encoded 4- or 8-byte Id of the key used to sign the message. For OpenPGP v4 keys and earlier, the key Id corresponds to the last 4 or 8 bytes of the key's Fingerprint. For OpenPGP v6 keys, the key Id corresponds to the first 8 bytes of the key's Fingerprint instead. For instance:
5E70662EA810E768
Fingerprint holds the hex-encoded, 20-byte fingerprint of the key. This is in the form:
5E70662EA810E768391A2FE8F7B7D49C89C9D7B1
Status holds the result of the operation. Possible values are:
| 0 | Verification succeeded |
| 1 | Verification failed |
| 2 | The required key could not be found |
| 3 | Verification succeeded but the key is expired. |
Config Settings (OpenPGP Struct)
The struct accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the struct, access to these internal properties is provided through the config method.OpenPGP Config Settings
By default, this value is 6. Valid values range from 6 to 22.
The chunk size is calculated as 2^exp (in octets, or bytes), where exp is the value of this configuration setting. For example, the default chunk size would be: 2^(6) = 64 bytes. In this case, the plaintext would be split into chunks of 64 bytes, each of which will be individually encrypted using the specified encrypting_algorithm.
When set to True the struct will read the features from the recipient key to determine if the older packet type is required. If the key does require the old packet type, then the older packet type will be used. If the key does not require the old packet type, then the new integrity protected packet type will still be used.
By default this value is False. This means under no conditions is the older less secure packet type used. The newer integrity protected packet type is always used.
Only enable this setting if you have a requirement to do so.
The default value is 3. Valid values range from 1 to 2^(32)-1. Higher values provide more brute-force protection for the key passphrase at the cost of performance. This configuration can be used to tune the running time independently of the memory size (see Argon2MemorySizeExp).
The default value is 16. Valid values range from 3 to 31, though the minimum can vary depending on the value of Argon2Parallelism (see below). The memory size (in KB) is calculated as 2^exp, where exp is the value of this configuration setting. For example, the default memory size would be: 2^(16) = 65,536 KB.
NOTE: The memory size must be an integer number of kilobytes ranging from 8*p to 2^(32)-1, where p is the value of Argon2Parallelism. Therefore, Argon2MemorySizeExp must be an integer ranging from 3+ceil(log2(p)) to 31. For example, if Argon2Parallelism is set to 8, valid values for Argon2MemorySizeExp range from 6 to 31.
The default value is 4. Valid values range from 1 to 2^(24)-1.
| RFC9580 | Creates messages using RFC 9580 formats, including v6 session key packets, RFC 9980 composite ML-KEM recipient keys, and v2 SEIPD packets when AEAD is used. This is the default. |
| LibrePGP | Creates messages compatible with GnuPG's LibrePGP format, including GnuPG ML-KEM recipient keys, v5 symmetric-key session key packets, and OCB Encrypted Data packets when AEAD is used. |
Set this to match the format of the keys involved in the operation, rather than as a fixed preference:
- When encrypting with a recipient key, or signing with a key, that was generated by GnuPG (2.5.x or later) or otherwise uses the LibrePGP key format (see the KeyMgr structs KeyVersion setting), set this to LibrePGP. This also restricts AEAD encryption to the OCB algorithm, since that is the only AEAD algorithm GnuPG supports.
- When the keys involved are RFC 9580 keys not tied to GnuPG, leave this at the default, RFC9580.
Unlike the KeyMgr struct, there is no separate key/packet-version setting here: CompatibilityProfile alone determines which packet version is written for session keys and signatures when a message is created.
This setting only affects the format of messages the struct generates. Decrypting and verifying existing messages (via decrypt and verify_signature) supports both RFC 9580 and LibrePGP formats regardless of this setting.
This value is passed directly to the underlying compression library:
| zlib | -1 (library default), or 0-9 |
| zip | -1 (library default), or 0-9 |
| bzip2 | 1-9 |
89011C04000102000605025100459B000A0910E2...
DSA Notes
DSA requires that the hash be 160 bits or larger, which means MD5 is not a suitable algorithm. When DSA Signature Hash Algorithm selection is enabled (default) the struct will use the preferred algorithm from the key if it meets the requirements for DSA. If the preferred algorithm is MD5 and does not meed the requirements for DSA the struct will automatically use a suitable algorithm based on the Q element of the DSA key (may be SHA1, SHA224, or SHA256).
ECDSA Notes
The ECDSA Signature Hash Algorithm requirements are directly related to the key_curve used by the key. When this setting is enabled (default) the struct will use the preferred algorithm from the key if it meets the requirements for ECDSA. If the preferred algorithm does not meet the requirements the struct will automatically select a valid hash algorithm based on the curve as follows:
| Curve | Hash Algorithm |
| secp256r1 | SHA256 |
| secp384r1 | SHA384 |
| secp521r1 | SHA512 |
| secp256k1 | SHA256 |
For OpenPGP v4 keys and earlier, the key Id corresponds to the last 4 or 8 bytes of the key's Fingerprint. For OpenPGP v6 keys, the key Id corresponds to the first 8 bytes of the key's Fingerprint instead. For instance:
5E70662EA810E768
| 0 | Automatic selection, first suitable subkey. Expired keys accepted. |
| 1 | Automatic selection, first suitable subkey. Expired keys not accepted. |
| 2 | Automatic selection, newest suitable subkey. Expired keys not accepted (Default). |
| 99 | Manual Selection. |
Manual Selection
To manually select a key for any operation pass the key's Id in the constructor.
Openpgp pgp = new Openpgp();
pgp.Config("KeySelectionMethod=99");
pgp.RecipientKeys.Add(new Key(@"C:\path\to\key.asc", "7CA1376C39768977")); // Key with Id 7CA1376C39768977 will be used for encryption.
| 0 (None) | No events are logged. |
| 1 (Info - default) | Informational events are logged. |
| 2 (Verbose) | Detailed data is logged. |
| 3 (Debug) | Debug data is logged. |
- To create a PGP zip file set this value to a location on disk including a filemask and call encrypt. For instance:
OpenPGP1.Config("PGPZipDir=C:\MyFiles\*.txt"); OpenPGP1.OutputFile = "C:\PGPZip.pgp"; OpenPGP1.Encrypt();The created file returned in the output_file property is the PGP zip. If input_file is specified it is used to temporarily hold the Tar archive while creating the PGP zip file. The temporary file is not automatically deleted. If input_file is not specified the Tar archive is held in memory while creating the PGP zip file. - To extract a PGP zip file set this value to a location on disk and call decrypt. For instance:
OpenPGP1.Config("PGPZipDir=C:\MyFiles"); OpenPGP1.InputFile = "C:\PGPZip.pgp"; OpenPGP1.Decrypt();The extracted files will be present in the specified directory. If output_file is specified it is used to temporarily hold the Tar archive. The temporary file is not automatically deleted. If output_file is not specified the Tar archive is held in memory while extracting the PGP zip file. Note that if the OpenPGP message supplied is not a PGP zip file the decryption will occur as normal without error.
| 0 | Automatic - If the PGP message contains the special header version "PGP Command Line" then recursive decryption will be attempted. (Default) |
| 1 | Always attempt recursive decryption. |
| 2 | Never attempt recursive decryption. |
The default value is false.
The default value is false.
Possible values are:
- SHA1 (default)
- MD5
- SHA256
- SHA384
- SHA512
- SHA224
- RIPEMD160
- SHA3-256
- SHA3-512
By default, this value is 96. Valid values range from 0 to 255.
This configuration is only applicable when SymmetricPassphrase is specified and when calling encrypt or decrypt. Additionally, the following configuration settings are applicable when this config is set to True:
Note that if UseArgon2 is enabled, encrypting_algorithm must be specified as an AEAD encryption algorithm (e.g., AES192-OCB). Please see the encrypting_algorithm for additional details.
By default, this config is False, and messages will be encrypted or decrypted in a stream-based manner. When True, the entire message will be loaded into memory prior to encryption or decryption.
This config is True by default, and must be true when verifying an OpenPGP v6 cleartext signature. When enabled, the cleartext portion will be cached in memory until the signature is fully processed.
NOTE: If the signature is known to be an OpenPGP v4 cleartext signature beforehand (i.e., signed with a v4 key), this config may be set to False. However, if this config is disabled, the struct will be unable to verify OpenPGP v6 cleartext signatures. In this case, the struct will throw an exception when calling verify_signature or decrypt_and_verify_signature.
This setting will be populated after calling decrypt, verify_signature, or decrypt_and_verify_signature.
Base Config Settings
The following is a list of valid code page identifiers:
| Identifier | Name |
| 037 | IBM EBCDIC - U.S./Canada |
| 437 | OEM - United States |
| 500 | IBM EBCDIC - International |
| 708 | Arabic - ASMO 708 |
| 709 | Arabic - ASMO 449+, BCON V4 |
| 710 | Arabic - Transparent Arabic |
| 720 | Arabic - Transparent ASMO |
| 737 | OEM - Greek (formerly 437G) |
| 775 | OEM - Baltic |
| 850 | OEM - Multilingual Latin I |
| 852 | OEM - Latin II |
| 855 | OEM - Cyrillic (primarily Russian) |
| 857 | OEM - Turkish |
| 858 | OEM - Multilingual Latin I + Euro symbol |
| 860 | OEM - Portuguese |
| 861 | OEM - Icelandic |
| 862 | OEM - Hebrew |
| 863 | OEM - Canadian-French |
| 864 | OEM - Arabic |
| 865 | OEM - Nordic |
| 866 | OEM - Russian |
| 869 | OEM - Modern Greek |
| 870 | IBM EBCDIC - Multilingual/ROECE (Latin-2) |
| 874 | ANSI/OEM - Thai (same as 28605, ISO 8859-15) |
| 875 | IBM EBCDIC - Modern Greek |
| 932 | ANSI/OEM - Japanese, Shift-JIS |
| 936 | ANSI/OEM - Simplified Chinese (PRC, Singapore) |
| 949 | ANSI/OEM - Korean (Unified Hangul Code) |
| 950 | ANSI/OEM - Traditional Chinese (Taiwan; Hong Kong SAR, PRC) |
| 1026 | IBM EBCDIC - Turkish (Latin-5) |
| 1047 | IBM EBCDIC - Latin 1/Open System |
| 1140 | IBM EBCDIC - U.S./Canada (037 + Euro symbol) |
| 1141 | IBM EBCDIC - Germany (20273 + Euro symbol) |
| 1142 | IBM EBCDIC - Denmark/Norway (20277 + Euro symbol) |
| 1143 | IBM EBCDIC - Finland/Sweden (20278 + Euro symbol) |
| 1144 | IBM EBCDIC - Italy (20280 + Euro symbol) |
| 1145 | IBM EBCDIC - Latin America/Spain (20284 + Euro symbol) |
| 1146 | IBM EBCDIC - United Kingdom (20285 + Euro symbol) |
| 1147 | IBM EBCDIC - France (20297 + Euro symbol) |
| 1148 | IBM EBCDIC - International (500 + Euro symbol) |
| 1149 | IBM EBCDIC - Icelandic (20871 + Euro symbol) |
| 1200 | Unicode UCS-2 Little-Endian (BMP of ISO 10646) |
| 1201 | Unicode UCS-2 Big-Endian |
| 1250 | ANSI - Central European |
| 1251 | ANSI - Cyrillic |
| 1252 | ANSI - Latin I |
| 1253 | ANSI - Greek |
| 1254 | ANSI - Turkish |
| 1255 | ANSI - Hebrew |
| 1256 | ANSI - Arabic |
| 1257 | ANSI - Baltic |
| 1258 | ANSI/OEM - Vietnamese |
| 1361 | Korean (Johab) |
| 10000 | MAC - Roman |
| 10001 | MAC - Japanese |
| 10002 | MAC - Traditional Chinese (Big5) |
| 10003 | MAC - Korean |
| 10004 | MAC - Arabic |
| 10005 | MAC - Hebrew |
| 10006 | MAC - Greek I |
| 10007 | MAC - Cyrillic |
| 10008 | MAC - Simplified Chinese (GB 2312) |
| 10010 | MAC - Romania |
| 10017 | MAC - Ukraine |
| 10021 | MAC - Thai |
| 10029 | MAC - Latin II |
| 10079 | MAC - Icelandic |
| 10081 | MAC - Turkish |
| 10082 | MAC - Croatia |
| 12000 | Unicode UCS-4 Little-Endian |
| 12001 | Unicode UCS-4 Big-Endian |
| 20000 | CNS - Taiwan |
| 20001 | TCA - Taiwan |
| 20002 | Eten - Taiwan |
| 20003 | IBM5550 - Taiwan |
| 20004 | TeleText - Taiwan |
| 20005 | Wang - Taiwan |
| 20105 | IA5 IRV International Alphabet No. 5 (7-bit) |
| 20106 | IA5 German (7-bit) |
| 20107 | IA5 Swedish (7-bit) |
| 20108 | IA5 Norwegian (7-bit) |
| 20127 | US-ASCII (7-bit) |
| 20261 | T.61 |
| 20269 | ISO 6937 Non-Spacing Accent |
| 20273 | IBM EBCDIC - Germany |
| 20277 | IBM EBCDIC - Denmark/Norway |
| 20278 | IBM EBCDIC - Finland/Sweden |
| 20280 | IBM EBCDIC - Italy |
| 20284 | IBM EBCDIC - Latin America/Spain |
| 20285 | IBM EBCDIC - United Kingdom |
| 20290 | IBM EBCDIC - Japanese Katakana Extended |
| 20297 | IBM EBCDIC - France |
| 20420 | IBM EBCDIC - Arabic |
| 20423 | IBM EBCDIC - Greek |
| 20424 | IBM EBCDIC - Hebrew |
| 20833 | IBM EBCDIC - Korean Extended |
| 20838 | IBM EBCDIC - Thai |
| 20866 | Russian - KOI8-R |
| 20871 | IBM EBCDIC - Icelandic |
| 20880 | IBM EBCDIC - Cyrillic (Russian) |
| 20905 | IBM EBCDIC - Turkish |
| 20924 | IBM EBCDIC - Latin-1/Open System (1047 + Euro symbol) |
| 20932 | JIS X 0208-1990 & 0121-1990 |
| 20936 | Simplified Chinese (GB2312) |
| 21025 | IBM EBCDIC - Cyrillic (Serbian, Bulgarian) |
| 21027 | Extended Alpha Lowercase |
| 21866 | Ukrainian (KOI8-U) |
| 28591 | ISO 8859-1 Latin I |
| 28592 | ISO 8859-2 Central Europe |
| 28593 | ISO 8859-3 Latin 3 |
| 28594 | ISO 8859-4 Baltic |
| 28595 | ISO 8859-5 Cyrillic |
| 28596 | ISO 8859-6 Arabic |
| 28597 | ISO 8859-7 Greek |
| 28598 | ISO 8859-8 Hebrew |
| 28599 | ISO 8859-9 Latin 5 |
| 28605 | ISO 8859-15 Latin 9 |
| 29001 | Europa 3 |
| 38598 | ISO 8859-8 Hebrew |
| 50220 | ISO 2022 Japanese with no halfwidth Katakana |
| 50221 | ISO 2022 Japanese with halfwidth Katakana |
| 50222 | ISO 2022 Japanese JIS X 0201-1989 |
| 50225 | ISO 2022 Korean |
| 50227 | ISO 2022 Simplified Chinese |
| 50229 | ISO 2022 Traditional Chinese |
| 50930 | Japanese (Katakana) Extended |
| 50931 | US/Canada and Japanese |
| 50933 | Korean Extended and Korean |
| 50935 | Simplified Chinese Extended and Simplified Chinese |
| 50936 | Simplified Chinese |
| 50937 | US/Canada and Traditional Chinese |
| 50939 | Japanese (Latin) Extended and Japanese |
| 51932 | EUC - Japanese |
| 51936 | EUC - Simplified Chinese |
| 51949 | EUC - Korean |
| 51950 | EUC - Traditional Chinese |
| 52936 | HZ-GB2312 Simplified Chinese |
| 54936 | Windows XP: GB18030 Simplified Chinese (4 Byte) |
| 57002 | ISCII Devanagari |
| 57003 | ISCII Bengali |
| 57004 | ISCII Tamil |
| 57005 | ISCII Telugu |
| 57006 | ISCII Assamese |
| 57007 | ISCII Oriya |
| 57008 | ISCII Kannada |
| 57009 | ISCII Malayalam |
| 57010 | ISCII Gujarati |
| 57011 | ISCII Punjabi |
| 65000 | Unicode UTF-7 |
| 65001 | Unicode UTF-8 |
| Identifier | Name |
| 1 | ASCII |
| 2 | NEXTSTEP |
| 3 | JapaneseEUC |
| 4 | UTF8 |
| 5 | ISOLatin1 |
| 6 | Symbol |
| 7 | NonLossyASCII |
| 8 | ShiftJIS |
| 9 | ISOLatin2 |
| 10 | Unicode |
| 11 | WindowsCP1251 |
| 12 | WindowsCP1252 |
| 13 | WindowsCP1253 |
| 14 | WindowsCP1254 |
| 15 | WindowsCP1250 |
| 21 | ISO2022JP |
| 30 | MacOSRoman |
| 10 | UTF16String |
| 0x90000100 | UTF16BigEndian |
| 0x94000100 | UTF16LittleEndian |
| 0x8c000100 | UTF32String |
| 0x98000100 | UTF32BigEndian |
| 0x9c000100 | UTF32LittleEndian |
| 65536 | Proprietary |
- Product: The product the license is for.
- Product Key: The key the license was generated from.
- License Source: Where the license was found (e.g., RuntimeLicense, License File).
- License Type: The type of license installed (e.g., Royalty Free, Single Server).
- Last Valid Build: The last valid build number for which the license will work.
Setting this configuration setting to true tells the struct to use the internal implementation instead of using the system security libraries.
On Windows, this setting is set to false by default. On Linux/macOS, this setting is set to true by default.
To use the system security libraries for Linux, OpenSSL support must be enabled. For more information on how to enable OpenSSL, please refer to the OpenSSL Notes section.
Trappable Errors (OpenPGP Struct)
OpenPGP Errors
| 101 | Cannot decode ASCII Armor data. |
| 102 | Unknown ASCII Armor data type. |
| 103 | Checksum failed. |
| 104 | Unknown ASCII Armor header. |
| 105 | Cannot decode PGP packet. |
| 106 | Cannot encode PGP packet. |
| 107 | Unknown PGP packet tag. |
| 108 | Unsupported version. |
| 109 | Unsupported algorithm. |
| 110 | Unknown subpacket. |
| 111 | Internal error. |
| 112 | Feature not supported. |
| 113 | Secret data was not encrypted. |
| 114 | Cannot find the key. |
| 115 | Error reading file. |
| 116 | Error writing file. |
| 117 | Error reading key. |
| 118 | Error writing key. |
| 119 | Cannot verify signature. |
| 120 | Cannot create signature. |
| 121 | Invalid UserId. |
| 122 | Invalid passphrase. |
| 123 | Data encryption failed. |
| 124 | Error creating key. |
| 125 | Unsupported symmetric algorithm. |
| 126 | Unsupported hash. |
| 127 | Unsupported compression algorithm. |
| 128 | Invalid key usage. |
| 129 | Component is busy. |
| 130 | Error decrypting data. |
| 131 | Data is not compressed. |
| 132 | Error decompressing data. |
| 133 | Error compressing data. |
| 134 | Unsupported signature. |
| 135 | Failed to overwrite file. |
| 141 | No input. |
| 142 | Signing was required, but the message was not signed. |
| 143 | Encryption was required, but the message was not encrypted. |
| 146 | No data integrity packet was found (MDC), but one was required. |
| 200 | Out of memory. |