System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter.SetKey C# (CSharp) Method

SetKey() public method

public SetKey ( AsymmetricAlgorithm key ) : void
key AsymmetricAlgorithm
return void
        public override void SetKey(AsymmetricAlgorithm key)
        {
            if (key == null)
                throw new ArgumentNullException(nameof(key));

            _rsaKey = (RSA)key;
        }

Usage Example

	public void Properties () 
	{
		RSAPKCS1KeyExchangeFormatter keyex = new RSAPKCS1KeyExchangeFormatter ();
		keyex.SetKey (key);
		AssertEquals("RSAPKCS1KeyExchangeFormatter.Parameters", "<enc:KeyEncryptionMethod enc:Algorithm=\"http://www.microsoft.com/xml/security/algorithm/PKCS1-v1.5-KeyEx\" xmlns:enc=\"http://www.microsoft.com/xml/security/encryption/v1.0\" />", keyex.Parameters);
		// null (default)
		AssertNull("RSAPKCS1KeyExchangeFormatter.Rng", keyex.Rng);
		AssertEquals("RSAPKCS1KeyExchangeFormatter.ToString()", "System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter", keyex.ToString ());
	}
All Usage Examples Of System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter::SetKey