public abstract class AsymmetricKeyExchangeFormatter {
// Public Constructors
public AsymmetricKeyExchangeFormatter( );
// Public Instance Properties
public abstract string Parameters{get; }
// Public Instance Methods
public abstract byte[ ] CreateKeyExchange(byte[ ] data);
public abstract byte[ ] CreateKeyExchange(byte[ ] data, Type symAlgType);
public abstract void SetKey(AsymmetricAlgorithm key);
}
Key exchange formatting allows a sender to encrypt a symmetric secret
key value with an asymmetric algorithm and send the result to a
recipient, who uses an asymmetric private key to decrypt the data.
This process allows for the secure distribution of session keys,
which are used with a symmetric algorithm to encrypt a single
message. The secret key value is formatted prior to encryption to
protect against cryptographic attack.
The abstract AsymmetricKeyExchangeFormatter class
is the parent for all key exchange formatter implementations. The
CreateKeyExchange( ) method uses an asymmetric
public key to encrypt a symmetric secret key, expressed as a
System.Byte array. The SetKey(
) method specifies the
AsymmetricAlgorithm instance that contains the
public key. The Parameters property returns an XML
string that describes the key exchange algorithm represented by the
implementation class.
The .NET Framework class library includes the
RSAOAEPKeyExchangeFormatter and
RSAPKCS1KeyExchangeFormatter classes, which format
a secret key value using either the OAEP or PKCS #1 formatting
schemes, prior to encryption with the RSA algorithm. The OAEP scheme
has superseded PKCS #1, which should be used only for compatibility
with legacy systems.