diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-04 12:04:57 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-04 12:04:57 +0700 |
commit | 6ec14b34bcc90f0dba33c5bf5197c67efd4edee4 (patch) | |
tree | 8a7278760362fb5ddd6f3ebd18f679b9651f9852 /crypto | |
parent | Refactoring (diff) | |
download | BouncyCastle.NET-ed25519-6ec14b34bcc90f0dba33c5bf5197c67efd4edee4.tar.xz |
Support GOST agreement OIDs
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/src/security/PrivateKeyFactory.cs | 10 | ||||
-rw-r--r-- | crypto/src/security/PublicKeyFactory.cs | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/crypto/src/security/PrivateKeyFactory.cs b/crypto/src/security/PrivateKeyFactory.cs index 3c57297fe..d9d855c45 100644 --- a/crypto/src/security/PrivateKeyFactory.cs +++ b/crypto/src/security/PrivateKeyFactory.cs @@ -186,16 +186,18 @@ namespace Org.BouncyCastle.Security { return new Ed448PrivateKeyParameters(GetRawKey(keyInfo)); } - else if (algOid.Equals(RosstandartObjectIdentifiers.id_tc26_gost_3410_12_512) - || algOid.Equals(RosstandartObjectIdentifiers.id_tc26_gost_3410_12_256)) + else if (algOid.Equals(RosstandartObjectIdentifiers.id_tc26_gost_3410_12_256) + || algOid.Equals(RosstandartObjectIdentifiers.id_tc26_gost_3410_12_512) + || algOid.Equals(RosstandartObjectIdentifiers.id_tc26_agreement_gost_3410_12_256) + || algOid.Equals(RosstandartObjectIdentifiers.id_tc26_agreement_gost_3410_12_512)) { - Gost3410PublicKeyAlgParameters gostParams = Gost3410PublicKeyAlgParameters.GetInstance(keyInfo.PrivateKeyAlgorithm.Parameters); + Gost3410PublicKeyAlgParameters gostParams = Gost3410PublicKeyAlgParameters.GetInstance( + keyInfo.PrivateKeyAlgorithm.Parameters); ECGost3410Parameters ecSpec; BigInteger d; Asn1Object p = keyInfo.PrivateKeyAlgorithm.Parameters.ToAsn1Object(); if (p is Asn1Sequence && (Asn1Sequence.GetInstance(p).Count == 2 || Asn1Sequence.GetInstance(p).Count == 3)) { - X9ECParameters ecP = ECGost3410NamedCurves.GetByOid(gostParams.PublicKeyParamSet); ecSpec = new ECGost3410Parameters( diff --git a/crypto/src/security/PublicKeyFactory.cs b/crypto/src/security/PublicKeyFactory.cs index 49ad49dd0..e0c7ce950 100644 --- a/crypto/src/security/PublicKeyFactory.cs +++ b/crypto/src/security/PublicKeyFactory.cs @@ -228,7 +228,9 @@ namespace Org.BouncyCastle.Security return new Ed448PublicKeyParameters(GetRawKey(keyInfo)); } else if (algOid.Equals(RosstandartObjectIdentifiers.id_tc26_gost_3410_12_256) - || algOid.Equals(RosstandartObjectIdentifiers.id_tc26_gost_3410_12_512)) + || algOid.Equals(RosstandartObjectIdentifiers.id_tc26_gost_3410_12_512) + || algOid.Equals(RosstandartObjectIdentifiers.id_tc26_agreement_gost_3410_12_256) + || algOid.Equals(RosstandartObjectIdentifiers.id_tc26_agreement_gost_3410_12_512)) { Gost3410PublicKeyAlgParameters gostParams = Gost3410PublicKeyAlgParameters.GetInstance(algID.Parameters); DerObjectIdentifier publicKeyParamSet = gostParams.PublicKeyParamSet; |