RSAOAEPKeyExchangeFormatter.SetKey(AsymmetricAlgorithm) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the public key to use for encrypting the key exchange data.
public:
override void SetKey(System::Security::Cryptography::AsymmetricAlgorithm ^ key);
public override void SetKey (System.Security.Cryptography.AsymmetricAlgorithm key);
override this.SetKey : System.Security.Cryptography.AsymmetricAlgorithm -> unit
Public Overrides Sub SetKey (key As AsymmetricAlgorithm)
Parameters
The instance of the RSA algorithm that holds the public key.
Exceptions
key
is null
.
Examples
The following code example demonstrates how to use the SetKey method to set an RSA key for decryption. This code example is part of a larger example provided for the RSAOAEPKeyExchangeFormatter class.
RSA^ key = RSA::Create();
rsaFormatter->SetKey( key );
RSA key = RSA.Create();
rsaFormatter.SetKey(key);
Dim key As RSA = RSA.Create()
rsaFormatter.SetKey(key)
Remarks
You must set the key before calling CreateKeyExchange.