Mono.Security.Cryptography.CryptoConvert Class
Cryptographic convertion helper.

See Also: CryptoConvert Members

Syntax

public sealed class CryptoConvert

Remarks

Converting private keys into byte arrays may cause security risks. You should always zeroize buffers with sensitive informations after their use.

C# Example

	// create a 1024 bits key pair
	RSA rsa = RSA.Create ();
	// convert the key pair into a CryptoAPI PRIVATEKEYBLOB
	byte[] keypair = CryptoConvert.ToCapiKeyBlob (rsa, true);
	// save the key pair to a file
	using (FileStream fs = File.OpenWrite ("my.key")) {
		fs.Write (keypair, 0, keypair.Length);
	}
	// zeroize the key pair from memory
	Array.Clear (keypair, 0, keypair.Length);
	// note: the private key still exists in the RSA instance!
  

Requirements

Namespace: Mono.Security.Cryptography
Assembly: Mono.Security (in Mono.Security.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0