summary refs log tree commit diff
path: root/crypto/src/security
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/security')
-rw-r--r--crypto/src/security/PrivateKeyFactory.cs42
-rw-r--r--crypto/src/security/PublicKeyFactory.cs6
2 files changed, 11 insertions, 37 deletions
diff --git a/crypto/src/security/PrivateKeyFactory.cs b/crypto/src/security/PrivateKeyFactory.cs
index 4c7a91ecf..dfc73c2cd 100644
--- a/crypto/src/security/PrivateKeyFactory.cs
+++ b/crypto/src/security/PrivateKeyFactory.cs
@@ -135,7 +135,7 @@ namespace Org.BouncyCastle.Security
                 Gost3410PublicKeyAlgParameters gostParams = Gost3410PublicKeyAlgParameters.GetInstance(
                     algID.Parameters.ToAsn1Object());
 
-                ECDomainParameters ecP = ECGost3410NamedCurves.GetByOid(gostParams.PublicKeyParamSet);
+                X9ECParameters ecP = ECGost3410NamedCurves.GetByOidX9(gostParams.PublicKeyParamSet);
 
                 if (ecP == null)
                     throw new ArgumentException("Unrecognized curve OID for GostR3410x2001 private key");
@@ -198,7 +198,7 @@ namespace Org.BouncyCastle.Security
                 if (p is Asn1Sequence && (Asn1Sequence.GetInstance(p).Count == 2 || Asn1Sequence.GetInstance(p).Count == 3))
                 {
 
-                    ECDomainParameters ecP = ECGost3410NamedCurves.GetByOid(gostParams.PublicKeyParamSet);
+                    X9ECParameters ecP = ECGost3410NamedCurves.GetByOidX9(gostParams.PublicKeyParamSet);
 
                     ecSpec = new ECGost3410Parameters(
                         new ECNamedDomainParameters(
@@ -235,29 +235,10 @@ namespace Org.BouncyCastle.Security
                     {
                         DerObjectIdentifier oid = DerObjectIdentifier.GetInstance(parameters.Parameters);
                         X9ECParameters ecP = ECNamedCurveTable.GetByOid(oid);
-                        if (ecP == null)
-                        {
-                            ECDomainParameters gParam = ECGost3410NamedCurves.GetByOid(oid);
-                            ecSpec = new ECGost3410Parameters(new ECNamedDomainParameters(
-                                    oid,
-                                    gParam.Curve,
-                                    gParam.G,
-                                    gParam.N,
-                                    gParam.H,
-                                    gParam.GetSeed()), gostParams.PublicKeyParamSet, gostParams.DigestParamSet,
-                                gostParams.EncryptionParamSet);
-                        }
-                        else
-                        {
-                            ecSpec = new ECGost3410Parameters(new ECNamedDomainParameters(
-                                    oid,
-                                    ecP.Curve,
-                                    ecP.G,
-                                    ecP.N,
-                                    ecP.H,
-                                    ecP.GetSeed()), gostParams.PublicKeyParamSet, gostParams.DigestParamSet,
-                                gostParams.EncryptionParamSet);
-                        }
+
+                        ecSpec = new ECGost3410Parameters(new ECNamedDomainParameters(oid, ecP),
+                            gostParams.PublicKeyParamSet, gostParams.DigestParamSet,
+                            gostParams.EncryptionParamSet);
                     }
                     else if (parameters.IsImplicitlyCA)
                     {
@@ -266,15 +247,8 @@ namespace Org.BouncyCastle.Security
                     else
                     {
                         X9ECParameters ecP = X9ECParameters.GetInstance(parameters.Parameters);
-                        ecSpec = new ECGost3410Parameters(new ECNamedDomainParameters(
-                                algOid,
-                                ecP.Curve,
-                                ecP.G,
-                                ecP.N,
-                                ecP.H,
-                                ecP.GetSeed()),
-                            gostParams.PublicKeyParamSet,
-                            gostParams.DigestParamSet,
+                        ecSpec = new ECGost3410Parameters(new ECNamedDomainParameters(algOid, ecP),
+                            gostParams.PublicKeyParamSet, gostParams.DigestParamSet,
                             gostParams.EncryptionParamSet);
                     }
 
diff --git a/crypto/src/security/PublicKeyFactory.cs b/crypto/src/security/PublicKeyFactory.cs
index 6813452a6..15af90f91 100644
--- a/crypto/src/security/PublicKeyFactory.cs
+++ b/crypto/src/security/PublicKeyFactory.cs
@@ -154,7 +154,7 @@ namespace Org.BouncyCastle.Security
                     return new ECPublicKeyParameters("EC", q, (DerObjectIdentifier)para.Parameters);
                 }
 
-                ECDomainParameters dParams = new ECDomainParameters(x9.Curve, x9.G, x9.N, x9.H, x9.GetSeed());
+                ECDomainParameters dParams = new ECDomainParameters(x9);
                 return new ECPublicKeyParameters(q, dParams);
             }
             else if (algOid.Equals(CryptoProObjectIdentifiers.GostR3410x2001))
@@ -162,7 +162,7 @@ namespace Org.BouncyCastle.Security
                 Gost3410PublicKeyAlgParameters gostParams = Gost3410PublicKeyAlgParameters.GetInstance(algID.Parameters);
                 DerObjectIdentifier publicKeyParamSet = gostParams.PublicKeyParamSet;
 
-                ECDomainParameters ecP = ECGost3410NamedCurves.GetByOid(publicKeyParamSet);
+                X9ECParameters ecP = ECGost3410NamedCurves.GetByOidX9(publicKeyParamSet);
                 if (ecP == null)
                     return null;
 
@@ -238,7 +238,7 @@ namespace Org.BouncyCastle.Security
                 DerObjectIdentifier publicKeyParamSet = gostParams.PublicKeyParamSet;
 
                 ECGost3410Parameters ecDomainParameters =new ECGost3410Parameters(
-                    new ECNamedDomainParameters(publicKeyParamSet, ECGost3410NamedCurves.GetByOid(publicKeyParamSet)),
+                    new ECNamedDomainParameters(publicKeyParamSet, ECGost3410NamedCurves.GetByOidX9(publicKeyParamSet)),
                     publicKeyParamSet,
                     gostParams.DigestParamSet,
                     gostParams.EncryptionParamSet);