# RSA Control

Implements RSA public-key cryptography to encrypt/decrypt and sign/verify messages.

## Syntax

**RSA**

## Remarks

The RSA control implements RSA public-key cryptography to encrypt/decrypt messages and sign/verify hash signatures.

To begin you must either specify an existing key or create a new key. Existing private keys may be specified by setting Key. To create a new key call [CreateKey](#createkey-method-rsa-control). Alternatively an existing certificate may be specified by setting Certificate

**Signing**

To sign data first set Key or Certificate. Specify the input data using [InputFile](#inputfile-property-rsa-control) or [InputMessage](#inputmessage-property-rsa-control). Next call [Sign](#sign-method-rsa-control). The control will populate [HashValue](#hashvalue-property-rsa-control) and [HashSignature](#hashsignature-property-rsa-control). After calling [Sign](#sign-method-rsa-control) the public key must be sent to the recipient along with [HashSignature](#hashsignature-property-rsa-control).

**Encrypting**

To encrypt data set RecipientKey or RecipientCert. Specify the input data using [InputFile](#inputfile-property-rsa-control) or [InputMessage](#inputmessage-property-rsa-control). Next call [Encrypt](#encrypt-method-rsa-control). The control will populate [OutputMessage](#outputmessage-property-rsa-control), or write to the file specified by [OutputFile](#outputfile-property-rsa-control).

**Signature Verification**

To verify a signature specify the input data using [InputFile](#inputfile-property-rsa-control) or [InputMessage](#inputmessage-property-rsa-control). Set SignerKey or SignerCert. Next set [HashSignature](#hashsignature-property-rsa-control) and call [VerifySignature](#verifysignature-method-rsa-control). The [VerifySignature](#verifysignature-method-rsa-control) method will return True if the signature was successfully verified.

**Decrypting**

To decrypt data first set Key or Certificate. Specify the input data using [InputFile](#inputfile-property-rsa-control) or [InputMessage](#inputmessage-property-rsa-control). Next call [Decrypt](#decrypt-method-rsa-control). The control will populate [OutputMessage](#outputmessage-property-rsa-control), or write to the file specified by [OutputFile](#outputfile-property-rsa-control).

**Input and Output Properties**

The control 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:

- [InputFile](#inputfile-property-rsa-control)
- [InputMessage](#inputmessage-property-rsa-control)

When a valid source is found, the search stops. The order in which the output properties are checked is as follows:

- [OutputFile](#outputfile-property-rsa-control)
- [OutputMessage](#outputmessage-property-rsa-control): The output data is written to this property if no other destination is specified.

**RSA Keys**

A RSA key is made up of a number of individual parameters.

The public key consists of the following parameters:

- [KeyModulus](#keymodulus-property-rsa-control)
- [KeyExponent](#keyexponent-property-rsa-control)

The control also includes the [KeyPublicKey](#keypublickey-property-rsa-control) property which holds the PEM formatted public key for ease of use. This is helpful if you are in control of both sides of the encryption/signing and decryption/signature verification process. When sending the public key to a recipient note that not all implementations will support using the PEM formatted value in [KeyPublicKey](#keypublickey-property-rsa-control) in which case the individual parameters must be sent.

The private key may be represented in one of two ways. Both are mathematically equivalent. Private key format 1:

- [KeyModulus](#keymodulus-property-rsa-control)
- [KeyP](#keyp-property-rsa-control)
- [KeyQ](#keyq-property-rsa-control)
- [KeyDP](#keydp-property-rsa-control)
- [KeyDQ](#keydq-property-rsa-control)

 Private key format 2 is simpler but has decreased performance when decrypting and signing. This format is:

- [KeyModulus](#keymodulus-property-rsa-control)
- [KeyD](#keyd-property-rsa-control)

 The control also include the [KeyPrivateKey](#keyprivatekey-property-rsa-control) property which holds the PEM formatted private key for ease of use. This is helpful for storing the private key more easily.

##  Property List

*The following is the full list of the properties of the control with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [CertEffectiveDate](#certeffectivedate-property-rsa-control) | The date on which this certificate becomes valid. |
| [CertEncoded](#certencoded-property-rsa-control) | The certificate (PEM/Base64 encoded). |
| [CertExpirationDate](#certexpirationdate-property-rsa-control) | The date on which the certificate expires. |
| [CertExtendedKeyUsage](#certextendedkeyusage-property-rsa-control) | A comma-delimited list of extended key usage identifiers. |
| [CertFingerprint](#certfingerprint-property-rsa-control) | The hex-encoded, 16-byte MD5 fingerprint of the certificate. |
| [CertFingerprintSHA1](#certfingerprintsha1-property-rsa-control) | The hex-encoded, 20-byte SHA-1 fingerprint of the certificate. |
| [CertFingerprintSHA256](#certfingerprintsha256-property-rsa-control) | The hex-encoded, 32-byte SHA-256 fingerprint of the certificate. |
| [CertIssuer](#certissuer-property-rsa-control) | The issuer of the certificate. |
| [CertPrivateKey](#certprivatekey-property-rsa-control) | The private key of the certificate (if available). |
| [CertPrivateKeyAvailable](#certprivatekeyavailable-property-rsa-control) | Whether a PrivateKey is available for the selected certificate. |
| [CertPrivateKeyContainer](#certprivatekeycontainer-property-rsa-control) | The name of the PrivateKey container for the certificate (if available). |
| [CertPublicKey](#certpublickey-property-rsa-control) | The public key of the certificate. |
| [CertPublicKeyAlgorithm](#certpublickeyalgorithm-property-rsa-control) | The textual description of the certificate's public key algorithm. |
| [CertPublicKeyLength](#certpublickeylength-property-rsa-control) | The length of the certificate's public key (in bits). |
| [CertSerialNumber](#certserialnumber-property-rsa-control) | The serial number of the certificate encoded as a string. |
| [CertSignatureAlgorithm](#certsignaturealgorithm-property-rsa-control) | The text description of the certificate's signature algorithm. |
| [CertStore](#certstore-property-rsa-control) | The name of the certificate store for the client certificate. |
| [CertStorePassword](#certstorepassword-property-rsa-control) | If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store. |
| [CertStoreType](#certstoretype-property-rsa-control) | The type of certificate store for this certificate. |
| [CertSubject](#certsubject-property-rsa-control) | The subject of the certificate used for client authentication. |
| [CertSubjectAltNames](#certsubjectaltnames-property-rsa-control) | Comma-separated lists of alternative subject names for the certificate. |
| [CertThumbprintMD5](#certthumbprintmd5-property-rsa-control) | The MD5 hash of the certificate. |
| [CertThumbprintSHA1](#certthumbprintsha1-property-rsa-control) | The SHA-1 hash of the certificate. |
| [CertThumbprintSHA256](#certthumbprintsha256-property-rsa-control) | The SHA-256 hash of the certificate. |
| [CertUsage](#certusage-property-rsa-control) | The text description of UsageFlags . |
| [CertUsageFlags](#certusageflags-property-rsa-control) | The flags that show intended use for the certificate. |
| [CertVersion](#certversion-property-rsa-control) | The certificate's version number. |
| [HashAlgorithm](#hashalgorithm-property-rsa-control) | The hash algorithm used for signing and signature verification. |
| [HashSignature](#hashsignature-property-rsa-control) | The hash signature. |
| [HashValue](#hashvalue-property-rsa-control) | The hash value of the data. |
| [InputFile](#inputfile-property-rsa-control) | The file to process. |
| [InputMessage](#inputmessage-property-rsa-control) | The message to process. |
| [KeyD](#keyd-property-rsa-control) | Represents the D parameter for the RSA algorithm. |
| [KeyDP](#keydp-property-rsa-control) | Represents the DP parameter for the RSA algorithm. |
| [KeyDQ](#keydq-property-rsa-control) | Represents the DQ parameter for the RSA algorithm. |
| [KeyExponent](#keyexponent-property-rsa-control) | Represents the Exponent parameter for the RSA algorithm. |
| [KeyInverseQ](#keyinverseq-property-rsa-control) | Represents the InverseQ parameter for the RSA algorithm. |
| [KeyModulus](#keymodulus-property-rsa-control) | Represents the Modulus parameter for the RSA algorithm. |
| [KeyP](#keyp-property-rsa-control) | Represents the P parameter for the RSA algorithm. |
| [KeyPrivateKey](#keyprivatekey-property-rsa-control) | This property is a PEM formatted private key. |
| [KeyPublicKey](#keypublickey-property-rsa-control) | This property is a PEM formatted public key. |
| [KeyQ](#keyq-property-rsa-control) | Represents the Q parameter for the RSA algorithm. |
| [OutputFile](#outputfile-property-rsa-control) | The output file when encrypting or decrypting. |
| [OutputMessage](#outputmessage-property-rsa-control) | The output message after processing. |
| [Overwrite](#overwrite-property-rsa-control) | Indicates whether or not the control should overwrite files. |
| [RecipientCertEffectiveDate](#recipientcerteffectivedate-property-rsa-control) | The date on which this certificate becomes valid. |
| [RecipientCertEncoded](#recipientcertencoded-property-rsa-control) | The certificate (PEM/Base64 encoded). |
| [RecipientCertExpirationDate](#recipientcertexpirationdate-property-rsa-control) | The date on which the certificate expires. |
| [RecipientCertExtendedKeyUsage](#recipientcertextendedkeyusage-property-rsa-control) | A comma-delimited list of extended key usage identifiers. |
| [RecipientCertFingerprint](#recipientcertfingerprint-property-rsa-control) | The hex-encoded, 16-byte MD5 fingerprint of the certificate. |
| [RecipientCertFingerprintSHA1](#recipientcertfingerprintsha1-property-rsa-control) | The hex-encoded, 20-byte SHA-1 fingerprint of the certificate. |
| [RecipientCertFingerprintSHA256](#recipientcertfingerprintsha256-property-rsa-control) | The hex-encoded, 32-byte SHA-256 fingerprint of the certificate. |
| [RecipientCertIssuer](#recipientcertissuer-property-rsa-control) | The issuer of the certificate. |
| [RecipientCertPrivateKey](#recipientcertprivatekey-property-rsa-control) | The private key of the certificate (if available). |
| [RecipientCertPrivateKeyAvailable](#recipientcertprivatekeyavailable-property-rsa-control) | Whether a PrivateKey is available for the selected certificate. |
| [RecipientCertPrivateKeyContainer](#recipientcertprivatekeycontainer-property-rsa-control) | The name of the PrivateKey container for the certificate (if available). |
| [RecipientCertPublicKey](#recipientcertpublickey-property-rsa-control) | The public key of the certificate. |
| [RecipientCertPublicKeyAlgorithm](#recipientcertpublickeyalgorithm-property-rsa-control) | The textual description of the certificate's public key algorithm. |
| [RecipientCertPublicKeyLength](#recipientcertpublickeylength-property-rsa-control) | The length of the certificate's public key (in bits). |
| [RecipientCertSerialNumber](#recipientcertserialnumber-property-rsa-control) | The serial number of the certificate encoded as a string. |
| [RecipientCertSignatureAlgorithm](#recipientcertsignaturealgorithm-property-rsa-control) | The text description of the certificate's signature algorithm. |
| [RecipientCertStore](#recipientcertstore-property-rsa-control) | The name of the certificate store for the client certificate. |
| [RecipientCertStorePassword](#recipientcertstorepassword-property-rsa-control) | If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store. |
| [RecipientCertStoreType](#recipientcertstoretype-property-rsa-control) | The type of certificate store for this certificate. |
| [RecipientCertSubject](#recipientcertsubject-property-rsa-control) | The subject of the certificate used for client authentication. |
| [RecipientCertSubjectAltNames](#recipientcertsubjectaltnames-property-rsa-control) | Comma-separated lists of alternative subject names for the certificate. |
| [RecipientCertThumbprintMD5](#recipientcertthumbprintmd5-property-rsa-control) | The MD5 hash of the certificate. |
| [RecipientCertThumbprintSHA1](#recipientcertthumbprintsha1-property-rsa-control) | The SHA-1 hash of the certificate. |
| [RecipientCertThumbprintSHA256](#recipientcertthumbprintsha256-property-rsa-control) | The SHA-256 hash of the certificate. |
| [RecipientCertUsage](#recipientcertusage-property-rsa-control) | The text description of UsageFlags . |
| [RecipientCertUsageFlags](#recipientcertusageflags-property-rsa-control) | The flags that show intended use for the certificate. |
| [RecipientCertVersion](#recipientcertversion-property-rsa-control) | The certificate's version number. |
| [RecipientKeyExponent](#recipientkeyexponent-property-rsa-control) | Represents the Exponent parameter for the RSA algorithm. |
| [RecipientKeyModulus](#recipientkeymodulus-property-rsa-control) | Represents the Modulus parameter for the RSA algorithm. |
| [RecipientKeyPublicKey](#recipientkeypublickey-property-rsa-control) | This property is a PEM formatted public key. |
| [SignerCertEffectiveDate](#signercerteffectivedate-property-rsa-control) | The date on which this certificate becomes valid. |
| [SignerCertEncoded](#signercertencoded-property-rsa-control) | The certificate (PEM/Base64 encoded). |
| [SignerCertExpirationDate](#signercertexpirationdate-property-rsa-control) | The date on which the certificate expires. |
| [SignerCertExtendedKeyUsage](#signercertextendedkeyusage-property-rsa-control) | A comma-delimited list of extended key usage identifiers. |
| [SignerCertFingerprint](#signercertfingerprint-property-rsa-control) | The hex-encoded, 16-byte MD5 fingerprint of the certificate. |
| [SignerCertFingerprintSHA1](#signercertfingerprintsha1-property-rsa-control) | The hex-encoded, 20-byte SHA-1 fingerprint of the certificate. |
| [SignerCertFingerprintSHA256](#signercertfingerprintsha256-property-rsa-control) | The hex-encoded, 32-byte SHA-256 fingerprint of the certificate. |
| [SignerCertIssuer](#signercertissuer-property-rsa-control) | The issuer of the certificate. |
| [SignerCertPrivateKey](#signercertprivatekey-property-rsa-control) | The private key of the certificate (if available). |
| [SignerCertPrivateKeyAvailable](#signercertprivatekeyavailable-property-rsa-control) | Whether a PrivateKey is available for the selected certificate. |
| [SignerCertPrivateKeyContainer](#signercertprivatekeycontainer-property-rsa-control) | The name of the PrivateKey container for the certificate (if available). |
| [SignerCertPublicKey](#signercertpublickey-property-rsa-control) | The public key of the certificate. |
| [SignerCertPublicKeyAlgorithm](#signercertpublickeyalgorithm-property-rsa-control) | The textual description of the certificate's public key algorithm. |
| [SignerCertPublicKeyLength](#signercertpublickeylength-property-rsa-control) | The length of the certificate's public key (in bits). |
| [SignerCertSerialNumber](#signercertserialnumber-property-rsa-control) | The serial number of the certificate encoded as a string. |
| [SignerCertSignatureAlgorithm](#signercertsignaturealgorithm-property-rsa-control) | The text description of the certificate's signature algorithm. |
| [SignerCertStore](#signercertstore-property-rsa-control) | The name of the certificate store for the client certificate. |
| [SignerCertStorePassword](#signercertstorepassword-property-rsa-control) | If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store. |
| [SignerCertStoreType](#signercertstoretype-property-rsa-control) | The type of certificate store for this certificate. |
| [SignerCertSubject](#signercertsubject-property-rsa-control) | The subject of the certificate used for client authentication. |
| [SignerCertSubjectAltNames](#signercertsubjectaltnames-property-rsa-control) | Comma-separated lists of alternative subject names for the certificate. |
| [SignerCertThumbprintMD5](#signercertthumbprintmd5-property-rsa-control) | The MD5 hash of the certificate. |
| [SignerCertThumbprintSHA1](#signercertthumbprintsha1-property-rsa-control) | The SHA-1 hash of the certificate. |
| [SignerCertThumbprintSHA256](#signercertthumbprintsha256-property-rsa-control) | The SHA-256 hash of the certificate. |
| [SignerCertUsage](#signercertusage-property-rsa-control) | The text description of UsageFlags . |
| [SignerCertUsageFlags](#signercertusageflags-property-rsa-control) | The flags that show intended use for the certificate. |
| [SignerCertVersion](#signercertversion-property-rsa-control) | The certificate's version number. |
| [SignerKeyExponent](#signerkeyexponent-property-rsa-control) | Represents the Exponent parameter for the RSA algorithm. |
| [SignerKeyModulus](#signerkeymodulus-property-rsa-control) | Represents the Modulus parameter for the RSA algorithm. |
| [SignerKeyPublicKey](#signerkeypublickey-property-rsa-control) | This property is a PEM formatted public key. |
| [UseHex](#usehex-property-rsa-control) | Whether input or output is hex encoded. |
| [UseOAEP](#useoaep-property-rsa-control) | Whether to use Optimal Asymmetric Encryption Padding (OAEP). |
| [UsePSS](#usepss-property-rsa-control) | Whether to use RSA-PSS during signing and verification. |

## Method List

*The following is the full list of the methods of the control with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [Config](#config-method-rsa-control) | Sets or retrieves a configuration setting. |
| [CreateKey](#createkey-method-rsa-control) | Creates a new key. |
| [Decrypt](#decrypt-method-rsa-control) | Decrypts the input data using the specified private key. |
| [Encrypt](#encrypt-method-rsa-control) | Encrypts the input data using the recipient's public key. |
| [Reset](#reset-method-rsa-control) | Resets the control. |
| [Sign](#sign-method-rsa-control) | Creates a hash signature. |
| [VerifySignature](#verifysignature-method-rsa-control) | Verifies the signature for the specified data. |

## Event List

*The following is the full list of the events fired by the control with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [Error](#error-event-rsa-control) | Fired when information is available about errors during data delivery. |
| [Progress](#progress-event-rsa-control) | Fired as progress is made. |

## Config Settings

*The following is a list of config settings for the control with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [KeyFormat](#KeyFormat) | How the public and private key are formatted. |
| [KeySize](#KeySize) | The size, in bits, of the secret key. |
| [OAEPMGF1HashAlgorithm](#OAEPMGF1HashAlgorithm) | The MGF1 hash algorithm used with OAEP. |
| [OAEPParams](#OAEPParams) | The hex encoded OAEP parameters. |
| [UsePrimitive](#UsePrimitive) | Enables primitive RSA encryption with no padding scheme or output modification. |
| [CodePage](#CodePage) | The system code page used for Unicode to Multibyte translations. |
| [MaskSensitiveData](#MaskSensitiveData) | Whether sensitive data is masked in log messages. |
| [UseInternalSecurityAPI](#UseInternalSecurityAPI) | Whether or not to use the system security libraries or an internal implementation. |

# CertEffectiveDate Property ([RSA](#rsa-control) Control)

The date on which this certificate becomes valid.

## Syntax

```text
rsacontrol.CertEffectiveDate
```

## Default Value

""

## Remarks

The date on which this certificate becomes valid. Before this date, it is not valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:

23-Jan-2000 15:00:00.

This property is read-only.

## Data Type

String

# CertEncoded Property ([RSA](#rsa-control) Control)

The certificate (PEM/Base64 encoded).

## Syntax

```text
rsacontrol.CertEncoded[=string]
```

## Default Value

""

## Remarks

The certificate (PEM/Base64 encoded). This property is used to assign a specific certificate. The [CertStore](#certstore-property-rsa-control) and [CertSubject](#certsubject-property-rsa-control) properties also may be used to specify a certificate.

When [CertEncoded](#certencoded-property-rsa-control) is set, a search is initiated in the current [CertStore](#certstore-property-rsa-control) for the private key of the certificate. If the key is found, [CertSubject](#certsubject-property-rsa-control) is updated to reflect the full subject of the selected certificate; otherwise, [CertSubject](#certsubject-property-rsa-control) is set to an empty string.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.CertEncodedB**.

This property is not available at design time.

## Data Type

Binary String

# CertExpirationDate Property ([RSA](#rsa-control) Control)

The date on which the certificate expires.

## Syntax

```text
rsacontrol.CertExpirationDate
```

## Default Value

""

## Remarks

The date on which the certificate expires. After this date, the certificate will no longer be valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:

23-Jan-2001 15:00:00.

This property is read-only.

## Data Type

String

# CertExtendedKeyUsage Property ([RSA](#rsa-control) Control)

A comma-delimited list of extended key usage identifiers.

## Syntax

```text
rsacontrol.CertExtendedKeyUsage
```

## Default Value

""

## Remarks

A comma-delimited list of extended key usage identifiers. These are the same as ASN.1 object identifiers (OIDs).

This property is read-only.

## Data Type

String

# CertFingerprint Property ([RSA](#rsa-control) Control)

The hex-encoded, 16-byte MD5 fingerprint of the certificate.

## Syntax

```text
rsacontrol.CertFingerprint
```

## Default Value

""

## Remarks

The hex-encoded, 16-byte MD5 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.

The following example illustrates the format: *bc:2a:72:af:fe:58:17:43:7a:5f:ba:5a:7c:90:f7:02*

This property is read-only.

## Data Type

String

# CertFingerprintSHA1 Property ([RSA](#rsa-control) Control)

The hex-encoded, 20-byte SHA-1 fingerprint of the certificate.

## Syntax

```text
rsacontrol.CertFingerprintSHA1
```

## Default Value

""

## Remarks

The hex-encoded, 20-byte SHA-1 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.

The following example illustrates the format: *30:7b:fa:38:65:83:ff:da:b4:4e:07:3f:17:b8:a4:ed:80:be:ff:84*

This property is read-only.

## Data Type

String

# CertFingerprintSHA256 Property ([RSA](#rsa-control) Control)

The hex-encoded, 32-byte SHA-256 fingerprint of the certificate.

## Syntax

```text
rsacontrol.CertFingerprintSHA256
```

## Default Value

""

## Remarks

The hex-encoded, 32-byte SHA-256 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.

The following example illustrates the format: *6a:80:5c:33:a9:43:ea:b0:96:12:8a:64:96:30:ef:4a:8a:96:86:ce:f4:c7:be:10:24:8e:2b:60:9e:f3:59:53*

This property is read-only.

## Data Type

String

# CertIssuer Property ([RSA](#rsa-control) Control)

The issuer of the certificate.

## Syntax

```text
rsacontrol.CertIssuer
```

## Default Value

""

## Remarks

The issuer of the certificate. This property contains a string representation of the name of the issuing authority for the certificate.

This property is read-only.

## Data Type

String

# CertPrivateKey Property ([RSA](#rsa-control) Control)

The private key of the certificate (if available).

## Syntax

```text
rsacontrol.CertPrivateKey
```

## Default Value

""

## Remarks

The private key of the certificate (if available). The key is provided as PEM/Base64-encoded data.

NOTE: The [CertPrivateKey](#certprivatekey-property-rsa-control) may be available but not exportable. In this case, [CertPrivateKey](#certprivatekey-property-rsa-control) returns an empty string.

This property is read-only.

## Data Type

String

# CertPrivateKeyAvailable Property ([RSA](#rsa-control) Control)

Whether a PrivateKey is available for the selected certificate.

## Syntax

```text
rsacontrol.CertPrivateKeyAvailable
```

## Default Value

False

## Remarks

Whether a [CertPrivateKey](#certprivatekey-property-rsa-control) is available for the selected certificate. If [CertPrivateKeyAvailable](#certprivatekeyavailable-property-rsa-control) is True, the certificate may be used for authentication purposes (e.g., server authentication).

This property is read-only.

## Data Type

Boolean

# CertPrivateKeyContainer Property ([RSA](#rsa-control) Control)

The name of the PrivateKey container for the certificate (if available).

## Syntax

```text
rsacontrol.CertPrivateKeyContainer
```

## Default Value

""

## Remarks

The name of the [CertPrivateKey](#certprivatekey-property-rsa-control) container for the certificate (if available). This functionality is available only on Windows platforms.

This property is read-only.

## Data Type

String

# CertPublicKey Property ([RSA](#rsa-control) Control)

The public key of the certificate.

## Syntax

```text
rsacontrol.CertPublicKey
```

## Default Value

""

## Remarks

The public key of the certificate. The key is provided as PEM/Base64-encoded data.

This property is read-only.

## Data Type

String

# CertPublicKeyAlgorithm Property ([RSA](#rsa-control) Control)

The textual description of the certificate's public key algorithm.

## Syntax

```text
rsacontrol.CertPublicKeyAlgorithm
```

## Default Value

""

## Remarks

The textual description of the certificate's public key algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_DH") or an object identifier (OID) string representing the algorithm.

This property is read-only.

## Data Type

String

# CertPublicKeyLength Property ([RSA](#rsa-control) Control)

The length of the certificate's public key (in bits).

## Syntax

```text
rsacontrol.CertPublicKeyLength
```

## Default Value

0

## Remarks

The length of the certificate's public key (in bits). Common values are 512, 1024, and 2048.

This property is read-only.

## Data Type

Integer

# CertSerialNumber Property ([RSA](#rsa-control) Control)

The serial number of the certificate encoded as a string.

## Syntax

```text
rsacontrol.CertSerialNumber
```

## Default Value

""

## Remarks

The serial number of the certificate encoded as a string. The number is encoded as a series of hexadecimal digits, with each pair representing a byte of the serial number.

This property is read-only.

## Data Type

String

# CertSignatureAlgorithm Property ([RSA](#rsa-control) Control)

The text description of the certificate's signature algorithm.

## Syntax

```text
rsacontrol.CertSignatureAlgorithm
```

## Default Value

""

## Remarks

The text description of the certificate's signature algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_MD5RSA") or an object identifier (OID) string representing the algorithm.

This property is read-only.

## Data Type

String

# CertStore Property ([RSA](#rsa-control) Control)

The name of the certificate store for the client certificate.

## Syntax

```text
rsacontrol.CertStore[=string]
```

## Default Value

"MY"

## Remarks

The name of the certificate store for the client certificate.

The [CertStoreType](#certstoretype-property-rsa-control) property denotes the type of the certificate store specified by [CertStore](#certstore-property-rsa-control). If the store is password-protected, specify the password in [CertStorePassword](#certstorepassword-property-rsa-control).

[CertStore](#certstore-property-rsa-control) is used in conjunction with the [CertSubject](#certsubject-property-rsa-control) property to specify client certificates. If [CertStore](#certstore-property-rsa-control) has a value, and [CertSubject](#certsubject-property-rsa-control) or [CertEncoded](#certencoded-property-rsa-control) is set, a search for a certificate is initiated. Please see the [CertSubject](#certsubject-property-rsa-control) property for details.

 Designations of certificate stores are platform dependent.

The following designations are the most common User and Machine certificate stores in Windows:

|  |  |
| --- | --- |
| MY | A certificate store holding personal certificates with their associated private keys. |
| CA | Certifying authority certificates. |
| ROOT | Root certificates. |

When the certificate store type is *cstPFXFile*, this property must be set to the name of the file. When the type is *cstPFXBlob*, the property must be set to the binary contents of a PFX file (i.e., PKCS#12 certificate store).

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.CertStoreB**.

## Data Type

Binary String

# CertStorePassword Property ([RSA](#rsa-control) Control)

If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store.

## Syntax

```text
rsacontrol.CertStorePassword[=string]
```

## Default Value

""

## Remarks

If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store.

## Data Type

String

# CertStoreType Property ([RSA](#rsa-control) Control)

The type of certificate store for this certificate.

## Syntax

```text
rsacontrol.CertStoreType[=integer]
```

## Possible Values

```text
cstUser(0),
cstMachine(1),
cstPFXFile(2),
cstPFXBlob(3),
cstJKSFile(4),
cstJKSBlob(5),
cstPEMKeyFile(6),
cstPEMKeyBlob(7),
cstPublicKeyFile(8),
cstPublicKeyBlob(9),
cstSSHPublicKeyBlob(10),
cstP7BFile(11),
cstP7BBlob(12),
cstSSHPublicKeyFile(13),
cstPPKFile(14),
cstPPKBlob(15),
cstXMLFile(16),
cstXMLBlob(17),
cstJWKFile(18),
cstJWKBlob(19),
cstSecurityKey(20),
cstBCFKSFile(21),
cstBCFKSBlob(22),
cstPKCS11(23),
cstAuto(99)
```

## Default Value

0

## Remarks

The type of certificate store for this certificate.

 The control supports both public and private keys in a variety of formats. When the *cstAuto* value is used, the control will automatically determine the type. This property can take one of the following values:

```csharp
sftp.SSHCert = new Certificate(CertStoreTypes.cstPKCS11,
                               @"C:\Program Files\OpenSC Project\OpenSC\pkcs11\opensc-pkcs11.dll",
                               "123456", // PIN
                               "CN=cert_subject");
sftp.SSHUser = "test";
sftp.SSHLogon("myhost", 22);
```

```csharp
certmgr.CertStoreType = CertStoreTypes.cstPKCS11;
certmgr.OnCertList += (s, e) => {
  secKeyBlob = e.CertEncoded;
};
certmgr.CertStore = @"C:\Program Files\OpenSC Project\OpenSC\pkcs11\opensc-pkcs11.dll";
certmgr.CertStorePassword = "123456"; // PIN
certmgr.ListStoreCertificates();

sftp.SSHCert = new Certificate(CertStoreTypes.cstPKCS11, secKeyBlob, "123456", "*");
sftp.SSHUser = "test";
sftp.SSHLogon("myhost", 22);
```

|  |  |
| --- | --- |
| 0 (cstUser - default) | For Windows, this specifies that the certificate store is a certificate store owned by the current user. NOTE: This store type is not available in Java. |
| 1 (cstMachine) | For Windows, this specifies that the certificate store is a machine store. NOTE: This store type is not available in Java. |
| 2 (cstPFXFile) | The certificate store is the name of a PFX (PKCS#12) file containing certificates. |
| 3 (cstPFXBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in PFX (PKCS#12) format. |
| 4 (cstJKSFile) | The certificate store is the name of a Java Key Store (JKS) file containing certificates. NOTE: This store type is only available in Java. |
| 5 (cstJKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in Java Key Store (JKS) format. NOTE: This store type is only available in Java. |
| 6 (cstPEMKeyFile) | The certificate store is the name of a PEM-encoded file that contains a private key and an optional certificate. |
| 7 (cstPEMKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a private key and an optional certificate. |
| 8 (cstPublicKeyFile) | The certificate store is the name of a file that contains a PEM- or DER-encoded public key certificate. |
| 9 (cstPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a PEM- or DER-encoded public key certificate. |
| 10 (cstSSHPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains an SSH-style public key. |
| 11 (cstP7BFile) | The certificate store is the name of a PKCS#7 file containing certificates. |
| 12 (cstP7BBlob) | The certificate store is a string (binary) representing a certificate store in PKCS#7 format. |
| 13 (cstSSHPublicKeyFile) | The certificate store is the name of a file that contains an SSH-style public key. |
| 14 (cstPPKFile) | The certificate store is the name of a file that contains a PPK (PuTTY Private Key). |
| 15 (cstPPKBlob) | The certificate store is a string (binary) that contains a PPK (PuTTY Private Key). |
| 16 (cstXMLFile) | The certificate store is the name of a file that contains a certificate in XML format. |
| 17 (cstXMLBlob) | The certificate store is a string that contains a certificate in XML format. |
| 18 (cstJWKFile) | The certificate store is the name of a file that contains a JWK (JSON Web Key). |
| 19 (cstJWKBlob) | The certificate store is a string that contains a JWK (JSON Web Key). |
| 21 (cstBCFKSFile) | The certificate store is the name of a file that contains a BCFKS (Bouncy Castle FIPS Key Store). NOTE: This store type is only available in Java and .NET. |
| 22 (cstBCFKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in BCFKS (Bouncy Castle FIPS Key Store) format. NOTE: This store type is only available in Java and .NET. |
| 23 (cstPKCS11) | The certificate is present on a physical security key accessible via a PKCS#11 interface. To use a security key, create a new [Certificate](#Type_Certificate) object and pass cstPKCS11 as the [CertStoreType](#certstoretype-property-rsa-control), the full path of the PKCS#11 DLL as the [CertStore](#certstore-property-rsa-control), and the PIN as the [CertStorePassword](#certstorepassword-property-rsa-control). Code Example. SSH Authentication with Security Key (without CertMgr): Alternatively, collect the necessary data using the [CertMgr](#CertMgr) control by calling the [ListStoreCertificates](#CertMgr_m_ListStoreCertificates) method after setting the corresponding properties accordingly. The certificate information returned in the [CertList](#CertMgr_e_CertList) event's CertEncoded parameter may be saved for later use. When using a certificate obtained with this approach, pass the previously saved security key information as the [CertStore](#certstore-property-rsa-control) and set [CertStorePassword](#certstorepassword-property-rsa-control) to the PIN. Code Example. SSH Authentication with Security Key (with CertMgr): |
| 99 (cstAuto) | The store type is automatically detected from the input data. This setting may be used with both public and private keys and can detect any of the supported formats automatically. |

## Data Type

Integer

# CertSubject Property ([RSA](#rsa-control) Control)

The subject of the certificate used for client authentication.

## Syntax

```text
rsacontrol.CertSubject[=string]
```

## Default Value

""

## Remarks

The subject of the certificate used for client authentication.

This property must be set after all other certificate properties are set. When this property is set, a search is performed in the current certificate store to locate a certificate with a matching subject.

If a matching certificate is found, the property is set to the full subject of the matching certificate.

If an exact match is not found, the store is searched for subjects containing the value of the property.

If a match is still not found, the property is set to an empty string, and no certificate is selected.

The special value "*" picks a random certificate in the certificate store.

The certificate subject is a comma-separated list of distinguished name fields and values. For instance, "CN=www.server.com, OU=test, C=US, E=example@email.com". Common fields and their meanings are as follows:

| Field | Meaning |
| --- | --- |
| CN | Common Name. This is commonly a hostname like www.server.com. |
| O | Organization |
| OU | Organizational Unit |
| L | Locality |
| S | State |
| C | Country |
| E | Email Address |

If a field value contains a comma, it must be quoted.

## Data Type

String

# CertSubjectAltNames Property ([RSA](#rsa-control) Control)

Comma-separated lists of alternative subject names for the certificate.

## Syntax

```text
rsacontrol.CertSubjectAltNames
```

## Default Value

""

## Remarks

Comma-separated lists of alternative subject names for the certificate.

This property is read-only.

## Data Type

String

# CertThumbprintMD5 Property ([RSA](#rsa-control) Control)

The MD5 hash of the certificate.

## Syntax

```text
rsacontrol.CertThumbprintMD5
```

## Default Value

""

## Remarks

The MD5 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.

This property is read-only.

## Data Type

String

# CertThumbprintSHA1 Property ([RSA](#rsa-control) Control)

The SHA-1 hash of the certificate.

## Syntax

```text
rsacontrol.CertThumbprintSHA1
```

## Default Value

""

## Remarks

The SHA-1 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.

This property is read-only.

## Data Type

String

# CertThumbprintSHA256 Property ([RSA](#rsa-control) Control)

The SHA-256 hash of the certificate.

## Syntax

```text
rsacontrol.CertThumbprintSHA256
```

## Default Value

""

## Remarks

The SHA-256 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.

This property is read-only.

## Data Type

String

# CertUsage Property ([RSA](#rsa-control) Control)

The text description of UsageFlags .

## Syntax

```text
rsacontrol.CertUsage
```

## Default Value

""

## Remarks

The text description of [CertUsageFlags](#certusageflags-property-rsa-control).

This value will be one or more of the following strings and will be separated by commas:

- Digital Signature
- Non-Repudiation
- Key Encipherment
- Data Encipherment
- Key Agreement
- Certificate Signing
- CRL Signing
- Encipher Only

If the provider is OpenSSL, the value is a comma-separated list of X.509 certificate extension names.

This property is read-only.

## Data Type

String

# CertUsageFlags Property ([RSA](#rsa-control) Control)

The flags that show intended use for the certificate.

## Syntax

```text
rsacontrol.CertUsageFlags
```

## Default Value

0

## Remarks

The flags that show intended use for the certificate. The value of [CertUsageFlags](#certusageflags-property-rsa-control) is a combination of the following flags:

|  |  |
| --- | --- |
| 0x80 | Digital Signature |
| 0x40 | Non-Repudiation |
| 0x20 | Key Encipherment |
| 0x10 | Data Encipherment |
| 0x08 | Key Agreement |
| 0x04 | Certificate Signing |
| 0x02 | CRL Signing |
| 0x01 | Encipher Only |

Please see the [CertUsage](#certusage-property-rsa-control) property for a text representation of [CertUsageFlags](#certusageflags-property-rsa-control).

This functionality currently is not available when the provider is OpenSSL.

This property is read-only.

## Data Type

Integer

# CertVersion Property ([RSA](#rsa-control) Control)

The certificate's version number.

## Syntax

```text
rsacontrol.CertVersion
```

## Default Value

""

## Remarks

The certificate's version number. The possible values are the strings "V1", "V2", and "V3".

This property is read-only.

## Data Type

String

# HashAlgorithm Property ([RSA](#rsa-control) Control)

The hash algorithm used for signing and signature verification.

## Syntax

```text
rsacontrol.HashAlgorithm[=integer]
```

## Possible Values

```text
rhaSHA1(0),
rhaSHA224(1),
rhaSHA256(2),
rhaSHA384(3),
rhaSHA512(4),
rhaRIPEMD160(5),
rhaMD2(6),
rhaMD5(7),
rhaMD5SHA1(8)
```

## Default Value

2

## Remarks

This property specifies the hash algorithm used for signing and signature verification. Possible values are:

|  |  |
| --- | --- |
| 0 (rhaSHA1) | SHA-1 |
| 1 (rhaSHA224) | SHA-224 |
| 2 (rhaSHA256 - default) | SHA-256 |
| 3 (rhaSHA384) | SHA-384 |
| 4 (rhaSHA512) | SHA-512 |
| 5 (rhaRIPEMD160) | RIPEMD-160 |
| 6 (rhaMD2) | MD2 |
| 7 (rhaMD5) | MD5 |
| 8 (rhaMD5SHA1) | MD5SHA1 |

## Data Type

Integer

# HashSignature Property ([RSA](#rsa-control) Control)

The hash signature.

## Syntax

```text
rsacontrol.HashSignature[=string]
```

## Default Value

""

## Remarks

This property holds the computed hash signature. This is populated after calling [Sign](#sign-method-rsa-control). This must be set before calling [VerifySignature](#verifysignature-method-rsa-control).

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.HashSignatureB**.

## Data Type

Binary String

# HashValue Property ([RSA](#rsa-control) Control)

The hash value of the data.

## Syntax

```text
rsacontrol.HashValue[=string]
```

## Default Value

""

## Remarks

This property holds the computed hash value for the specified data. This is populated when calling [Sign](#sign-method-rsa-control) or [VerifySignature](#verifysignature-method-rsa-control) when an input file is specified by setting [InputFile](#inputfile-property-rsa-control) or [InputMessage](#inputmessage-property-rsa-control).

If you know the hash value prior to using the control you may specify the pre-computed hash value here.

**Hash Notes**

The control will determine whether or not to recompute the hash based on the properties that are set. If a file is specified by [InputFile](#inputfile-property-rsa-control) or [InputMessage](#inputmessage-property-rsa-control), the hash will be recomputed when calling [Sign](#sign-method-rsa-control) or [VerifySignature](#verifysignature-method-rsa-control). If the HashValue property is set, the control will only sign the hash or verify the hash signature. Setting [InputFile](#inputfile-property-rsa-control) or [InputMessage](#inputmessage-property-rsa-control) clears the HashValue property. Setting the HashValue property clears the input file selection.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.HashValueB**.

## Data Type

Binary String

# InputFile Property ([RSA](#rsa-control) Control)

The file to process.

## Syntax

```text
rsacontrol.InputFile[=string]
```

## 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 control 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:

- InputFile
- [InputMessage](#inputmessage-property-rsa-control)

When a valid source is found, the search stops. The order in which the output properties are checked is as follows:

- [OutputFile](#outputfile-property-rsa-control)
- [OutputMessage](#outputmessage-property-rsa-control): The output data is written to this property if no other destination is specified.

## Data Type

String

# InputMessage Property ([RSA](#rsa-control) Control)

The message to process.

## Syntax

```text
rsacontrol.InputMessage[=string]
```

## Default Value

""

## Remarks

This property specifies the message to be processed.

**Input and Output Properties**

The control 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:

- [InputFile](#inputfile-property-rsa-control)
- InputMessage

When a valid source is found, the search stops. The order in which the output properties are checked is as follows:

- [OutputFile](#outputfile-property-rsa-control)
- [OutputMessage](#outputmessage-property-rsa-control): The output data is written to this property if no other destination is specified.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.InputMessageB**.

## Data Type

Binary String

# KeyD Property ([RSA](#rsa-control) Control)

Represents the D parameter for the RSA algorithm.

## Syntax

```text
rsacontrol.KeyD[=string]
```

## Default Value

""

## Remarks

Represents the D parameter for the RSA algorithm.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.KeyDB**.

## Data Type

Binary String

# KeyDP Property ([RSA](#rsa-control) Control)

Represents the DP parameter for the RSA algorithm.

## Syntax

```text
rsacontrol.KeyDP[=string]
```

## Default Value

""

## Remarks

Represents the DP parameter for the RSA algorithm.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.KeyDPB**.

## Data Type

Binary String

# KeyDQ Property ([RSA](#rsa-control) Control)

Represents the DQ parameter for the RSA algorithm.

## Syntax

```text
rsacontrol.KeyDQ[=string]
```

## Default Value

""

## Remarks

Represents the DQ parameter for the RSA algorithm.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.KeyDQB**.

## Data Type

Binary String

# KeyExponent Property ([RSA](#rsa-control) Control)

Represents the Exponent parameter for the RSA algorithm.

## Syntax

```text
rsacontrol.KeyExponent[=string]
```

## Default Value

""

## Remarks

Represents the Exponent parameter for the RSA algorithm.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.KeyExponentB**.

## Data Type

Binary String

# KeyInverseQ Property ([RSA](#rsa-control) Control)

Represents the InverseQ parameter for the RSA algorithm.

## Syntax

```text
rsacontrol.KeyInverseQ[=string]
```

## Default Value

""

## Remarks

Represents the InverseQ parameter for the RSA algorithm. This parameter is optional and is automatically calculated as necessary.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.KeyInverseQB**.

## Data Type

Binary String

# KeyModulus Property ([RSA](#rsa-control) Control)

Represents the Modulus parameter for the RSA algorithm.

## Syntax

```text
rsacontrol.KeyModulus[=string]
```

## Default Value

""

## Remarks

Represents the Modulus parameter for the RSA algorithm.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.KeyModulusB**.

## Data Type

Binary String

# KeyP Property ([RSA](#rsa-control) Control)

Represents the P parameter for the RSA algorithm.

## Syntax

```text
rsacontrol.KeyP[=string]
```

## Default Value

""

## Remarks

Represents the P parameter for the RSA algorithm.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.KeyPB**.

## Data Type

Binary String

# KeyPrivateKey Property ([RSA](#rsa-control) Control)

This property is a PEM formatted private key.

## Syntax

```text
rsacontrol.KeyPrivateKey[=string]
```

## Default Value

""

## Remarks

This property is a PEM formatted private key. The purpose of this property is to allow easier management of the private key parameters by using only a single value.

## Data Type

String

# KeyPublicKey Property ([RSA](#rsa-control) Control)

This property is a PEM formatted public key.

## Syntax

```text
rsacontrol.KeyPublicKey[=string]
```

## Default Value

""

## Remarks

This property is a PEM formatted public key. The purpose of this property is to allow easier management of the public key parameters by using only a single value.

## Data Type

String

# KeyQ Property ([RSA](#rsa-control) Control)

Represents the Q parameter for the RSA algorithm.

## Syntax

```text
rsacontrol.KeyQ[=string]
```

## Default Value

""

## Remarks

Represents the Q parameter for the RSA algorithm.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.KeyQB**.

## Data Type

Binary String

# OutputFile Property ([RSA](#rsa-control) Control)

The output file when encrypting or decrypting.

## Syntax

```text
rsacontrol.OutputFile[=string]
```

## Default Value

""

## Remarks

This property specifies the file to which the output will be written when [Encrypt](#encrypt-method-rsa-control) or [Decrypt](#decrypt-method-rsa-control) is called. This may be set to an absolute or relative path.

This property is only applicable to [Encrypt](#encrypt-method-rsa-control) and [Decrypt](#decrypt-method-rsa-control).

**Input and Output Properties**

The control 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:

- [InputFile](#inputfile-property-rsa-control)
- [InputMessage](#inputmessage-property-rsa-control)

When a valid source is found, the search stops. The order in which the output properties are checked is as follows:

- OutputFile
- [OutputMessage](#outputmessage-property-rsa-control): The output data is written to this property if no other destination is specified.

## Data Type

String

# OutputMessage Property ([RSA](#rsa-control) Control)

The output message after processing.

## Syntax

```text
rsacontrol.OutputMessage
```

## Default Value

""

## Remarks

This property will be populated with the output from the operation if [OutputFile](#outputfile-property-rsa-control) is not set.

**Input and Output Properties**

The control 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:

- [InputFile](#inputfile-property-rsa-control)
- [InputMessage](#inputmessage-property-rsa-control)

When a valid source is found, the search stops. The order in which the output properties are checked is as follows:

- [OutputFile](#outputfile-property-rsa-control)
- OutputMessage: The output data is written to this property if no other destination is specified.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.OutputMessageB**.

This property is read-only and not available at design time.

## Data Type

Binary String

# Overwrite Property ([RSA](#rsa-control) Control)

Indicates whether or not the control should overwrite files.

## Syntax

```text
rsacontrol.Overwrite[=boolean]
```

## Default Value

False

## Remarks

This property indicates whether or not the control will overwrite [OutputFile](#outputfile-property-rsa-control). If Overwrite is False, an error will be thrown whenever [OutputFile](#outputfile-property-rsa-control) exists before an operation. The default value is False.

## Data Type

Boolean

# RecipientCertEffectiveDate Property ([RSA](#rsa-control) Control)

The date on which this certificate becomes valid.

## Syntax

```text
rsacontrol.RecipientCertEffectiveDate
```

## Default Value

""

## Remarks

The date on which this certificate becomes valid. Before this date, it is not valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:

23-Jan-2000 15:00:00.

This property is read-only.

## Data Type

String

# RecipientCertEncoded Property ([RSA](#rsa-control) Control)

The certificate (PEM/Base64 encoded).

## Syntax

```text
rsacontrol.RecipientCertEncoded[=string]
```

## Default Value

""

## Remarks

The certificate (PEM/Base64 encoded). This property is used to assign a specific certificate. The [RecipientCertStore](#recipientcertstore-property-rsa-control) and [RecipientCertSubject](#recipientcertsubject-property-rsa-control) properties also may be used to specify a certificate.

When [RecipientCertEncoded](#recipientcertencoded-property-rsa-control) is set, a search is initiated in the current [RecipientCertStore](#recipientcertstore-property-rsa-control) for the private key of the certificate. If the key is found, [RecipientCertSubject](#recipientcertsubject-property-rsa-control) is updated to reflect the full subject of the selected certificate; otherwise, [RecipientCertSubject](#recipientcertsubject-property-rsa-control) is set to an empty string.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.RecipientCertEncodedB**.

This property is not available at design time.

## Data Type

Binary String

# RecipientCertExpirationDate Property ([RSA](#rsa-control) Control)

The date on which the certificate expires.

## Syntax

```text
rsacontrol.RecipientCertExpirationDate
```

## Default Value

""

## Remarks

The date on which the certificate expires. After this date, the certificate will no longer be valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:

23-Jan-2001 15:00:00.

This property is read-only.

## Data Type

String

# RecipientCertExtendedKeyUsage Property ([RSA](#rsa-control) Control)

A comma-delimited list of extended key usage identifiers.

## Syntax

```text
rsacontrol.RecipientCertExtendedKeyUsage
```

## Default Value

""

## Remarks

A comma-delimited list of extended key usage identifiers. These are the same as ASN.1 object identifiers (OIDs).

This property is read-only.

## Data Type

String

# RecipientCertFingerprint Property ([RSA](#rsa-control) Control)

The hex-encoded, 16-byte MD5 fingerprint of the certificate.

## Syntax

```text
rsacontrol.RecipientCertFingerprint
```

## Default Value

""

## Remarks

The hex-encoded, 16-byte MD5 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.

The following example illustrates the format: *bc:2a:72:af:fe:58:17:43:7a:5f:ba:5a:7c:90:f7:02*

This property is read-only.

## Data Type

String

# RecipientCertFingerprintSHA1 Property ([RSA](#rsa-control) Control)

The hex-encoded, 20-byte SHA-1 fingerprint of the certificate.

## Syntax

```text
rsacontrol.RecipientCertFingerprintSHA1
```

## Default Value

""

## Remarks

The hex-encoded, 20-byte SHA-1 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.

The following example illustrates the format: *30:7b:fa:38:65:83:ff:da:b4:4e:07:3f:17:b8:a4:ed:80:be:ff:84*

This property is read-only.

## Data Type

String

# RecipientCertFingerprintSHA256 Property ([RSA](#rsa-control) Control)

The hex-encoded, 32-byte SHA-256 fingerprint of the certificate.

## Syntax

```text
rsacontrol.RecipientCertFingerprintSHA256
```

## Default Value

""

## Remarks

The hex-encoded, 32-byte SHA-256 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.

The following example illustrates the format: *6a:80:5c:33:a9:43:ea:b0:96:12:8a:64:96:30:ef:4a:8a:96:86:ce:f4:c7:be:10:24:8e:2b:60:9e:f3:59:53*

This property is read-only.

## Data Type

String

# RecipientCertIssuer Property ([RSA](#rsa-control) Control)

The issuer of the certificate.

## Syntax

```text
rsacontrol.RecipientCertIssuer
```

## Default Value

""

## Remarks

The issuer of the certificate. This property contains a string representation of the name of the issuing authority for the certificate.

This property is read-only.

## Data Type

String

# RecipientCertPrivateKey Property ([RSA](#rsa-control) Control)

The private key of the certificate (if available).

## Syntax

```text
rsacontrol.RecipientCertPrivateKey
```

## Default Value

""

## Remarks

The private key of the certificate (if available). The key is provided as PEM/Base64-encoded data.

NOTE: The [RecipientCertPrivateKey](#recipientcertprivatekey-property-rsa-control) may be available but not exportable. In this case, [RecipientCertPrivateKey](#recipientcertprivatekey-property-rsa-control) returns an empty string.

This property is read-only.

## Data Type

String

# RecipientCertPrivateKeyAvailable Property ([RSA](#rsa-control) Control)

Whether a PrivateKey is available for the selected certificate.

## Syntax

```text
rsacontrol.RecipientCertPrivateKeyAvailable
```

## Default Value

False

## Remarks

Whether a [RecipientCertPrivateKey](#recipientcertprivatekey-property-rsa-control) is available for the selected certificate. If [RecipientCertPrivateKeyAvailable](#recipientcertprivatekeyavailable-property-rsa-control) is True, the certificate may be used for authentication purposes (e.g., server authentication).

This property is read-only.

## Data Type

Boolean

# RecipientCertPrivateKeyContainer Property ([RSA](#rsa-control) Control)

The name of the PrivateKey container for the certificate (if available).

## Syntax

```text
rsacontrol.RecipientCertPrivateKeyContainer
```

## Default Value

""

## Remarks

The name of the [RecipientCertPrivateKey](#recipientcertprivatekey-property-rsa-control) container for the certificate (if available). This functionality is available only on Windows platforms.

This property is read-only.

## Data Type

String

# RecipientCertPublicKey Property ([RSA](#rsa-control) Control)

The public key of the certificate.

## Syntax

```text
rsacontrol.RecipientCertPublicKey
```

## Default Value

""

## Remarks

The public key of the certificate. The key is provided as PEM/Base64-encoded data.

This property is read-only.

## Data Type

String

# RecipientCertPublicKeyAlgorithm Property ([RSA](#rsa-control) Control)

The textual description of the certificate's public key algorithm.

## Syntax

```text
rsacontrol.RecipientCertPublicKeyAlgorithm
```

## Default Value

""

## Remarks

The textual description of the certificate's public key algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_DH") or an object identifier (OID) string representing the algorithm.

This property is read-only.

## Data Type

String

# RecipientCertPublicKeyLength Property ([RSA](#rsa-control) Control)

The length of the certificate's public key (in bits).

## Syntax

```text
rsacontrol.RecipientCertPublicKeyLength
```

## Default Value

0

## Remarks

The length of the certificate's public key (in bits). Common values are 512, 1024, and 2048.

This property is read-only.

## Data Type

Integer

# RecipientCertSerialNumber Property ([RSA](#rsa-control) Control)

The serial number of the certificate encoded as a string.

## Syntax

```text
rsacontrol.RecipientCertSerialNumber
```

## Default Value

""

## Remarks

The serial number of the certificate encoded as a string. The number is encoded as a series of hexadecimal digits, with each pair representing a byte of the serial number.

This property is read-only.

## Data Type

String

# RecipientCertSignatureAlgorithm Property ([RSA](#rsa-control) Control)

The text description of the certificate's signature algorithm.

## Syntax

```text
rsacontrol.RecipientCertSignatureAlgorithm
```

## Default Value

""

## Remarks

The text description of the certificate's signature algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_MD5RSA") or an object identifier (OID) string representing the algorithm.

This property is read-only.

## Data Type

String

# RecipientCertStore Property ([RSA](#rsa-control) Control)

The name of the certificate store for the client certificate.

## Syntax

```text
rsacontrol.RecipientCertStore[=string]
```

## Default Value

"MY"

## Remarks

The name of the certificate store for the client certificate.

The [RecipientCertStoreType](#recipientcertstoretype-property-rsa-control) property denotes the type of the certificate store specified by [RecipientCertStore](#recipientcertstore-property-rsa-control). If the store is password-protected, specify the password in [RecipientCertStorePassword](#recipientcertstorepassword-property-rsa-control).

[RecipientCertStore](#recipientcertstore-property-rsa-control) is used in conjunction with the [RecipientCertSubject](#recipientcertsubject-property-rsa-control) property to specify client certificates. If [RecipientCertStore](#recipientcertstore-property-rsa-control) has a value, and [RecipientCertSubject](#recipientcertsubject-property-rsa-control) or [RecipientCertEncoded](#recipientcertencoded-property-rsa-control) is set, a search for a certificate is initiated. Please see the [RecipientCertSubject](#recipientcertsubject-property-rsa-control) property for details.

 Designations of certificate stores are platform dependent.

The following designations are the most common User and Machine certificate stores in Windows:

|  |  |
| --- | --- |
| MY | A certificate store holding personal certificates with their associated private keys. |
| CA | Certifying authority certificates. |
| ROOT | Root certificates. |

When the certificate store type is *cstPFXFile*, this property must be set to the name of the file. When the type is *cstPFXBlob*, the property must be set to the binary contents of a PFX file (i.e., PKCS#12 certificate store).

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.RecipientCertStoreB**.

## Data Type

Binary String

# RecipientCertStorePassword Property ([RSA](#rsa-control) Control)

If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store.

## Syntax

```text
rsacontrol.RecipientCertStorePassword[=string]
```

## Default Value

""

## Remarks

If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store.

## Data Type

String

# RecipientCertStoreType Property ([RSA](#rsa-control) Control)

The type of certificate store for this certificate.

## Syntax

```text
rsacontrol.RecipientCertStoreType[=integer]
```

## Possible Values

```text
cstUser(0),
cstMachine(1),
cstPFXFile(2),
cstPFXBlob(3),
cstJKSFile(4),
cstJKSBlob(5),
cstPEMKeyFile(6),
cstPEMKeyBlob(7),
cstPublicKeyFile(8),
cstPublicKeyBlob(9),
cstSSHPublicKeyBlob(10),
cstP7BFile(11),
cstP7BBlob(12),
cstSSHPublicKeyFile(13),
cstPPKFile(14),
cstPPKBlob(15),
cstXMLFile(16),
cstXMLBlob(17),
cstJWKFile(18),
cstJWKBlob(19),
cstSecurityKey(20),
cstBCFKSFile(21),
cstBCFKSBlob(22),
cstPKCS11(23),
cstAuto(99)
```

## Default Value

0

## Remarks

The type of certificate store for this certificate.

 The control supports both public and private keys in a variety of formats. When the *cstAuto* value is used, the control will automatically determine the type. This property can take one of the following values:

```csharp
sftp.SSHCert = new Certificate(CertStoreTypes.cstPKCS11,
                               @"C:\Program Files\OpenSC Project\OpenSC\pkcs11\opensc-pkcs11.dll",
                               "123456", // PIN
                               "CN=cert_subject");
sftp.SSHUser = "test";
sftp.SSHLogon("myhost", 22);
```

```csharp
certmgr.CertStoreType = CertStoreTypes.cstPKCS11;
certmgr.OnCertList += (s, e) => {
  secKeyBlob = e.CertEncoded;
};
certmgr.CertStore = @"C:\Program Files\OpenSC Project\OpenSC\pkcs11\opensc-pkcs11.dll";
certmgr.CertStorePassword = "123456"; // PIN
certmgr.ListStoreCertificates();

sftp.SSHCert = new Certificate(CertStoreTypes.cstPKCS11, secKeyBlob, "123456", "*");
sftp.SSHUser = "test";
sftp.SSHLogon("myhost", 22);
```

|  |  |
| --- | --- |
| 0 (cstUser - default) | For Windows, this specifies that the certificate store is a certificate store owned by the current user. NOTE: This store type is not available in Java. |
| 1 (cstMachine) | For Windows, this specifies that the certificate store is a machine store. NOTE: This store type is not available in Java. |
| 2 (cstPFXFile) | The certificate store is the name of a PFX (PKCS#12) file containing certificates. |
| 3 (cstPFXBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in PFX (PKCS#12) format. |
| 4 (cstJKSFile) | The certificate store is the name of a Java Key Store (JKS) file containing certificates. NOTE: This store type is only available in Java. |
| 5 (cstJKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in Java Key Store (JKS) format. NOTE: This store type is only available in Java. |
| 6 (cstPEMKeyFile) | The certificate store is the name of a PEM-encoded file that contains a private key and an optional certificate. |
| 7 (cstPEMKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a private key and an optional certificate. |
| 8 (cstPublicKeyFile) | The certificate store is the name of a file that contains a PEM- or DER-encoded public key certificate. |
| 9 (cstPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a PEM- or DER-encoded public key certificate. |
| 10 (cstSSHPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains an SSH-style public key. |
| 11 (cstP7BFile) | The certificate store is the name of a PKCS#7 file containing certificates. |
| 12 (cstP7BBlob) | The certificate store is a string (binary) representing a certificate store in PKCS#7 format. |
| 13 (cstSSHPublicKeyFile) | The certificate store is the name of a file that contains an SSH-style public key. |
| 14 (cstPPKFile) | The certificate store is the name of a file that contains a PPK (PuTTY Private Key). |
| 15 (cstPPKBlob) | The certificate store is a string (binary) that contains a PPK (PuTTY Private Key). |
| 16 (cstXMLFile) | The certificate store is the name of a file that contains a certificate in XML format. |
| 17 (cstXMLBlob) | The certificate store is a string that contains a certificate in XML format. |
| 18 (cstJWKFile) | The certificate store is the name of a file that contains a JWK (JSON Web Key). |
| 19 (cstJWKBlob) | The certificate store is a string that contains a JWK (JSON Web Key). |
| 21 (cstBCFKSFile) | The certificate store is the name of a file that contains a BCFKS (Bouncy Castle FIPS Key Store). NOTE: This store type is only available in Java and .NET. |
| 22 (cstBCFKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in BCFKS (Bouncy Castle FIPS Key Store) format. NOTE: This store type is only available in Java and .NET. |
| 23 (cstPKCS11) | The certificate is present on a physical security key accessible via a PKCS#11 interface. To use a security key, create a new [Certificate](#Type_Certificate) object and pass cstPKCS11 as the [RecipientCertStoreType](#recipientcertstoretype-property-rsa-control), the full path of the PKCS#11 DLL as the [RecipientCertStore](#recipientcertstore-property-rsa-control), and the PIN as the [RecipientCertStorePassword](#recipientcertstorepassword-property-rsa-control). Code Example. SSH Authentication with Security Key (without CertMgr): Alternatively, collect the necessary data using the [CertMgr](#CertMgr) control by calling the [ListStoreCertificates](#CertMgr_m_ListStoreCertificates) method after setting the corresponding properties accordingly. The certificate information returned in the [CertList](#CertMgr_e_CertList) event's CertEncoded parameter may be saved for later use. When using a certificate obtained with this approach, pass the previously saved security key information as the [RecipientCertStore](#recipientcertstore-property-rsa-control) and set [RecipientCertStorePassword](#recipientcertstorepassword-property-rsa-control) to the PIN. Code Example. SSH Authentication with Security Key (with CertMgr): |
| 99 (cstAuto) | The store type is automatically detected from the input data. This setting may be used with both public and private keys and can detect any of the supported formats automatically. |

## Data Type

Integer

# RecipientCertSubject Property ([RSA](#rsa-control) Control)

The subject of the certificate used for client authentication.

## Syntax

```text
rsacontrol.RecipientCertSubject[=string]
```

## Default Value

""

## Remarks

The subject of the certificate used for client authentication.

This property must be set after all other certificate properties are set. When this property is set, a search is performed in the current certificate store to locate a certificate with a matching subject.

If a matching certificate is found, the property is set to the full subject of the matching certificate.

If an exact match is not found, the store is searched for subjects containing the value of the property.

If a match is still not found, the property is set to an empty string, and no certificate is selected.

The special value "*" picks a random certificate in the certificate store.

The certificate subject is a comma-separated list of distinguished name fields and values. For instance, "CN=www.server.com, OU=test, C=US, E=example@email.com". Common fields and their meanings are as follows:

| Field | Meaning |
| --- | --- |
| CN | Common Name. This is commonly a hostname like www.server.com. |
| O | Organization |
| OU | Organizational Unit |
| L | Locality |
| S | State |
| C | Country |
| E | Email Address |

If a field value contains a comma, it must be quoted.

## Data Type

String

# RecipientCertSubjectAltNames Property ([RSA](#rsa-control) Control)

Comma-separated lists of alternative subject names for the certificate.

## Syntax

```text
rsacontrol.RecipientCertSubjectAltNames
```

## Default Value

""

## Remarks

Comma-separated lists of alternative subject names for the certificate.

This property is read-only.

## Data Type

String

# RecipientCertThumbprintMD5 Property ([RSA](#rsa-control) Control)

The MD5 hash of the certificate.

## Syntax

```text
rsacontrol.RecipientCertThumbprintMD5
```

## Default Value

""

## Remarks

The MD5 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.

This property is read-only.

## Data Type

String

# RecipientCertThumbprintSHA1 Property ([RSA](#rsa-control) Control)

The SHA-1 hash of the certificate.

## Syntax

```text
rsacontrol.RecipientCertThumbprintSHA1
```

## Default Value

""

## Remarks

The SHA-1 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.

This property is read-only.

## Data Type

String

# RecipientCertThumbprintSHA256 Property ([RSA](#rsa-control) Control)

The SHA-256 hash of the certificate.

## Syntax

```text
rsacontrol.RecipientCertThumbprintSHA256
```

## Default Value

""

## Remarks

The SHA-256 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.

This property is read-only.

## Data Type

String

# RecipientCertUsage Property ([RSA](#rsa-control) Control)

The text description of UsageFlags .

## Syntax

```text
rsacontrol.RecipientCertUsage
```

## Default Value

""

## Remarks

The text description of [RecipientCertUsageFlags](#recipientcertusageflags-property-rsa-control).

This value will be one or more of the following strings and will be separated by commas:

- Digital Signature
- Non-Repudiation
- Key Encipherment
- Data Encipherment
- Key Agreement
- Certificate Signing
- CRL Signing
- Encipher Only

If the provider is OpenSSL, the value is a comma-separated list of X.509 certificate extension names.

This property is read-only.

## Data Type

String

# RecipientCertUsageFlags Property ([RSA](#rsa-control) Control)

The flags that show intended use for the certificate.

## Syntax

```text
rsacontrol.RecipientCertUsageFlags
```

## Default Value

0

## Remarks

The flags that show intended use for the certificate. The value of [RecipientCertUsageFlags](#recipientcertusageflags-property-rsa-control) is a combination of the following flags:

|  |  |
| --- | --- |
| 0x80 | Digital Signature |
| 0x40 | Non-Repudiation |
| 0x20 | Key Encipherment |
| 0x10 | Data Encipherment |
| 0x08 | Key Agreement |
| 0x04 | Certificate Signing |
| 0x02 | CRL Signing |
| 0x01 | Encipher Only |

Please see the [RecipientCertUsage](#recipientcertusage-property-rsa-control) property for a text representation of [RecipientCertUsageFlags](#recipientcertusageflags-property-rsa-control).

This functionality currently is not available when the provider is OpenSSL.

This property is read-only.

## Data Type

Integer

# RecipientCertVersion Property ([RSA](#rsa-control) Control)

The certificate's version number.

## Syntax

```text
rsacontrol.RecipientCertVersion
```

## Default Value

""

## Remarks

The certificate's version number. The possible values are the strings "V1", "V2", and "V3".

This property is read-only.

## Data Type

String

# RecipientKeyExponent Property ([RSA](#rsa-control) Control)

Represents the Exponent parameter for the RSA algorithm.

## Syntax

```text
rsacontrol.RecipientKeyExponent[=string]
```

## Default Value

""

## Remarks

Represents the Exponent parameter for the RSA algorithm.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.RecipientKeyExponentB**.

## Data Type

Binary String

# RecipientKeyModulus Property ([RSA](#rsa-control) Control)

Represents the Modulus parameter for the RSA algorithm.

## Syntax

```text
rsacontrol.RecipientKeyModulus[=string]
```

## Default Value

""

## Remarks

Represents the Modulus parameter for the RSA algorithm.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.RecipientKeyModulusB**.

## Data Type

Binary String

# RecipientKeyPublicKey Property ([RSA](#rsa-control) Control)

This property is a PEM formatted public key.

## Syntax

```text
rsacontrol.RecipientKeyPublicKey[=string]
```

## Default Value

""

## Remarks

This property is a PEM formatted public key. The purpose of this property is to allow easier management of the public key parameters by using only a single value.

## Data Type

String

# SignerCertEffectiveDate Property ([RSA](#rsa-control) Control)

The date on which this certificate becomes valid.

## Syntax

```text
rsacontrol.SignerCertEffectiveDate
```

## Default Value

""

## Remarks

The date on which this certificate becomes valid. Before this date, it is not valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:

23-Jan-2000 15:00:00.

This property is read-only.

## Data Type

String

# SignerCertEncoded Property ([RSA](#rsa-control) Control)

The certificate (PEM/Base64 encoded).

## Syntax

```text
rsacontrol.SignerCertEncoded[=string]
```

## Default Value

""

## Remarks

The certificate (PEM/Base64 encoded). This property is used to assign a specific certificate. The [SignerCertStore](#signercertstore-property-rsa-control) and [SignerCertSubject](#signercertsubject-property-rsa-control) properties also may be used to specify a certificate.

When [SignerCertEncoded](#signercertencoded-property-rsa-control) is set, a search is initiated in the current [SignerCertStore](#signercertstore-property-rsa-control) for the private key of the certificate. If the key is found, [SignerCertSubject](#signercertsubject-property-rsa-control) is updated to reflect the full subject of the selected certificate; otherwise, [SignerCertSubject](#signercertsubject-property-rsa-control) is set to an empty string.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.SignerCertEncodedB**.

This property is not available at design time.

## Data Type

Binary String

# SignerCertExpirationDate Property ([RSA](#rsa-control) Control)

The date on which the certificate expires.

## Syntax

```text
rsacontrol.SignerCertExpirationDate
```

## Default Value

""

## Remarks

The date on which the certificate expires. After this date, the certificate will no longer be valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:

23-Jan-2001 15:00:00.

This property is read-only.

## Data Type

String

# SignerCertExtendedKeyUsage Property ([RSA](#rsa-control) Control)

A comma-delimited list of extended key usage identifiers.

## Syntax

```text
rsacontrol.SignerCertExtendedKeyUsage
```

## Default Value

""

## Remarks

A comma-delimited list of extended key usage identifiers. These are the same as ASN.1 object identifiers (OIDs).

This property is read-only.

## Data Type

String

# SignerCertFingerprint Property ([RSA](#rsa-control) Control)

The hex-encoded, 16-byte MD5 fingerprint of the certificate.

## Syntax

```text
rsacontrol.SignerCertFingerprint
```

## Default Value

""

## Remarks

The hex-encoded, 16-byte MD5 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.

The following example illustrates the format: *bc:2a:72:af:fe:58:17:43:7a:5f:ba:5a:7c:90:f7:02*

This property is read-only.

## Data Type

String

# SignerCertFingerprintSHA1 Property ([RSA](#rsa-control) Control)

The hex-encoded, 20-byte SHA-1 fingerprint of the certificate.

## Syntax

```text
rsacontrol.SignerCertFingerprintSHA1
```

## Default Value

""

## Remarks

The hex-encoded, 20-byte SHA-1 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.

The following example illustrates the format: *30:7b:fa:38:65:83:ff:da:b4:4e:07:3f:17:b8:a4:ed:80:be:ff:84*

This property is read-only.

## Data Type

String

# SignerCertFingerprintSHA256 Property ([RSA](#rsa-control) Control)

The hex-encoded, 32-byte SHA-256 fingerprint of the certificate.

## Syntax

```text
rsacontrol.SignerCertFingerprintSHA256
```

## Default Value

""

## Remarks

The hex-encoded, 32-byte SHA-256 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.

The following example illustrates the format: *6a:80:5c:33:a9:43:ea:b0:96:12:8a:64:96:30:ef:4a:8a:96:86:ce:f4:c7:be:10:24:8e:2b:60:9e:f3:59:53*

This property is read-only.

## Data Type

String

# SignerCertIssuer Property ([RSA](#rsa-control) Control)

The issuer of the certificate.

## Syntax

```text
rsacontrol.SignerCertIssuer
```

## Default Value

""

## Remarks

The issuer of the certificate. This property contains a string representation of the name of the issuing authority for the certificate.

This property is read-only.

## Data Type

String

# SignerCertPrivateKey Property ([RSA](#rsa-control) Control)

The private key of the certificate (if available).

## Syntax

```text
rsacontrol.SignerCertPrivateKey
```

## Default Value

""

## Remarks

The private key of the certificate (if available). The key is provided as PEM/Base64-encoded data.

NOTE: The [SignerCertPrivateKey](#signercertprivatekey-property-rsa-control) may be available but not exportable. In this case, [SignerCertPrivateKey](#signercertprivatekey-property-rsa-control) returns an empty string.

This property is read-only.

## Data Type

String

# SignerCertPrivateKeyAvailable Property ([RSA](#rsa-control) Control)

Whether a PrivateKey is available for the selected certificate.

## Syntax

```text
rsacontrol.SignerCertPrivateKeyAvailable
```

## Default Value

False

## Remarks

Whether a [SignerCertPrivateKey](#signercertprivatekey-property-rsa-control) is available for the selected certificate. If [SignerCertPrivateKeyAvailable](#signercertprivatekeyavailable-property-rsa-control) is True, the certificate may be used for authentication purposes (e.g., server authentication).

This property is read-only.

## Data Type

Boolean

# SignerCertPrivateKeyContainer Property ([RSA](#rsa-control) Control)

The name of the PrivateKey container for the certificate (if available).

## Syntax

```text
rsacontrol.SignerCertPrivateKeyContainer
```

## Default Value

""

## Remarks

The name of the [SignerCertPrivateKey](#signercertprivatekey-property-rsa-control) container for the certificate (if available). This functionality is available only on Windows platforms.

This property is read-only.

## Data Type

String

# SignerCertPublicKey Property ([RSA](#rsa-control) Control)

The public key of the certificate.

## Syntax

```text
rsacontrol.SignerCertPublicKey
```

## Default Value

""

## Remarks

The public key of the certificate. The key is provided as PEM/Base64-encoded data.

This property is read-only.

## Data Type

String

# SignerCertPublicKeyAlgorithm Property ([RSA](#rsa-control) Control)

The textual description of the certificate's public key algorithm.

## Syntax

```text
rsacontrol.SignerCertPublicKeyAlgorithm
```

## Default Value

""

## Remarks

The textual description of the certificate's public key algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_DH") or an object identifier (OID) string representing the algorithm.

This property is read-only.

## Data Type

String

# SignerCertPublicKeyLength Property ([RSA](#rsa-control) Control)

The length of the certificate's public key (in bits).

## Syntax

```text
rsacontrol.SignerCertPublicKeyLength
```

## Default Value

0

## Remarks

The length of the certificate's public key (in bits). Common values are 512, 1024, and 2048.

This property is read-only.

## Data Type

Integer

# SignerCertSerialNumber Property ([RSA](#rsa-control) Control)

The serial number of the certificate encoded as a string.

## Syntax

```text
rsacontrol.SignerCertSerialNumber
```

## Default Value

""

## Remarks

The serial number of the certificate encoded as a string. The number is encoded as a series of hexadecimal digits, with each pair representing a byte of the serial number.

This property is read-only.

## Data Type

String

# SignerCertSignatureAlgorithm Property ([RSA](#rsa-control) Control)

The text description of the certificate's signature algorithm.

## Syntax

```text
rsacontrol.SignerCertSignatureAlgorithm
```

## Default Value

""

## Remarks

The text description of the certificate's signature algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_MD5RSA") or an object identifier (OID) string representing the algorithm.

This property is read-only.

## Data Type

String

# SignerCertStore Property ([RSA](#rsa-control) Control)

The name of the certificate store for the client certificate.

## Syntax

```text
rsacontrol.SignerCertStore[=string]
```

## Default Value

"MY"

## Remarks

The name of the certificate store for the client certificate.

The [SignerCertStoreType](#signercertstoretype-property-rsa-control) property denotes the type of the certificate store specified by [SignerCertStore](#signercertstore-property-rsa-control). If the store is password-protected, specify the password in [SignerCertStorePassword](#signercertstorepassword-property-rsa-control).

[SignerCertStore](#signercertstore-property-rsa-control) is used in conjunction with the [SignerCertSubject](#signercertsubject-property-rsa-control) property to specify client certificates. If [SignerCertStore](#signercertstore-property-rsa-control) has a value, and [SignerCertSubject](#signercertsubject-property-rsa-control) or [SignerCertEncoded](#signercertencoded-property-rsa-control) is set, a search for a certificate is initiated. Please see the [SignerCertSubject](#signercertsubject-property-rsa-control) property for details.

 Designations of certificate stores are platform dependent.

The following designations are the most common User and Machine certificate stores in Windows:

|  |  |
| --- | --- |
| MY | A certificate store holding personal certificates with their associated private keys. |
| CA | Certifying authority certificates. |
| ROOT | Root certificates. |

When the certificate store type is *cstPFXFile*, this property must be set to the name of the file. When the type is *cstPFXBlob*, the property must be set to the binary contents of a PFX file (i.e., PKCS#12 certificate store).

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.SignerCertStoreB**.

## Data Type

Binary String

# SignerCertStorePassword Property ([RSA](#rsa-control) Control)

If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store.

## Syntax

```text
rsacontrol.SignerCertStorePassword[=string]
```

## Default Value

""

## Remarks

If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store.

## Data Type

String

# SignerCertStoreType Property ([RSA](#rsa-control) Control)

The type of certificate store for this certificate.

## Syntax

```text
rsacontrol.SignerCertStoreType[=integer]
```

## Possible Values

```text
cstUser(0),
cstMachine(1),
cstPFXFile(2),
cstPFXBlob(3),
cstJKSFile(4),
cstJKSBlob(5),
cstPEMKeyFile(6),
cstPEMKeyBlob(7),
cstPublicKeyFile(8),
cstPublicKeyBlob(9),
cstSSHPublicKeyBlob(10),
cstP7BFile(11),
cstP7BBlob(12),
cstSSHPublicKeyFile(13),
cstPPKFile(14),
cstPPKBlob(15),
cstXMLFile(16),
cstXMLBlob(17),
cstJWKFile(18),
cstJWKBlob(19),
cstSecurityKey(20),
cstBCFKSFile(21),
cstBCFKSBlob(22),
cstPKCS11(23),
cstAuto(99)
```

## Default Value

0

## Remarks

The type of certificate store for this certificate.

 The control supports both public and private keys in a variety of formats. When the *cstAuto* value is used, the control will automatically determine the type. This property can take one of the following values:

```csharp
sftp.SSHCert = new Certificate(CertStoreTypes.cstPKCS11,
                               @"C:\Program Files\OpenSC Project\OpenSC\pkcs11\opensc-pkcs11.dll",
                               "123456", // PIN
                               "CN=cert_subject");
sftp.SSHUser = "test";
sftp.SSHLogon("myhost", 22);
```

```csharp
certmgr.CertStoreType = CertStoreTypes.cstPKCS11;
certmgr.OnCertList += (s, e) => {
  secKeyBlob = e.CertEncoded;
};
certmgr.CertStore = @"C:\Program Files\OpenSC Project\OpenSC\pkcs11\opensc-pkcs11.dll";
certmgr.CertStorePassword = "123456"; // PIN
certmgr.ListStoreCertificates();

sftp.SSHCert = new Certificate(CertStoreTypes.cstPKCS11, secKeyBlob, "123456", "*");
sftp.SSHUser = "test";
sftp.SSHLogon("myhost", 22);
```

|  |  |
| --- | --- |
| 0 (cstUser - default) | For Windows, this specifies that the certificate store is a certificate store owned by the current user. NOTE: This store type is not available in Java. |
| 1 (cstMachine) | For Windows, this specifies that the certificate store is a machine store. NOTE: This store type is not available in Java. |
| 2 (cstPFXFile) | The certificate store is the name of a PFX (PKCS#12) file containing certificates. |
| 3 (cstPFXBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in PFX (PKCS#12) format. |
| 4 (cstJKSFile) | The certificate store is the name of a Java Key Store (JKS) file containing certificates. NOTE: This store type is only available in Java. |
| 5 (cstJKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in Java Key Store (JKS) format. NOTE: This store type is only available in Java. |
| 6 (cstPEMKeyFile) | The certificate store is the name of a PEM-encoded file that contains a private key and an optional certificate. |
| 7 (cstPEMKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a private key and an optional certificate. |
| 8 (cstPublicKeyFile) | The certificate store is the name of a file that contains a PEM- or DER-encoded public key certificate. |
| 9 (cstPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a PEM- or DER-encoded public key certificate. |
| 10 (cstSSHPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains an SSH-style public key. |
| 11 (cstP7BFile) | The certificate store is the name of a PKCS#7 file containing certificates. |
| 12 (cstP7BBlob) | The certificate store is a string (binary) representing a certificate store in PKCS#7 format. |
| 13 (cstSSHPublicKeyFile) | The certificate store is the name of a file that contains an SSH-style public key. |
| 14 (cstPPKFile) | The certificate store is the name of a file that contains a PPK (PuTTY Private Key). |
| 15 (cstPPKBlob) | The certificate store is a string (binary) that contains a PPK (PuTTY Private Key). |
| 16 (cstXMLFile) | The certificate store is the name of a file that contains a certificate in XML format. |
| 17 (cstXMLBlob) | The certificate store is a string that contains a certificate in XML format. |
| 18 (cstJWKFile) | The certificate store is the name of a file that contains a JWK (JSON Web Key). |
| 19 (cstJWKBlob) | The certificate store is a string that contains a JWK (JSON Web Key). |
| 21 (cstBCFKSFile) | The certificate store is the name of a file that contains a BCFKS (Bouncy Castle FIPS Key Store). NOTE: This store type is only available in Java and .NET. |
| 22 (cstBCFKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in BCFKS (Bouncy Castle FIPS Key Store) format. NOTE: This store type is only available in Java and .NET. |
| 23 (cstPKCS11) | The certificate is present on a physical security key accessible via a PKCS#11 interface. To use a security key, create a new [Certificate](#Type_Certificate) object and pass cstPKCS11 as the [SignerCertStoreType](#signercertstoretype-property-rsa-control), the full path of the PKCS#11 DLL as the [SignerCertStore](#signercertstore-property-rsa-control), and the PIN as the [SignerCertStorePassword](#signercertstorepassword-property-rsa-control). Code Example. SSH Authentication with Security Key (without CertMgr): Alternatively, collect the necessary data using the [CertMgr](#CertMgr) control by calling the [ListStoreCertificates](#CertMgr_m_ListStoreCertificates) method after setting the corresponding properties accordingly. The certificate information returned in the [CertList](#CertMgr_e_CertList) event's CertEncoded parameter may be saved for later use. When using a certificate obtained with this approach, pass the previously saved security key information as the [SignerCertStore](#signercertstore-property-rsa-control) and set [SignerCertStorePassword](#signercertstorepassword-property-rsa-control) to the PIN. Code Example. SSH Authentication with Security Key (with CertMgr): |
| 99 (cstAuto) | The store type is automatically detected from the input data. This setting may be used with both public and private keys and can detect any of the supported formats automatically. |

## Data Type

Integer

# SignerCertSubject Property ([RSA](#rsa-control) Control)

The subject of the certificate used for client authentication.

## Syntax

```text
rsacontrol.SignerCertSubject[=string]
```

## Default Value

""

## Remarks

The subject of the certificate used for client authentication.

This property must be set after all other certificate properties are set. When this property is set, a search is performed in the current certificate store to locate a certificate with a matching subject.

If a matching certificate is found, the property is set to the full subject of the matching certificate.

If an exact match is not found, the store is searched for subjects containing the value of the property.

If a match is still not found, the property is set to an empty string, and no certificate is selected.

The special value "*" picks a random certificate in the certificate store.

The certificate subject is a comma-separated list of distinguished name fields and values. For instance, "CN=www.server.com, OU=test, C=US, E=example@email.com". Common fields and their meanings are as follows:

| Field | Meaning |
| --- | --- |
| CN | Common Name. This is commonly a hostname like www.server.com. |
| O | Organization |
| OU | Organizational Unit |
| L | Locality |
| S | State |
| C | Country |
| E | Email Address |

If a field value contains a comma, it must be quoted.

## Data Type

String

# SignerCertSubjectAltNames Property ([RSA](#rsa-control) Control)

Comma-separated lists of alternative subject names for the certificate.

## Syntax

```text
rsacontrol.SignerCertSubjectAltNames
```

## Default Value

""

## Remarks

Comma-separated lists of alternative subject names for the certificate.

This property is read-only.

## Data Type

String

# SignerCertThumbprintMD5 Property ([RSA](#rsa-control) Control)

The MD5 hash of the certificate.

## Syntax

```text
rsacontrol.SignerCertThumbprintMD5
```

## Default Value

""

## Remarks

The MD5 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.

This property is read-only.

## Data Type

String

# SignerCertThumbprintSHA1 Property ([RSA](#rsa-control) Control)

The SHA-1 hash of the certificate.

## Syntax

```text
rsacontrol.SignerCertThumbprintSHA1
```

## Default Value

""

## Remarks

The SHA-1 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.

This property is read-only.

## Data Type

String

# SignerCertThumbprintSHA256 Property ([RSA](#rsa-control) Control)

The SHA-256 hash of the certificate.

## Syntax

```text
rsacontrol.SignerCertThumbprintSHA256
```

## Default Value

""

## Remarks

The SHA-256 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.

This property is read-only.

## Data Type

String

# SignerCertUsage Property ([RSA](#rsa-control) Control)

The text description of UsageFlags .

## Syntax

```text
rsacontrol.SignerCertUsage
```

## Default Value

""

## Remarks

The text description of [SignerCertUsageFlags](#signercertusageflags-property-rsa-control).

This value will be one or more of the following strings and will be separated by commas:

- Digital Signature
- Non-Repudiation
- Key Encipherment
- Data Encipherment
- Key Agreement
- Certificate Signing
- CRL Signing
- Encipher Only

If the provider is OpenSSL, the value is a comma-separated list of X.509 certificate extension names.

This property is read-only.

## Data Type

String

# SignerCertUsageFlags Property ([RSA](#rsa-control) Control)

The flags that show intended use for the certificate.

## Syntax

```text
rsacontrol.SignerCertUsageFlags
```

## Default Value

0

## Remarks

The flags that show intended use for the certificate. The value of [SignerCertUsageFlags](#signercertusageflags-property-rsa-control) is a combination of the following flags:

|  |  |
| --- | --- |
| 0x80 | Digital Signature |
| 0x40 | Non-Repudiation |
| 0x20 | Key Encipherment |
| 0x10 | Data Encipherment |
| 0x08 | Key Agreement |
| 0x04 | Certificate Signing |
| 0x02 | CRL Signing |
| 0x01 | Encipher Only |

Please see the [SignerCertUsage](#signercertusage-property-rsa-control) property for a text representation of [SignerCertUsageFlags](#signercertusageflags-property-rsa-control).

This functionality currently is not available when the provider is OpenSSL.

This property is read-only.

## Data Type

Integer

# SignerCertVersion Property ([RSA](#rsa-control) Control)

The certificate's version number.

## Syntax

```text
rsacontrol.SignerCertVersion
```

## Default Value

""

## Remarks

The certificate's version number. The possible values are the strings "V1", "V2", and "V3".

This property is read-only.

## Data Type

String

# SignerKeyExponent Property ([RSA](#rsa-control) Control)

Represents the Exponent parameter for the RSA algorithm.

## Syntax

```text
rsacontrol.SignerKeyExponent[=string]
```

## Default Value

""

## Remarks

Represents the Exponent parameter for the RSA algorithm.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.SignerKeyExponentB**.

## Data Type

Binary String

# SignerKeyModulus Property ([RSA](#rsa-control) Control)

Represents the Modulus parameter for the RSA algorithm.

## Syntax

```text
rsacontrol.SignerKeyModulus[=string]
```

## Default Value

""

## Remarks

Represents the Modulus parameter for the RSA algorithm.

To read or write binary data to the property, a Variant (Byte Array) version is provided in **.SignerKeyModulusB**.

## Data Type

Binary String

# SignerKeyPublicKey Property ([RSA](#rsa-control) Control)

This property is a PEM formatted public key.

## Syntax

```text
rsacontrol.SignerKeyPublicKey[=string]
```

## Default Value

""

## Remarks

This property is a PEM formatted public key. The purpose of this property is to allow easier management of the public key parameters by using only a single value.

## Data Type

String

# UseHex Property ([RSA](#rsa-control) Control)

Whether input or output is hex encoded.

## Syntax

```text
rsacontrol.UseHex[=boolean]
```

## Default Value

False

## Remarks

This property specifies whether the encrypted data, [HashValue](#hashvalue-property-rsa-control), and [HashSignature](#hashsignature-property-rsa-control) are hex encoded.

If set to True, when [Encrypt](#encrypt-method-rsa-control) is called the control will perform the encryption as normal and then hex encode the output. [OutputMessage](#outputmessage-property-rsa-control) or [OutputFile](#outputfile-property-rsa-control) will hold hex encoded data.

If set to True, when [Decrypt](#decrypt-method-rsa-control) is called the control will expect [InputMessage](#inputmessage-property-rsa-control) or [InputFile](#inputfile-property-rsa-control) to hold hex encoded data. The control will then hex decode the data and perform decryption as normal.

If set to True, when [Sign](#sign-method-rsa-control) is called the control will compute the hash for the specified file and populate [HashValue](#hashvalue-property-rsa-control) with the hex encoded hash value. It will then create the hash signature and populate [HashSignature](#hashsignature-property-rsa-control) with the hex encoded hash signature value. If [HashValue](#hashvalue-property-rsa-control) is specified directly, it must be a hex encoded value.

If set to True, when [VerifySignature](#verifysignature-method-rsa-control) is called the control will compute the hash value for the specified file and populate [HashValue](#hashvalue-property-rsa-control) with the hex encoded hash value. It will then hex decode [HashSignature](#hashsignature-property-rsa-control) and verify the signature. [HashSignature](#hashsignature-property-rsa-control) must hold a hex encoded value. If [HashValue](#hashvalue-property-rsa-control) is specified directly, it must be a hex encoded value.

## Data Type

Boolean

# UseOAEP Property ([RSA](#rsa-control) Control)

Whether to use Optimal Asymmetric Encryption Padding (OAEP).

## Syntax

```text
rsacontrol.UseOAEP[=boolean]
```

## Default Value

False

## Remarks

Whether to use Optimal Asymmetric Encryption Padding (OAEP). By default this value is False and the control will use PKCS1.

Note: When set to True the [HashAlgorithm](#hashalgorithm-property-rsa-control) is also applicable when calling [Encrypt](#encrypt-method-rsa-control) and [Decrypt](#decrypt-method-rsa-control).

## Data Type

Boolean

# UsePSS Property ([RSA](#rsa-control) Control)

Whether to use RSA-PSS during signing and verification.

## Syntax

```text
rsacontrol.UsePSS[=boolean]
```

## Default Value

False

## Remarks

This property specifies whether RSA-PSS will be used when signing and verifying messages. The default value is False.

## Data Type

Boolean

# Config Method ([RSA](#rsa-control) Control)

Sets or retrieves a configuration setting.

## Syntax

```text
rsacontrol.Config ConfigurationString
```

## Remarks

Config is a generic method available in every control. It is used to set and retrieve [configuration settings](#config-settings-rsa-control) for the control.

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the control, 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](#config-settings-rsa-control), you must call *Config("PROPERTY")*. The value will be returned as a string.

# CreateKey Method ([RSA](#rsa-control) Control)

Creates a new key.

## Syntax

```text
rsacontrol.CreateKey
```

## Remarks

This method creates a new public and private key.

When calling CreateKey the Key property is populated with a new private and public key.

**RSA Keys**

A RSA key is made up of a number of individual parameters.

The public key consists of the following parameters:

- [KeyModulus](#keymodulus-property-rsa-control)
- [KeyExponent](#keyexponent-property-rsa-control)

The control also includes the [KeyPublicKey](#keypublickey-property-rsa-control) property which holds the PEM formatted public key for ease of use. This is helpful if you are in control of both sides of the encryption/signing and decryption/signature verification process. When sending the public key to a recipient note that not all implementations will support using the PEM formatted value in [KeyPublicKey](#keypublickey-property-rsa-control) in which case the individual parameters must be sent.

The private key may be represented in one of two ways. Both are mathematically equivalent. Private key format 1:

- [KeyModulus](#keymodulus-property-rsa-control)
- [KeyP](#keyp-property-rsa-control)
- [KeyQ](#keyq-property-rsa-control)
- [KeyDP](#keydp-property-rsa-control)
- [KeyDQ](#keydq-property-rsa-control)

 Private key format 2 is simpler but has decreased performance when decrypting and signing. This format is:

- [KeyModulus](#keymodulus-property-rsa-control)
- [KeyD](#keyd-property-rsa-control)

 The control also include the [KeyPrivateKey](#keyprivatekey-property-rsa-control) property which holds the PEM formatted private key for ease of use. This is helpful for storing the private key more easily.

# Decrypt Method ([RSA](#rsa-control) Control)

Decrypts the input data using the specified private key.

## Syntax

```text
rsacontrol.Decrypt
```

## Remarks

This method decrypts the input data using the private key specified in Key. Alternatively, a certificate may be specified by setting Certificate.

**Input and Output Properties**

The control 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:

- [InputFile](#inputfile-property-rsa-control)
- [InputMessage](#inputmessage-property-rsa-control)

When a valid source is found, the search stops. The order in which the output properties are checked is as follows:

- [OutputFile](#outputfile-property-rsa-control)
- [OutputMessage](#outputmessage-property-rsa-control): The output data is written to this property if no other destination is specified.

**Key Size and the Maximum Length of Data**

RSA has an upper limit to the amount of data that can be encrypted or decrypted, also known as message length. This can typically be calculated as the size of the key minus the size of the RSA header and padding.

When not using OAEP, the following formula and table can be referenced. (RSA Key Bytes) - (Header Bytes) = Length of data, where Header Bytes is always 11.

| RSA Key Length (bits) | Length (bits) | Length (bytes) |
| --- | --- | --- |
| 1024 | 936 | 117 |
| 2048 | 1960 | 245 |
| 3072 | 2984 | 373 |
| 4096 | 4008 | 501 |

When using OAEP, the following formula and table can be referenced. (RSA Key Bytes) - (2 * Hash Length Bytes) - 2 = Length of data. The table below assumes SHA-256 for the hash, so Hash Length Bytes is 32.

| RSA Key Length (bits) | Length (bits) | Length (bytes) |
| --- | --- | --- |
| 1024 | 496 | 62 |
| 2048 | 1520 | 190 |
| 3072 | 2544 | 318 |
| 4096 | 3568 | 446 |

# Encrypt Method ([RSA](#rsa-control) Control)

Encrypts the input data using the recipient's public key.

## Syntax

```text
rsacontrol.Encrypt
```

## Remarks

This method encrypts the input data using the public key specified in RecipientKey. Alternatively, a certificate may be specified by setting RecipientCert.

**Input and Output Properties**

The control 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:

- [InputFile](#inputfile-property-rsa-control)
- [InputMessage](#inputmessage-property-rsa-control)

When a valid source is found, the search stops. The order in which the output properties are checked is as follows:

- [OutputFile](#outputfile-property-rsa-control)
- [OutputMessage](#outputmessage-property-rsa-control): The output data is written to this property if no other destination is specified.

**Key Size and the Maximum Length of Data**

RSA has an upper limit to the amount of data that can be encrypted or decrypted, also known as message length. This can typically be calculated as the size of the key minus the size of the RSA header and padding.

When not using OAEP, the following formula and table can be referenced. (RSA Key Bytes) - (Header Bytes) = Length of data, where Header Bytes is always 11.

| RSA Key Length (bits) | Length (bits) | Length (bytes) |
| --- | --- | --- |
| 1024 | 936 | 117 |
| 2048 | 1960 | 245 |
| 3072 | 2984 | 373 |
| 4096 | 4008 | 501 |

When using OAEP, the following formula and table can be referenced. (RSA Key Bytes) - (2 * Hash Length Bytes) - 2 = Length of data. The table below assumes SHA-256 for the hash, so Hash Length Bytes is 32.

| RSA Key Length (bits) | Length (bits) | Length (bytes) |
| --- | --- | --- |
| 1024 | 496 | 62 |
| 2048 | 1520 | 190 |
| 3072 | 2544 | 318 |
| 4096 | 3568 | 446 |

# Reset Method ([RSA](#rsa-control) Control)

Resets the control.

## Syntax

```text
rsacontrol.Reset
```

## Remarks

When called, the control will reset all of its properties to their default values.

# Sign Method ([RSA](#rsa-control) Control)

Creates a hash signature.

## Syntax

```text
rsacontrol.Sign
```

## Remarks

This method will create a hash signature.

Before calling this method specify the input file by setting [InputFile](#inputfile-property-rsa-control) or [InputMessage](#inputmessage-property-rsa-control).

A key is required to create the hash signature. You may create a new key by calling [CreateKey](#createkey-method-rsa-control), or specify an existing key pair in Key. Alternatively, a certificate may be specified by setting Certificate. When this method is called the control will compute the hash for the specified file and populate [HashValue](#hashvalue-property-rsa-control). It will then create the hash signature using the specified Key and populate [HashSignature](#hashsignature-property-rsa-control).

To create the hash signature without first computing the hash simply specify [HashValue](#hashvalue-property-rsa-control) before calling this method.

The [Progress](#progress-event-rsa-control) event will fire with updates for the hash computation progress only. The hash signature creation process is quick and does not require progress updates.

# VerifySignature Method ([RSA](#rsa-control) Control)

Verifies the signature for the specified data.

## Syntax

```text
rsacontrol.VerifySignature
```

## Remarks

This method will verify a hash signature.

Before calling this method specify the input file by setting [InputFile](#inputfile-property-rsa-control) or [InputMessage](#inputmessage-property-rsa-control).

A public key and the hash signature are required to perform the signature verification. Specify the public key in SignerKey. Alternatively, a certificate may be specified by setting SignerCert. Specify the hash signature in [HashSignature](#hashsignature-property-rsa-control).

When this method is called the control will compute the hash for the specified file and populate [HashValue](#hashvalue-property-rsa-control). It will verify the signature using the specified SignerKey and [HashSignature](#hashsignature-property-rsa-control).

To verify the hash signature without first computing the hash simply specify [HashValue](#hashvalue-property-rsa-control) before calling this method.

The [Progress](#progress-event-rsa-control) event will fire with updates for the hash computation progress only. The hash signature verification process is quick and does not require progress updates.

# Error Event ([RSA](#rsa-control) Control)

Fired when information is available about errors during data delivery.

## Syntax

```text
Sub rsacontrol_Error(ErrorCode As Integer, Description As String)
```

## Remarks

The Error event is fired in case of exceptional conditions during message processing. Normally the control fails with an error.

The *ErrorCode* 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](#trappable-errors-rsa-control) section.

# Progress Event ([RSA](#rsa-control) Control)

Fired as progress is made.

## Syntax

```text
Sub rsacontrol_Progress(BytesProcessed As Long64, PercentProcessed As Integer)
```

## Remarks

This event is fired automatically as data is processed by the control.

The *PercentProcessed* parameter indicates the current status of the operation.

The *BytesProcessed* parameter holds the total number of bytes processed so far.

# Config Settings ([RSA](#rsa-control) Control)

 The control 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 control, access to these *internal properties* is provided through the [Config](#config-method-rsa-control) method.

### RSA Config Settings

**KeyFormat**: How the public and private key are formatted.This setting controls the format of [KeyPublicKey](#keypublickey-property-rsa-control) and [KeyPrivateKey](#keyprivatekey-property-rsa-control). By default these properties hold PEM formatted public and private key data. When set to 1 (XML) the keys are stored in a XML format. This only affects the values returned by the control; the actual keys remain the same regardless of this setting. Possible values are:

- 0 (PEM - PKCS#1)
- 1 (XML)
- 2 (PEM - PKCS#8 - default)

 The default value is 2 (PEM - PKCS#8).

**KeySize**: The size, in bits, of the secret key.This specifies the size, in bits, of the secret key. The minimum key size for RSA is 384. The maximum key size is 4096. Note that large values such as 4096 will impact performance. The default value is 1024.

**OAEPMGF1HashAlgorithm**: The MGF1 hash algorithm used with OAEP.This configuration setting specifies the MGF1 hash algorithm used when [UseOAEP](#useoaep-property-rsa-control) is set to True. The default value is *SHA256*. Possible values are as follows:

- "SHA1"
- "SHA224"
- "SHA256" (default)
- "SHA384"
- "SHA512"
- "RIPEMD160"
- "MD2"
- "MD5"
- "MD5SHA1"

Note: The RSA hash algorithm used for OAEP is controlled via the [HashAlgorithm](#hashalgorithm-property-rsa-control) property.

**OAEPParams**: The hex encoded OAEP parameters.This configuration setting optionally specifies Optimal Asymmetric Encryption Padding (OAEP) parameters to be used when [UseOAEP](#useoaep-property-rsa-control) is set to True. The value is an optional application-defined label and should be hex encoded. In most cases this does not need to be set; both sides must use the same value for encryption and decryption to succeed.

**UsePrimitive**: Enables primitive RSA encryption with no padding scheme or output modification.Instructs the component to use primitive RSA encryption with no padding scheme and without stripping leading zeros from the output of [Encrypt](#encrypt-method-rsa-control). The output size will match the modulus length, as defined by the original RSA specification.

 Overrides the [UseOAEP](#useoaep-property-rsa-control) property if specified.

 **Warning:** This configuration is not considered cryptographically secure on its own. Padding schemes play a critical role in the security of modern RSA implementations. Use only when necessary for compatibility, and note that the user assumes all responsibility when enabling this option.

### Base Config Settings

**CodePage**: The system code page used for Unicode to Multibyte translations.The default code page is Unicode UTF-8 (65001).

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 |

 The following is a list of valid code page identifiers for Mac OS only:

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

**MaskSensitiveData**: Whether sensitive data is masked in log messages.In certain circumstances it may be beneficial to mask sensitive data, like passwords, in log messages. Set this to *True* to mask sensitive data. The default is *True*.

**UseInternalSecurityAPI**: Whether or not to use the system security libraries or an internal implementation. When set to *False*, the control will use the system security libraries by default to perform cryptographic functions where applicable.

Setting this configuration setting to *True* tells the control to use the internal implementation instead of using the system security libraries.

 This setting is set to *False* by default on all platforms.

# Trappable Errors ([RSA](#rsa-control) Control)

### RSA Errors

|  |  |
| --- | --- |
| 20103 | No Key specified. |
| 20105 | Cannot read or write file. |
| 20106 | key parameters incorrect. |
| 20107 | Cannot create hash. |
| 20112 | OutputFile already exists and Overwrite is False. |
| 20114 | Input data or HashValue must be specified. |
| 20122 | Invalid certificate. |
| 20125 | HashSignature must be specified. |
| 20305 | Cannot write file. |
| 20306 | Cannot read file. |
| 20307 | Cannot create file. |
| 21102 | Missing RSA parameter: Modulus |
| 21103 | Invalid RSA parameter: Modulus cannot be zero. |
| 21104 | Missing RSA parameters: Public or Private exponent must be present. |
| 21105 | Invalid RSA parameter: Exponent cannot be zero. |
| 21106 | Invalid RSA parameter: D cannot be zero. |
| 21107 | Invalid hash algorithm. |
| 21108 | Missing hash value. |
| 21109 | HashSignature must be specified. |
| 21110 | Invalid hash size. |
| 21111 | Public key must be specified. |
| 21112 | Key must be specified. |
| 21113 | RSA key too short to sign message. |
| 21114 | Missing the data to encrypt/decrypt. |
| 21115 | Invalid cipher length. The data may not have been encrypted with the public key corresponding to the specified private key data. |
| 21116 | Invalid cipher text. The data may not have been encrypted with the public key corresponding to the specified private key data. |
| 21117 | Inadequate padding. The data may not have been encrypted with the public key corresponding to the specified private key data. |
| 21118 | Missing delimiter. The data may not have been encrypted with the public key corresponding to the specified private key data. |
| 21119 | Message too long. |
