1 files changed, 20 insertions, 4 deletions
diff --git a/crypto/src/crypto/engines/RSABlindedEngine.cs b/crypto/src/crypto/engines/RSABlindedEngine.cs
index 7b928c5fb..98108f9b4 100644
--- a/crypto/src/crypto/engines/RSABlindedEngine.cs
+++ b/crypto/src/crypto/engines/RSABlindedEngine.cs
@@ -49,13 +49,29 @@ namespace Org.BouncyCastle.Crypto.Engines
{
ParametersWithRandom rParam = (ParametersWithRandom)param;
- key = (RsaKeyParameters)rParam.Parameters;
- random = rParam.Random;
+ this.key = (RsaKeyParameters)rParam.Parameters;
+
+ if (key is RsaPrivateCrtKeyParameters)
+ {
+ this.random = rParam.Random;
+ }
+ else
+ {
+ this.random = null;
+ }
}
else
{
- key = (RsaKeyParameters)param;
- random = new SecureRandom();
+ this.key = (RsaKeyParameters)param;
+
+ if (key is RsaPrivateCrtKeyParameters)
+ {
+ this.random = new SecureRandom();
+ }
+ else
+ {
+ this.random = null;
+ }
}
}
|