mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.5000.0 2.0.0.0 4.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Security.Cryptography.RSA System.Security.Cryptography.ICspAsymmetricAlgorithm System.Runtime.InteropServices.ComVisible(true)

This is the default implementation of .

The supports key sizes from 384 bits to 16384 bits in increments of 8 bits if you have the Microsoft Enhanced Cryptographic Provider installed. It supports key sizes from 384 bits to 512 bits in increments of 8 bits if you have the Microsoft Base Cryptographic Provider installed.

Valid key sizes are dependent on the cryptographic service provider (CSP) that is used by the instance. Windows CSPs enable keys sizes of 384 to 16384 bits for Windows versions prior to win81, and key sizes of 512 to 16384 bits for win81. For more information, see CryptGenKey function in the Windows documentation.

## Interoperation with the Microsoft Cryptographic API (CAPI)

Unlike the RSA implementation in unmanaged CAPI, the class reverses the order of an encrypted array of bytes after encryption and before decryption. By default, data encrypted by the class cannot be decrypted by the CAPI CryptDecrypt function and data encrypted by the CAPI CryptEncrypt method cannot be decrypted by the class.

If you do not compensate for the reverse ordering when interoperating between APIs, the class throws a .

To interoperate with CAPI, you must manually reverse the order of encrypted bytes before the encrypted data interoperates with another API. You can easily reverse the order of a managed byte array by calling the method.

Performs asymmetric encryption and decryption using the implementation of the algorithm provided by the cryptographic service provider (CSP). This class cannot be inherited.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  If no default key is found, a new key is created.

  This constructor creates an key pair suitable to encrypt session keys so that they can be safely stored and exchanged with other users. The generated key corresponds to a key generated using the value used in the unmanaged Microsoft Cryptographic API (CAPI).

  Initializes a new instance of the class using the default key.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  If no default key is found, a new key is created.

  This constructor creates an key pair suitable to encrypt session keys so that they can be safely stored and exchanged with other users. The generated key corresponds to a key generated using the value used in the unmanaged Microsoft Cryptographic API (CAPI).

  Initializes a new instance of the class with the specified key size.

  The size of the key to use in bits.
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  This constructor creates or reuses a key container specified using the field of the parameter.

  By default, this constructor creates an key pair suitable to encrypt session keys so that they can be safely stored and exchanged with other users. The generated key corresponds to a key generated using the value used in the unmanaged Microsoft Cryptographic API (CAPI).

  You can create a key pair suitable for authenticating (digitally signed) messages or files by setting the field of the parameter to the value. This type of key corresponds to the value used in CAPI.

  If you create an object with the value specified and then create another object with the value specified, both keys will be placed in a single container if both objects specify the same key container name.

  To create a key that is compatible with stong-name signing using the class, you must create a key pair.

  Initializes a new instance of the class with the specified parameters.

  The parameters to be passed to the cryptographic service provider (CSP).
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  This constructor creates or reuses a key container specified using the field of the parameter.

  By default, this constructor creates an key pair suitable to encrypt session keys so that they can be safely stored and exchanged with other users. The generated key corresponds to a key generated using the value used in the unmanaged Microsoft Cryptographic API (CAPI).

  You can create a key pair suitable for authenticating (digitally signed) messages or files by setting the field of the parameter to the value. This type of key corresponds to the value used in CAPI.

  If you create an object with the value specified and then create another object with the value specified, both keys will be placed in a single container if both objects specify the same key container name.

  To create a key that is compatible with stong-name signing using the class, you must create a key pair.

  Initializes a new instance of the class with the specified key size and parameters.

  The size of the key to use in bits.
  The parameters to be passed to the cryptographic service provider (CSP).
- Property
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Security.Cryptography.CspKeyContainerInfo To be added.

  Use the property to retrieve additional information about a cryptographic key pair. The returned object describes whether the key is exportable, and specifies the key container name, information about the provider, and other information.

  In cases where a random key is generated, a key container will not be created until you call a method that uses the key. Some properties of the object returned by the property will throw a if a key container has not been created. To make sure that a key container has been created, call a method such as , , , , and so on, before you call the property.

  Gets a object that describes additional information about a cryptographic key pair.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Byte[] `` ``

  Use to encrypt data for decryption with this method.

  Decrypts data with the algorithm.

  The decrypted data, which is the original plain text before encryption.

  The data to be decrypted. true to perform direct decryption using OAEP padding (only available on a computer running Microsoft Windows XP or later); otherwise, false to use PKCS#1 v1.5 padding.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Byte[] ``

  Note: This method is implemented in Mono but isn't supported in the Microsoft .NET framework. There are good reason for this:

  Mono requires the method to implement the RSA Formatter and Deformatter classes.
  Microsoft's CryptoAPI doesn't support direct RSA encryption/decryption.
  You shouldn't be using them anyway!!! as this isn't the way to encrypt using RSA. You need to apply padding before encrypting (and remove it when decrypting). Not doing so is both dangerous (non secure) and very slow.

  This method is not supported in the current version.

  The decrypted data, which is the original plain text before encryption.

  The data to be decrypted.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void ``

  This method is called by the public Dispose() method and the Finalize method. Dispose() invokes the protected Dispose(Boolean) method with the disposing parameter set to true. Finalize invokes Dispose with disposing set to false.

  When the parameter is true, this method releases all resources held by any managed objects that this references. This method invokes the Dispose() method of each referenced object.

  Releases the unmanaged resources used by the and optionally releases the managed resources.

  true to release both managed and unmanaged resources; false to release only unmanaged resources.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Byte[] `` ``

  The following table describes the padding supported by different versions of Microsoft Windows and the maximum length of allowed by the different combinations of operating systems and padding.

  Padding

  Operating System Supported

  Maximum Length of rgb Parameter

  OAEP padding (PKCS#1 v2)

  Microsoft Windows XP or later.

  Modulus size -2 -2*hLen, where hLen is the size of the hash.

  Direct Encryption (PKCS#1 v1.5)

  Microsoft Windows 2000 or later with the high encryption pack installed.

  Modulus size - 11. (11 bytes is the minimum padding possible.)

  Direct Encryption and OAEP padding not supported

  Microsoft Windows 98, Microsoft Windows Millennium, or Windows 2000 or later without the high encryption pack installed.

  The maximum size allowed for a symmetric key.

  Use to decrypt the results of this method.

  Encrypts data with the algorithm.

  The encrypted data.

  The data to be encrypted. true to perform direct encryption using OAEP padding (only available on a computer running Microsoft Windows XP or later); otherwise, false to use PKCS#1 v1.5 padding.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Byte[] ``

  Note: This method is implemented in Mono but isn't supported in the Microsoft .NET framework. There are good reason for this:

  Mono requires the method to implement the RSA Formatter and Deformatter classes.
  Microsoft's CryptoAPI doesn't support direct RSA encryption/decryption.
  You shouldn't be using them anyway!!! as this isn't the way to encrypt using RSA. You need to apply padding before encrypting (and remove it when decrypting). Not doing so is both dangerous (non secure) and very slow.

  This method is not supported in the current version.

  The encrypted data.

  The data to be encrypted.
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Byte[] ``

  The method returns a blob containing key information that is compatible with the unmanaged Microsoft Cryptographic API (CAPI).

  Exports a blob containing the key information associated with an object.

  A byte array containing the key information associated with an object.

  true to include the private key; otherwise, false.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Security.Cryptography.RSAParameters `` You are responsable to zeroize the private key ( parameters , , , , and ) if you export it from the instance.

  Exports the .

  The parameters for .

  true to include private parameters; otherwise, false.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void ``

  The method initializes the key data of an object using a blob that is compatible with the unmanaged Microsoft Cryptographic API (CAPI).

  Imports a blob that represents RSA key information.

  A byte array that represents an RSA key blob.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` Parameters D, P and Q are required to import an RSA private key. Parameters DP, DQ and InverseQ will be used for the Chinese Remainder Theorem (CRT) optimization if available.

  Imports the specified .

  The parameters for .
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String RSA-PKCS1-KeyEx

  This property indicates the name of the algorithm, not of the type. For example, RSA-PKCS1-KeyEx is a key exchange algorithm name.

  Gets the name of the key exchange algorithm available with this implementation of .

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 The size (in bits) of the current key.

  The supports key sizes from 384 bits to 16384 bits in increments of 8 bits if you have the Microsoft Enhanced Cryptographic Provider installed. It supports key sizes from 384 bits to 512 bits in increments of 8 bits if you have the Microsoft Base Cryptographic Provider installed.

  Valid key sizes are dependent on the cryptographic service provider (CSP) that is used by the instance. Windows CSPs enable key sizes of 384 to 16384 bits for Windows versions prior to win81, and key sizes of 512 to 16384 bits for win81. For more information, see CryptGenKey function in the Windows documentation.

  The class does not allow you to change key sizes using the property. Any value written to this property will fail to update the property without error. To change the key size, use one of the constructor overloads.

  Gets the size of the current key.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean True if the key is persisted, false otherwise.

  Use this property to persist a key in a key container.

  The property is automatically set to true when you specify a key container name in a object and use it to initialize an object. You can specify a container name using the field.

  If you set the property to true without initializing the object with a object, a random key container name prepended with "CLR" is created.

  Gets or sets a value indicating whether the key should be persisted in the cryptographic service provider (CSP).

- Property
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Boolean To be added.

  The class can be initialized either with a public key only or with both a public and private key. Use the property to determine whether the current instance contains only a public key or both a public and private key.

  Gets a value that indicates whether the object contains only a public key.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String http://www.w3.org/2000/09/xmldsig#rsa-sha1

  This property is used in XML digital signature classes to indicate the algorithm URI. In this implementation, this property always returns http://www.w3.org/2000/09/xmldsig#rsa-sha1.

  Gets the name of the signature algorithm available with this implementation of .

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Byte[] `` ``

  This method creates a digital signature that is verified using the method.

  The parameter can accept a , a , or a .

  Computes the hash value of the specified byte array using the specified hash algorithm, and signs the resulting hash value.

  The signature for the specified data.

  The input data for which to compute the hash. The hash algorithm to use to create the hash value.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Byte[] `` ``

  The parameter can accept a , a , or a .

  Computes the hash value of the specified input stream using the specified hash algorithm, and signs the resulting hash value.

  The signature for the specified data.

  The input data for which to compute the hash. The hash algorithm to use to create the hash value.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Byte[] `` `` `` ``

  This method creates a digital signature that is verified using the method.

  The parameter can accept a , a , or a . The string value can be one of the following:

  The object identifier (OID) friendly name of the hash algorithm to use, either a name registered in the crypto config file or one in the Crypto API OID table.

  The OID value. The OID must be one recognized by the Crypto API.

  For example, you could use SignData(new byte[5], "1.3.14.3.2.26") or SignData(new byte[5], "sha1"), or SignData(new byte[5], "SHA1").

  Computes the hash value of a subset of the specified byte array using the specified hash algorithm, and signs the resulting hash value.

  The signature for the specified data.

  The input data for which to compute the hash. The offset into the array from which to begin using data. The number of bytes in the array to use as data. The hash algorithm to use to create the hash value.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Byte[] `` ``

  This method creates a digital signature that is verified using the method.

  The valid hash algorithms are and . The algorithm identifier can be derived from the hash name by using the method.

  Computes the signature for the specified hash value by encrypting it with the private key.

  The signature for the specified hash value.

  The hash value of the data to be signed. The hash algorithm identifier (OID) used to create the hash value of the data.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean True if the machine key store is used by default, false otherwise.

  Setting this property to true is equivalent to passing the flag to a object. The property applies to all code in the current application domain, whereas the object applies only to classes that explicitly reference it. These settings are useful when impersonating or running under an account whose user profile is not loaded. Setting affects the key store location only if is initialized with no parameters.

  Gets or sets a value indicating whether the key should be persisted in the computer's key store instead of the user profile store.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean `` `` ``

  This method verifies the digital signature produced by the method. The signature is verified by obtaining the hash value from the signature using the public key it was signed with, and comparing that value to the hash value of the provided data.

  The parameter can accept a , a , or a .

  Verifies that a digital signature is valid by determining the hash value in the signature using the provided public key and comparing it to the hash value of the provided data.

  true if the signature is valid; otherwise, false.

  The data that was signed. The name of the hash algorithm used to create the hash value of the data. The signature data to be verified.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean `` `` ``

  This method verifies the digital signature produced by the method. The signature is verified by obtaining the hash value from the signature using the public key it was signed with, and comparing that value to the hash value of the provided data.

  The valid hash algorithms are and . The algorithm identifier can be derived from the hash name by using the method.

  Verifies that a digital signature is valid by determining the hash value in the signature using the provided public key and comparing it to the provided hash value.

  true if the signature is valid; otherwise, false.

  The hash value of the signed data. The hash algorithm identifier (OID) used to create the hash value of the data. The signature data to be verified.