// LAMESPEC: There seems no way to select a hash algorithm. The default
// algorithm, is SHA1 because the class use the PKCS1MaskGenerationMethod -
// which default to SHA1.
-#if NET_2_0
[ComVisible (true)]
-#endif
public class RSAPKCS1KeyExchangeFormatter: AsymmetricKeyExchangeFormatter
{
private RSA rsa;
public RSAPKCS1KeyExchangeFormatter (AsymmetricAlgorithm key)
{
- SetKey (key);
+ SetRSAKey (key);
}
public RandomNumberGenerator Rng {
{
if (rgbData == null)
throw new ArgumentNullException ("rgbData");
-#if NET_2_0
if (rsa == null) {
string msg = Locale.GetText ("No RSA key specified");
throw new CryptographicUnexpectedOperationException (msg);
}
-#endif
if (random == null)
random = RandomNumberGenerator.Create (); // create default
return PKCS1.Encrypt_v15 (rsa, random, rgbData);
// documentation says that symAlgType is not used !?!
return CreateKeyExchange (rgbData);
}
-
- public override void SetKey (AsymmetricAlgorithm key)
+
+ private void SetRSAKey (AsymmetricAlgorithm key)
{
+ if (key == null)
+ throw new ArgumentNullException ("key");
rsa = (RSA) key;
}
+
+ public override void SetKey (AsymmetricAlgorithm key)
+ {
+ SetRSAKey (key);
+ }
}
}