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 Managed implementation of the RSA asymmetric algorithm.

In Mono this class is completely implemented in managed code.

A major design difference between Mono and Microsoft implementation is the key generation. Microsoft always generate a new key pair in the constructor (unless a object is used with an non-empty container). This can degrade performance (e.g. server) when key pair are imported (e.g. XML) after the object is created. Mono implementation doesn't generate a new key pair until it is required (e.g. exporting, signing, encrypting ...). This shouldn't affect functionality but you may experience slowdown (during key pair generation) at a different time than MS implementation.

- Constructor
  Create a new RSACryptoServiceProvider instance with the specified key pair length.
  Default key size is 1024 bits.
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  Length of the public key modulus. This can be between 384 and 16384 bits in multiple of 8 bits increments.
  Create a new DSACryptoServiceProvider instance with the specified key pair length.
  To be added
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  To be added: an object of type 'CspParameters'
  Create a new RSACryptoServiceProvider instance with the default key pair length. The generated key pair will be persisted in the key store specified by the CspParameters.
  Default key size is 1024 bits.
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  Length of the public key modulus. This can be between 384 and 16384 bits in multiple of 8 bits increments.
  To be added: an object of type 'CspParameters'
  Create a new RSACryptoServiceProvider instance with the specified key pair length. The generated key pair will be persisted in the key store specified by the CspParameters.
  To be added
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Property
  System.Runtime.InteropServices.ComVisible(false)
  System.Security.Cryptography.CspKeyContainerInfo To be added. To be added. To be added. 2.0.0.0 4.0.0.0
- Method
  System.Byte[] `` `` The encrypted data. True to use the OAEP padding, false to use PKCS#1 padding. Decrypt the provided data using the private key and the specified padding mechanism. An array of bytes containing the decrypted data.

  RSA isn't normally used to do bulk encryption. The two main reasons are length restriction (public key size and padding limit the maximum length of data that can be encrypted in a single operation) and performance (as RSA is very slow compared to most symmetric ciphers).

  The following example shows how to combine the use of RSA and a symmetric cipher, Rjindael, to "quickly" decrypt data of an unlimited length (provided is was encrypted with the reversed algorithm).

  `static byte[] Decrypt (RSA rsa, byte[] input) { // by default this will create a 128 bits AES (Rijndael) object SymmetricAlgorithm sa = SymmetricAlgorithm.Create (); byte[] keyex = new byte [rsa.KeySize >> 3]; Buffer.BlockCopy (input, 0, keyex, 0, keyex.Length); RSAPKCS1KeyExchangeDeformatter def = new RSAPKCS1KeyExchangeDeformatter (rsa); byte[] key = def.DecryptKeyExchange (keyex); byte[] iv = new byte [sa.IV.Length]; Buffer.BlockCopy (input, keyex.Length, iv, 0, iv.Length); ICryptoTransform ct = sa.CreateDecryptor (key, iv); byte[] decrypt = ct.TransformFinalBlock (input, keyex.Length + iv.Length, input.Length - (keyex.Length + iv.Length)); return decrypt; }`

  Interoperability warning: Microsoft CryptoAPI only supports OAEP since Windows XP.

  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Byte[] `` The encrypted data. Raw (unpadded) decryption using the RSA private key. An array of bytes containing the decrypted data.

  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.
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Void `` To be added: an object of type 'bool' To be added The private key is zeroized during Dispose. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Byte[] `` `` The data to be encrypted. True to use the OAEP padding, false to use PKCS#1 padding. Encrypt the provided data using the public key and the specified padding mechanism. An array of bytes containing the encrypted data.

  RSA isn't normally used to do bulk encryption. The two main reasons are length restriction (public key size and padding limit the maximum length of data that can be encrypted in a single operation) and performance (as RSA is very slow compared to most symmetric ciphers).

  The following example shows how to combine the use of RSA and a symmetric cipher, Rjindael, to "quickly" encrypt data of an unlimited length.

  `static byte[] Encrypt (RSA rsa, byte[] input) { // by default this will create a 128 bits AES (Rijndael) object SymmetricAlgorithm sa = SymmetricAlgorithm.Create (); ICryptoTransform ct = sa.CreateEncryptor (); byte[] encrypt = ct.TransformFinalBlock (input, 0, input.Length); RSAPKCS1KeyExchangeFormatter fmt = new RSAPKCS1KeyExchangeFormatter (rsa); byte[] keyex = fmt.CreateKeyExchange (sa.Key); // return the key exchange, the IV (public) and encrypted data byte[] result = new byte [keyex.Length + sa.IV.Length + encrypt.Length]; Buffer.BlockCopy (keyex, 0, result, 0, keyex.Length); Buffer.BlockCopy (sa.IV, 0, result, keyex.Length, sa.IV.Length); Buffer.BlockCopy (encrypt, 0, result, keyex.Length + sa.IV.Length, encrypt.Length); return result; }`

  Interoperability warning: Microsoft CryptoAPI only supports OAEP since Windows XP.

  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Byte[] `` The data to be encrypted. Raw (unpadded) encryption using the RSA public key. An array of bytes containing the encrypted data.

  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.
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Byte[] `` To be added. To be added. To be added. To be added. 2.0.0.0 4.0.0.0 System.Runtime.InteropServices.ComVisible(false)
- Method
  System.Security.Cryptography.RSAParameters `` True to include private parameters; otherwise, false. Export the instance key into a structure. a RSAParameters structure contaning each parameters of the key. You are responsable to zeroize the private key ( parameters , , , , and ) if you export it from the instance. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` To be added. To be added. To be added. 2.0.0.0 4.0.0.0 System.Runtime.InteropServices.ComVisible(false)
- Method
  System.Void `` A RSAParameters containing the RSA key parameters. Import the key from the structure into the current instance. 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. 1.0.5000.0 2.0.0.0 4.0.0.0
- Property
  System.String Return the common, but unique, name when using this algorithm for key exchange. RSA-PKCS1-KeyEx To be added 1.0.5000.0 2.0.0.0 4.0.0.0
- Property
  System.Int32 Return the key length (in bits) of the current key. The size (in bits) of the current key. To be added 1.0.5000.0 2.0.0.0 4.0.0.0
- Property
  System.Boolean Specify if the current key pair is persisted into a Cryptographic Service Provider (CSP) True if the key is persisted, false otherwise. If specified Mono:: key pair persistance mechanism will kept the keys on disk. A must been specified in the constructor to allow key persistance. 1.0.5000.0 2.0.0.0 4.0.0.0
- Property
  System.Runtime.InteropServices.ComVisible(false)
  System.Boolean To be added. To be added. To be added. 2.0.0.0 4.0.0.0
- Property
  System.String Return the common, but unique, name when using this algorithm for signature. http://www.w3.org/2000/09/xmldsig#rsa-sha1 This value comes from the W3 "XML-Signature Syntax and Processing" specification available at http://www.w3.org/TR/xmldsig-core/ 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Byte[] `` `` The data buffer to be hashed then signed. An object representing the hash algorithm to be used. The object can either be:
  a representing the hash algorithm name. The hash object will then be created using . ().
  a instance that will be directly used.
  a representing the hash algorithm. The hash object will then be created using . ().
  Process the specified hash algorithm on the complete buffer specified then sign it's result. The signature value of the processed buffer. This method can work with ANY configured (OID in machine.config) HashAlgorithm descendant. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Byte[] `` `` The data stream to be hashed then signed. An object representing the hash algorithm to be used. The object can either be:
  a representing the hash algorithm name. The hash object will then be created using . ().
  a instance that will be directly used.
  a representing the hash algorithm. The hash object will then be created using . ().
  Process the specified hash algorithm on the stream then sign it's result. The signature value of the processed buffer. This method can work with ANY configured (OID in machine.config) HashAlgorithm descendant. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Byte[] `` `` `` `` The data buffer to be hashed then signed. To be added: an object of type 'int' To be added: an object of type 'int' An object representing the hash algorithm to be used. The object can either be:
  a representing the hash algorithm name. The hash object will then be created using . ().
  a instance that will be directly used.
  a representing the hash algorithm. The hash object will then be created using . ().
  Process the specified hash algorithm on a subset of the buffer specified then sign it's result. The signature value of the processed buffer. This method can work with ANY configured (OID in machine.config) HashAlgorithm descendant. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Byte[] `` `` The hash to be signed. OID for the hash algorithm using in the signature. Sign the specified hash value. The signature value of the processed buffer. This method is LIMITED to SHA1 and MD5 like the MS framework 1.0 and 1.1 because there's no method to get a hash algorithm from an OID. However there's no such limit when using the RSAPKCS1[De]Formatter class. 1.0.5000.0 2.0.0.0 4.0.0.0
- Property
  System.Boolean Specified if, by default, the key store for persistance should be the machine store (default is the user store). True if the machine key store is used by default, false otherwise. Keys kept in the machine store are readable by every user on the system. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Boolean `` `` `` The data buffer to be hashed then verified. An object representing the hash algorithm to be used. The object can either be:
  a representing the hash algorithm name. The hash object will then be created using . ().
  a instance that will be directly used.
  a representing the hash algorithm. The hash object will then be created using . ().
  An array of bytes containing the RSA signature of the specified hash. Process the specified hash algorithm on the complete buffer specified then verify it's signature. True if the signature can be verified, false otherwise. This method can work with ANY configured (OID in machine.config) HashAlgorithm descendant. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Boolean `` `` `` The hash to be verified. OID for the hash algorithm using in the signature. An array of bytes containing the RSA signature of the specified hash. Verify the signature using the specified hash value. True if the signature can be verified, false otherwise. This method is LIMITED to SHA1 and MD5 like the MS framework 1.0 and 1.1 because there's no method to get a hash algorithm from an OID. However there's no such limit when using the RSAPKCS1[De]Formatter class. 1.0.5000.0 2.0.0.0 4.0.0.0
System.Runtime.InteropServices.ComVisible(true)