summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorFilippo Biondi <filomail@gmail.com>2018-10-05 10:34:10 +0100
committerFilippo Biondi <filomail@gmail.com>2018-10-05 10:34:10 +0100
commite4833c90824d0d0efe98c7f233bf9aab25810b5d (patch)
tree3a005b9417d22fae4e2ca697954dc5a80e6b3ac0 /crypto/src
parentRFC 8032: Avoid unnecessary doublings in precomputation (diff)
downloadBouncyCastle.NET-ed25519-e4833c90824d0d0efe98c7f233bf9aab25810b5d.tar.xz
Add a new constructor which accepts RsaPrivateKeyStructure
This commit adds a new constructor which allows to create an instance of
RsaPrivateCrtKeyParameters directly from a RsaPrivateKeyStructure,
rather then building it manually.
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/crypto/parameters/RsaPrivateCrtKeyParameters.cs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crypto/src/crypto/parameters/RsaPrivateCrtKeyParameters.cs b/crypto/src/crypto/parameters/RsaPrivateCrtKeyParameters.cs

index 7bd8abd76..e5ed0a8b6 100644 --- a/crypto/src/crypto/parameters/RsaPrivateCrtKeyParameters.cs +++ b/crypto/src/crypto/parameters/RsaPrivateCrtKeyParameters.cs
@@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Asn1.Pkcs; namespace Org.BouncyCastle.Crypto.Parameters { @@ -36,7 +37,20 @@ namespace Org.BouncyCastle.Crypto.Parameters this.qInv = qInv; } - public BigInteger PublicExponent + public RsaPrivateCrtKeyParameters(RsaPrivateKeyStructure rsaPrivateKey) + : this( + rsaPrivateKey.Modulus, + rsaPrivateKey.PublicExponent, + rsaPrivateKey.PrivateExponent, + rsaPrivateKey.Prime1, + rsaPrivateKey.Prime2, + rsaPrivateKey.Exponent1, + rsaPrivateKey.Exponent2, + rsaPrivateKey.Coefficient + ) + { } + + public BigInteger PublicExponent { get { return e; } }