diff options
author | David Hook <dgh@bouncycastle.org> | 2019-01-20 11:17:35 +1100 |
---|---|---|
committer | David Hook <dgh@bouncycastle.org> | 2019-01-20 11:17:35 +1100 |
commit | aa29930511ac310a724e0e1fc13fa4dea2558953 (patch) | |
tree | ac3f4f7641405a5980080edf624f49524ece3f31 | |
parent | Selecting digest. (diff) | |
download | BouncyCastle.NET-ed25519-aa29930511ac310a724e0e1fc13fa4dea2558953.tar.xz |
minor tweaking
-rw-r--r-- | crypto/src/crypto/digests/GOST3411_2012Digest.cs | 6 | ||||
-rw-r--r-- | crypto/src/crypto/digests/GOST3411_2012_256Digest.cs | 8 | ||||
-rw-r--r-- | crypto/src/crypto/digests/GOST3411_2012_512Digest.cs | 8 | ||||
-rw-r--r-- | crypto/src/crypto/parameters/ECGOST3410Parameters.cs | 6 | ||||
-rw-r--r-- | crypto/src/crypto/signers/EcGost3410_2012Signer.cs | 4 | ||||
-rw-r--r-- | crypto/src/pkcs/PrivateKeyInfoFactory.cs | 4 | ||||
-rw-r--r-- | crypto/src/security/DigestUtilities.cs | 4 | ||||
-rw-r--r-- | crypto/src/security/PrivateKeyFactory.cs | 12 | ||||
-rw-r--r-- | crypto/src/security/PublicKeyFactory.cs | 4 | ||||
-rw-r--r-- | crypto/src/x509/SubjectPublicKeyInfoFactory.cs | 4 | ||||
-rw-r--r-- | crypto/test/UnitTests.csproj | 7 | ||||
-rw-r--r-- | crypto/test/src/crypto/test/ECGOST3410_2012Test.cs | 64 | ||||
-rw-r--r-- | crypto/test/src/crypto/test/EGOST3410_2012SignatureTest.cs | 18 | ||||
-rw-r--r-- | crypto/test/src/crypto/test/GOST3411_2012_256DigestTest.cs | 6 | ||||
-rw-r--r-- | crypto/test/src/crypto/test/GOST3411_2012_512DigestTest.cs | 6 |
15 files changed, 84 insertions, 77 deletions
diff --git a/crypto/src/crypto/digests/GOST3411_2012Digest.cs b/crypto/src/crypto/digests/GOST3411_2012Digest.cs index 439512924..68cb6c035 100644 --- a/crypto/src/crypto/digests/GOST3411_2012Digest.cs +++ b/crypto/src/crypto/digests/GOST3411_2012Digest.cs @@ -4,7 +4,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Digests { - public abstract class GOST3411_2012Digest:IDigest,IMemoable + public abstract class Gost3411_2012Digest:IDigest,IMemoable { private readonly byte[] IV = new byte[64]; private readonly byte[] N = new byte[64]; @@ -19,7 +19,7 @@ namespace Org.BouncyCastle.Crypto.Digests private int bOff = 64; - protected GOST3411_2012Digest(byte[] IV) + protected Gost3411_2012Digest(byte[] IV) { System.Array.Copy(IV,this.IV,64); System.Array.Copy(IV, h, 64); @@ -79,7 +79,7 @@ namespace Org.BouncyCastle.Crypto.Digests public void Reset(IMemoable other) { - GOST3411_2012Digest o = (GOST3411_2012Digest)other; + Gost3411_2012Digest o = (Gost3411_2012Digest)other; System.Array.Copy(o.IV, 0, this.IV, 0, 64); System.Array.Copy(o.N, 0, this.N, 0, 64); diff --git a/crypto/src/crypto/digests/GOST3411_2012_256Digest.cs b/crypto/src/crypto/digests/GOST3411_2012_256Digest.cs index 8686851e2..77cf6c50f 100644 --- a/crypto/src/crypto/digests/GOST3411_2012_256Digest.cs +++ b/crypto/src/crypto/digests/GOST3411_2012_256Digest.cs @@ -3,7 +3,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Digests { - public class GOST3411_2012_256Digest : GOST3411_2012Digest + public class Gost3411_2012_256Digest : Gost3411_2012Digest { private readonly static byte[] IV = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, @@ -21,12 +21,12 @@ namespace Org.BouncyCastle.Crypto.Digests get { return "GOST3411-2012-256"; } } - public GOST3411_2012_256Digest() : base(IV) + public Gost3411_2012_256Digest() : base(IV) { } - public GOST3411_2012_256Digest(GOST3411_2012_256Digest other) : base(IV) + public Gost3411_2012_256Digest(Gost3411_2012_256Digest other) : base(IV) { Reset(other); } @@ -48,7 +48,7 @@ namespace Org.BouncyCastle.Crypto.Digests public override IMemoable Copy() { - return new GOST3411_2012_256Digest(this); + return new Gost3411_2012_256Digest(this); } } } diff --git a/crypto/src/crypto/digests/GOST3411_2012_512Digest.cs b/crypto/src/crypto/digests/GOST3411_2012_512Digest.cs index eb40aba1d..2b77e36a9 100644 --- a/crypto/src/crypto/digests/GOST3411_2012_512Digest.cs +++ b/crypto/src/crypto/digests/GOST3411_2012_512Digest.cs @@ -3,7 +3,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Digests { - public class GOST3411_2012_512Digest:GOST3411_2012Digest + public class Gost3411_2012_512Digest:Gost3411_2012Digest { private readonly static byte[] IV = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -21,11 +21,11 @@ namespace Org.BouncyCastle.Crypto.Digests get { return "GOST3411-2012-512"; } } - public GOST3411_2012_512Digest():base(IV) + public Gost3411_2012_512Digest():base(IV) { } - public GOST3411_2012_512Digest(GOST3411_2012_512Digest other) : base(IV) + public Gost3411_2012_512Digest(Gost3411_2012_512Digest other) : base(IV) { Reset(other); } @@ -37,7 +37,7 @@ namespace Org.BouncyCastle.Crypto.Digests public override IMemoable Copy() { - return new GOST3411_2012_512Digest(this); + return new Gost3411_2012_512Digest(this); } } } diff --git a/crypto/src/crypto/parameters/ECGOST3410Parameters.cs b/crypto/src/crypto/parameters/ECGOST3410Parameters.cs index ede7433d6..a3aa1953c 100644 --- a/crypto/src/crypto/parameters/ECGOST3410Parameters.cs +++ b/crypto/src/crypto/parameters/ECGOST3410Parameters.cs @@ -4,7 +4,7 @@ using Org.BouncyCastle.Math.EC; namespace Org.BouncyCastle.Crypto.Parameters { - public class ECGOST3410Parameters : ECNamedDomainParameters + public class ECGost3410Parameters : ECNamedDomainParameters { private readonly DerObjectIdentifier _publicKeyParamSet; @@ -26,7 +26,7 @@ namespace Org.BouncyCastle.Crypto.Parameters get { return _encryptionParamSet; } } - public ECGOST3410Parameters( + public ECGost3410Parameters( ECNamedDomainParameters dp, DerObjectIdentifier publicKeyParamSet, DerObjectIdentifier digestParamSet, @@ -38,7 +38,7 @@ namespace Org.BouncyCastle.Crypto.Parameters } - public ECGOST3410Parameters(ECDomainParameters dp, DerObjectIdentifier publicKeyParamSet, + public ECGost3410Parameters(ECDomainParameters dp, DerObjectIdentifier publicKeyParamSet, DerObjectIdentifier digestParamSet, DerObjectIdentifier encryptionParamSet) : base(publicKeyParamSet, dp.Curve, dp.G, dp.N, dp.H, dp.GetSeed()) { diff --git a/crypto/src/crypto/signers/EcGost3410_2012Signer.cs b/crypto/src/crypto/signers/EcGost3410_2012Signer.cs index e7174ace6..c94f2c7d1 100644 --- a/crypto/src/crypto/signers/EcGost3410_2012Signer.cs +++ b/crypto/src/crypto/signers/EcGost3410_2012Signer.cs @@ -10,7 +10,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Signers { - public class ECGOST3410_2012Signer : IDsaExt + public class ECGost3410_2012Signer : IDsaExt { private ECKeyParameters key; private SecureRandom secureRandom; @@ -150,4 +150,4 @@ namespace Org.BouncyCastle.Crypto.Signers return new FixedPointCombMultiplier(); } } -} \ No newline at end of file +} diff --git a/crypto/src/pkcs/PrivateKeyInfoFactory.cs b/crypto/src/pkcs/PrivateKeyInfoFactory.cs index 75a56983a..0d5026909 100644 --- a/crypto/src/pkcs/PrivateKeyInfoFactory.cs +++ b/crypto/src/pkcs/PrivateKeyInfoFactory.cs @@ -124,9 +124,9 @@ namespace Org.BouncyCastle.Pkcs ECDomainParameters dp = priv.Parameters; // ECGOST3410 - if (dp is ECGOST3410Parameters) + if (dp is ECGost3410Parameters) { - ECGOST3410Parameters domainParameters = (ECGOST3410Parameters) dp; + ECGost3410Parameters domainParameters = (ECGost3410Parameters) dp; Gost3410PublicKeyAlgParameters gostParams = new Gost3410PublicKeyAlgParameters( (domainParameters).PublicKeyParamSet, diff --git a/crypto/src/security/DigestUtilities.cs b/crypto/src/security/DigestUtilities.cs index 24a68f63d..7685e3384 100644 --- a/crypto/src/security/DigestUtilities.cs +++ b/crypto/src/security/DigestUtilities.cs @@ -213,8 +213,8 @@ namespace Org.BouncyCastle.Security case DigestAlgorithm.DSTU7564_384: return new Dstu7564Digest(384); case DigestAlgorithm.DSTU7564_512: return new Dstu7564Digest(512); case DigestAlgorithm.GOST3411: return new Gost3411Digest(); - case DigestAlgorithm.GOST3411_2012_256: return new GOST3411_2012_256Digest(); - case DigestAlgorithm.GOST3411_2012_512: return new GOST3411_2012_512Digest(); + case DigestAlgorithm.GOST3411_2012_256: return new Gost3411_2012_256Digest(); + case DigestAlgorithm.GOST3411_2012_512: return new Gost3411_2012_512Digest(); case DigestAlgorithm.KECCAK_224: return new KeccakDigest(224); case DigestAlgorithm.KECCAK_256: return new KeccakDigest(256); case DigestAlgorithm.KECCAK_288: return new KeccakDigest(288); diff --git a/crypto/src/security/PrivateKeyFactory.cs b/crypto/src/security/PrivateKeyFactory.cs index 9f2d2e9c1..f7709160d 100644 --- a/crypto/src/security/PrivateKeyFactory.cs +++ b/crypto/src/security/PrivateKeyFactory.cs @@ -192,7 +192,7 @@ namespace Org.BouncyCastle.Security || algOid.Equals(RosstandartObjectIdentifiers.id_tc26_gost_3410_12_256)) { Gost3410PublicKeyAlgParameters gostParams = Gost3410PublicKeyAlgParameters.GetInstance(keyInfo.PrivateKeyAlgorithm.Parameters); - ECGOST3410Parameters ecSpec = null; + ECGost3410Parameters ecSpec = null; BigInteger d = null; Asn1Object p = keyInfo.PrivateKeyAlgorithm.Parameters.ToAsn1Object(); if (p is Asn1Sequence && (Asn1Sequence.GetInstance(p).Count == 2 || Asn1Sequence.GetInstance(p).Count == 3)) @@ -200,7 +200,7 @@ namespace Org.BouncyCastle.Security ECDomainParameters ecP = ECGost3410NamedCurves.GetByOid(gostParams.PublicKeyParamSet); - ecSpec = new ECGOST3410Parameters( + ecSpec = new ECGost3410Parameters( new ECNamedDomainParameters( gostParams.PublicKeyParamSet, ecP), gostParams.PublicKeyParamSet, @@ -237,7 +237,7 @@ namespace Org.BouncyCastle.Security if (ecP == null) { ECDomainParameters gParam = ECGost3410NamedCurves.GetByOid(oid); - ecSpec = new ECGOST3410Parameters(new ECNamedDomainParameters( + ecSpec = new ECGost3410Parameters(new ECNamedDomainParameters( oid, gParam.Curve, gParam.G, @@ -248,7 +248,7 @@ namespace Org.BouncyCastle.Security } else { - ecSpec = new ECGOST3410Parameters(new ECNamedDomainParameters( + ecSpec = new ECGost3410Parameters(new ECNamedDomainParameters( oid, ecP.Curve, ecP.G, @@ -265,7 +265,7 @@ namespace Org.BouncyCastle.Security else { X9ECParameters ecP = X9ECParameters.GetInstance(parameters.Parameters); - ecSpec = new ECGOST3410Parameters(new ECNamedDomainParameters( + ecSpec = new ECGost3410Parameters(new ECNamedDomainParameters( algOid, ecP.Curve, ecP.G, @@ -292,7 +292,7 @@ namespace Org.BouncyCastle.Security return new ECPrivateKeyParameters( d, - new ECGOST3410Parameters( + new ECGost3410Parameters( ecSpec, gostParams.PublicKeyParamSet, gostParams.DigestParamSet, diff --git a/crypto/src/security/PublicKeyFactory.cs b/crypto/src/security/PublicKeyFactory.cs index 3623c3ee2..7a34d71df 100644 --- a/crypto/src/security/PublicKeyFactory.cs +++ b/crypto/src/security/PublicKeyFactory.cs @@ -261,8 +261,8 @@ namespace Org.BouncyCastle.Security Gost3410PublicKeyAlgParameters gostParams = Gost3410PublicKeyAlgParameters.GetInstance(keyInfo.AlgorithmID.Parameters); - ECGOST3410Parameters ecDomainParameters = - new ECGOST3410Parameters( + ECGost3410Parameters ecDomainParameters = + new ECGost3410Parameters( new ECNamedDomainParameters(gostParams.PublicKeyParamSet, ECGost3410NamedCurves.GetByOid(gostParams.PublicKeyParamSet)), gostParams.PublicKeyParamSet, gostParams.DigestParamSet, diff --git a/crypto/src/x509/SubjectPublicKeyInfoFactory.cs b/crypto/src/x509/SubjectPublicKeyInfoFactory.cs index 234bcff34..395c31263 100644 --- a/crypto/src/x509/SubjectPublicKeyInfoFactory.cs +++ b/crypto/src/x509/SubjectPublicKeyInfoFactory.cs @@ -98,9 +98,9 @@ namespace Org.BouncyCastle.X509 ECPublicKeyParameters _key = (ECPublicKeyParameters) publicKey; - if (_key.Parameters is ECGOST3410Parameters) + if (_key.Parameters is ECGost3410Parameters) { - ECGOST3410Parameters gostParams = (ECGOST3410Parameters)_key.Parameters; + ECGost3410Parameters gostParams = (ECGost3410Parameters)_key.Parameters; BigInteger bX = _key.Q.AffineXCoord.ToBigInteger(); BigInteger bY = _key.Q.AffineYCoord.ToBigInteger(); diff --git a/crypto/test/UnitTests.csproj b/crypto/test/UnitTests.csproj index 2dd3547fa..d36877026 100644 --- a/crypto/test/UnitTests.csproj +++ b/crypto/test/UnitTests.csproj @@ -137,6 +137,7 @@ <Compile Include="src\cms\test\Rfc4134Test.cs" /> <Compile Include="src\cms\test\SignedDataStreamTest.cs" /> <Compile Include="src\cms\test\SignedDataTest.cs" /> + <Compile Include="src\crmf\test\CrmfTest.cs" /> <Compile Include="src\crypto\examples\DESExample.cs" /> <Compile Include="src\crypto\io\test\AllTests.cs" /> <Compile Include="src\crypto\io\test\CipherStreamTest.cs" /> @@ -185,11 +186,13 @@ <Compile Include="src\crypto\test\EAXTest.cs" /> <Compile Include="src\crypto\test\ECDHKEKGeneratorTest.cs" /> <Compile Include="src\crypto\test\ECGOST3410Test.cs" /> + <Compile Include="src\crypto\test\ECGOST3410_2012Test.cs" /> <Compile Include="src\crypto\test\ECIESTest.cs" /> <Compile Include="src\crypto\test\ECNRTest.cs" /> <Compile Include="src\crypto\test\ECTest.cs" /> <Compile Include="src\crypto\test\Ed25519Test.cs" /> <Compile Include="src\crypto\test\Ed448Test.cs" /> + <Compile Include="src\crypto\test\EGOST3410_2012SignatureTest.cs" /> <Compile Include="src\crypto\test\ElGamalTest.cs" /> <Compile Include="src\crypto\test\EqualsHashCodeTest.cs" /> <Compile Include="src\crypto\test\GCMTest.cs" /> @@ -386,6 +389,7 @@ <Compile Include="src\pkcs\test\EncryptedPrivateKeyInfoTest.cs" /> <Compile Include="src\pkcs\test\PKCS10Test.cs" /> <Compile Include="src\pkcs\test\PKCS12StoreTest.cs" /> + <Compile Include="src\ProtectedMessageTest.cs" /> <Compile Include="src\security\test\SecureRandomTest.cs" /> <Compile Include="src\security\test\TestDigestUtil.cs" /> <Compile Include="src\security\test\TestDotNetUtil.cs" /> @@ -1317,4 +1321,7 @@ <ItemGroup> <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> </ItemGroup> + <ItemGroup> + <Folder Include="src\NewFolder1\" /> + </ItemGroup> </Project> \ No newline at end of file diff --git a/crypto/test/src/crypto/test/ECGOST3410_2012Test.cs b/crypto/test/src/crypto/test/ECGOST3410_2012Test.cs index 94726bc92..8c5997835 100644 --- a/crypto/test/src/crypto/test/ECGOST3410_2012Test.cs +++ b/crypto/test/src/crypto/test/ECGOST3410_2012Test.cs @@ -29,7 +29,7 @@ namespace Org.BouncyCastle.Crypto.Tests DerObjectIdentifier oid = ECGost3410NamedCurves.GetOid("Tc26-Gost-3410-12-512-paramSetA"); ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOid(oid)); - ECGOST3410Parameters gostParams = new ECGOST3410Parameters(ecp, oid, RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512,null); + ECGost3410Parameters gostParams = new ECGost3410Parameters(ecp, oid, RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512,null); ECKeyGenerationParameters paramameters = new ECKeyGenerationParameters(gostParams, new SecureRandom()); ECKeyPairGenerator engine = new ECKeyPairGenerator(); engine.Init(paramameters); @@ -49,8 +49,8 @@ namespace Org.BouncyCastle.Crypto.Tests keyParameters = (ECPublicKeyParameters)PublicKeyFactory.CreateKey(info); { // Specifically cast and test gost parameters. - ECGOST3410Parameters gParam = (ECGOST3410Parameters)generatedKeyParameters.Parameters; - ECGOST3410Parameters rParam = (ECGOST3410Parameters)keyParameters.Parameters; + ECGost3410Parameters gParam = (ECGost3410Parameters)generatedKeyParameters.Parameters; + ECGost3410Parameters rParam = (ECGost3410Parameters)keyParameters.Parameters; bool ok = SafeEquals(gParam.DigestParamSet, rParam.DigestParamSet) && @@ -64,8 +64,8 @@ namespace Org.BouncyCastle.Crypto.Tests } - if (!((ECGOST3410Parameters)keyParameters.Parameters).Name.Equals( - ((ECGOST3410Parameters)generatedKeyParameters.Parameters).Name)) + if (!((ECGost3410Parameters)keyParameters.Parameters).Name.Equals( + ((ECGost3410Parameters)generatedKeyParameters.Parameters).Name)) { return new SimpleTestResult(false, "Name does not match"); } @@ -124,7 +124,7 @@ namespace Org.BouncyCastle.Crypto.Tests DerObjectIdentifier oid = ECGost3410NamedCurves.GetOid("Tc26-Gost-3410-12-512-paramSetA"); ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOid(oid)); - ECGOST3410Parameters gostParams = new ECGOST3410Parameters(ecp, oid, RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512,null); + ECGost3410Parameters gostParams = new ECGost3410Parameters(ecp, oid, RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512,null); ECKeyGenerationParameters parameters = new ECKeyGenerationParameters(gostParams, new SecureRandom()); ECKeyPairGenerator engine = new ECKeyPairGenerator(); engine.Init(parameters); @@ -145,8 +145,8 @@ namespace Org.BouncyCastle.Crypto.Tests keyParameters = (ECPrivateKeyParameters)PrivateKeyFactory.CreateKey(info); { // Specifically cast and test gost parameters. - ECGOST3410Parameters gParam = (ECGOST3410Parameters)generatedKeyParameters.Parameters; - ECGOST3410Parameters rParam = (ECGOST3410Parameters)keyParameters.Parameters; + ECGost3410Parameters gParam = (ECGost3410Parameters)generatedKeyParameters.Parameters; + ECGost3410Parameters rParam = (ECGost3410Parameters)keyParameters.Parameters; bool ok = SafeEquals(gParam.DigestParamSet, rParam.DigestParamSet) && SafeEquals(gParam.EncryptionParamSet, rParam.EncryptionParamSet) && @@ -169,8 +169,8 @@ namespace Org.BouncyCastle.Crypto.Tests return new SimpleTestResult(false, "D does not match"); } - if (!((ECGOST3410Parameters)keyParameters.Parameters).Name.Equals( - ((ECGOST3410Parameters)generatedKeyParameters.Parameters).Name)) + if (!((ECGost3410Parameters)keyParameters.Parameters).Name.Equals( + ((ECGost3410Parameters)generatedKeyParameters.Parameters).Name)) { return new SimpleTestResult(false, "Name does not match"); } @@ -232,17 +232,17 @@ namespace Org.BouncyCastle.Crypto.Tests return new SimpleTestResult(false, "Q does not match"); } - if (!((ECGOST3410Parameters)pkInfo.Parameters).PublicKeyParamSet.ToString().Equals("1.2.643.7.1.2.1.1.1")) + if (!((ECGost3410Parameters)pkInfo.Parameters).PublicKeyParamSet.ToString().Equals("1.2.643.7.1.2.1.1.1")) { return new SimpleTestResult(false, "PublicKeyParamSet does not match"); } - if (!((ECGOST3410Parameters)pkInfo.Parameters).DigestParamSet.ToString().Equals("1.2.643.7.1.1.2.2")) + if (!((ECGost3410Parameters)pkInfo.Parameters).DigestParamSet.ToString().Equals("1.2.643.7.1.1.2.2")) { return new SimpleTestResult(false, "DigestParamSet does not match"); } - if (((ECGOST3410Parameters)pkInfo.Parameters).EncryptionParamSet != null) + if (((ECGost3410Parameters)pkInfo.Parameters).EncryptionParamSet != null) { return new SimpleTestResult(false, "EncryptionParamSet is not null"); } @@ -266,17 +266,17 @@ namespace Org.BouncyCastle.Crypto.Tests } - if (!((ECGOST3410Parameters)pkInfo.Parameters).PublicKeyParamSet.ToString().Equals("1.2.643.7.1.2.1.2.1")) + if (!((ECGost3410Parameters)pkInfo.Parameters).PublicKeyParamSet.ToString().Equals("1.2.643.7.1.2.1.2.1")) { return new SimpleTestResult(false, "PublicKeyParamSet does not match"); } - if (!((ECGOST3410Parameters)pkInfo.Parameters).DigestParamSet.ToString().Equals("1.2.643.7.1.1.2.3")) + if (!((ECGost3410Parameters)pkInfo.Parameters).DigestParamSet.ToString().Equals("1.2.643.7.1.1.2.3")) { return new SimpleTestResult(false, "DigestParamSet does not match"); } - if (((ECGOST3410Parameters)pkInfo.Parameters).EncryptionParamSet != null) + if (((ECGost3410Parameters)pkInfo.Parameters).EncryptionParamSet != null) { return new SimpleTestResult(false, "EncryptionParamSet is not null"); } @@ -304,17 +304,17 @@ namespace Org.BouncyCastle.Crypto.Tests return new SimpleTestResult(false, "D does not match"); } - if (!((ECGOST3410Parameters)pkInfo.Parameters).PublicKeyParamSet.ToString().Equals("1.2.643.7.1.2.1.1.1")) + if (!((ECGost3410Parameters)pkInfo.Parameters).PublicKeyParamSet.ToString().Equals("1.2.643.7.1.2.1.1.1")) { return new SimpleTestResult(false, "PublicKeyParamSet does not match"); } - if (!((ECGOST3410Parameters)pkInfo.Parameters).DigestParamSet.ToString().Equals("1.2.643.7.1.1.2.2")) + if (!((ECGost3410Parameters)pkInfo.Parameters).DigestParamSet.ToString().Equals("1.2.643.7.1.1.2.2")) { return new SimpleTestResult(false, "DigestParamSet does not match"); } - if (((ECGOST3410Parameters)pkInfo.Parameters).EncryptionParamSet != null) + if (((ECGost3410Parameters)pkInfo.Parameters).EncryptionParamSet != null) { return new SimpleTestResult(false, "EncryptionParamSet is not null"); } @@ -337,17 +337,17 @@ namespace Org.BouncyCastle.Crypto.Tests return new SimpleTestResult(false, "D does not match"); } - if (!((ECGOST3410Parameters)pkInfo.Parameters).PublicKeyParamSet.ToString().Equals("1.2.643.7.1.2.1.2.1")) + if (!((ECGost3410Parameters)pkInfo.Parameters).PublicKeyParamSet.ToString().Equals("1.2.643.7.1.2.1.2.1")) { return new SimpleTestResult(false, "PublicKeyParamSet does not match"); } - if (!((ECGOST3410Parameters)pkInfo.Parameters).DigestParamSet.ToString().Equals("1.2.643.7.1.1.2.3")) + if (!((ECGost3410Parameters)pkInfo.Parameters).DigestParamSet.ToString().Equals("1.2.643.7.1.1.2.3")) { return new SimpleTestResult(false, "DigestParamSet does not match"); } - if (((ECGOST3410Parameters)pkInfo.Parameters).EncryptionParamSet != null) + if (((ECGost3410Parameters)pkInfo.Parameters).EncryptionParamSet != null) { return new SimpleTestResult(false, "EncryptionParamSet is not null"); } @@ -363,7 +363,7 @@ namespace Org.BouncyCastle.Crypto.Tests { DerObjectIdentifier oid = ECGost3410NamedCurves.GetOid(oidStr); ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOid(oid)); - ECGOST3410Parameters gostParams = new ECGOST3410Parameters(ecp, oid, digest, null); + ECGost3410Parameters gostParams = new ECGost3410Parameters(ecp, oid, digest, null); ECKeyGenerationParameters parameters = new ECKeyGenerationParameters(gostParams, new SecureRandom()); ECKeyPairGenerator engine = new ECKeyPairGenerator(); engine.Init(parameters); @@ -378,8 +378,8 @@ namespace Org.BouncyCastle.Crypto.Tests { // Specifically cast and test gost parameters. - ECGOST3410Parameters gParam = (ECGOST3410Parameters)generatedKeyParameters.Parameters; - ECGOST3410Parameters rParam = (ECGOST3410Parameters)recoveredKeyParameters.Parameters; + ECGost3410Parameters gParam = (ECGost3410Parameters)generatedKeyParameters.Parameters; + ECGost3410Parameters rParam = (ECGost3410Parameters)recoveredKeyParameters.Parameters; bool ok = SafeEquals(gParam.DigestParamSet, rParam.DigestParamSet) && SafeEquals(gParam.EncryptionParamSet, rParam.EncryptionParamSet) && @@ -398,8 +398,8 @@ namespace Org.BouncyCastle.Crypto.Tests return new SimpleTestResult(false, "isPrivate does not match"); } - if (!((ECGOST3410Parameters)recoveredKeyParameters.Parameters).Name.Equals( - ((ECGOST3410Parameters)generatedKeyParameters.Parameters).Name)) + if (!((ECGost3410Parameters)recoveredKeyParameters.Parameters).Name.Equals( + ((ECGost3410Parameters)generatedKeyParameters.Parameters).Name)) { return new SimpleTestResult(false, "Name does not match"); } @@ -449,7 +449,7 @@ namespace Org.BouncyCastle.Crypto.Tests { DerObjectIdentifier oid = ECGost3410NamedCurves.GetOid(oidStr); ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOid(oid)); - ECGOST3410Parameters gostParams = new ECGOST3410Parameters(ecp,oid,digest,null); + ECGost3410Parameters gostParams = new ECGost3410Parameters(ecp,oid,digest,null); ECKeyGenerationParameters parameters = new ECKeyGenerationParameters(gostParams, new SecureRandom()); ECKeyPairGenerator engine = new ECKeyPairGenerator(); engine.Init(parameters); @@ -461,8 +461,8 @@ namespace Org.BouncyCastle.Crypto.Tests ECPublicKeyParameters recoveredKeyParameters = (ECPublicKeyParameters)PublicKeyFactory.CreateKey(info); { // Specifically cast and test gost parameters. - ECGOST3410Parameters gParam = (ECGOST3410Parameters)generatedKeyParameters.Parameters; - ECGOST3410Parameters rParam = (ECGOST3410Parameters)recoveredKeyParameters.Parameters; + ECGost3410Parameters gParam = (ECGost3410Parameters)generatedKeyParameters.Parameters; + ECGost3410Parameters rParam = (ECGost3410Parameters)recoveredKeyParameters.Parameters; bool ok = SafeEquals(gParam.DigestParamSet, rParam.DigestParamSet) && @@ -476,8 +476,8 @@ namespace Org.BouncyCastle.Crypto.Tests } - if (!((ECGOST3410Parameters)recoveredKeyParameters.Parameters).Name.Equals( - ((ECGOST3410Parameters)generatedKeyParameters.Parameters).Name)) + if (!((ECGost3410Parameters)recoveredKeyParameters.Parameters).Name.Equals( + ((ECGost3410Parameters)generatedKeyParameters.Parameters).Name)) { return new SimpleTestResult(false, "Name does not match"); } diff --git a/crypto/test/src/crypto/test/EGOST3410_2012SignatureTest.cs b/crypto/test/src/crypto/test/EGOST3410_2012SignatureTest.cs index 0065174ed..7c9801430 100644 --- a/crypto/test/src/crypto/test/EGOST3410_2012SignatureTest.cs +++ b/crypto/test/src/crypto/test/EGOST3410_2012SignatureTest.cs @@ -65,7 +65,7 @@ namespace Org.BouncyCastle.Crypto.Tests new BigInteger("17614944419213781543809391949654080031942662045363639260709847859438286763994")), // y spec); - ECGOST3410_2012Signer signer = new ECGOST3410_2012Signer(); + ECGost3410_2012Signer signer = new ECGost3410_2012Signer(); signer.Init(true, new ParametersWithRandom(privateKey, k)); byte[] rev = e.ToByteArray(); @@ -104,7 +104,7 @@ namespace Org.BouncyCastle.Crypto.Tests { DerObjectIdentifier oid = RosstandartObjectIdentifiers.id_tc26_gost_3410_12_256_paramSetA; ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOid(oid)); - ECGOST3410Parameters gostParams = new ECGOST3410Parameters(ecp, oid, + ECGost3410Parameters gostParams = new ECGost3410Parameters(ecp, oid, RosstandartObjectIdentifiers.id_tc26_gost_3411_12_256, null); ECKeyGenerationParameters parameters = new ECKeyGenerationParameters(gostParams, new SecureRandom()); ECKeyPairGenerator engine = new ECKeyPairGenerator(); @@ -119,7 +119,7 @@ namespace Org.BouncyCastle.Crypto.Tests { DerObjectIdentifier oid = RosstandartObjectIdentifiers.id_tc26_gost_3410_12_512_paramSetA; ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOid(oid)); - ECGOST3410Parameters gostParams = new ECGOST3410Parameters(ecp, oid, + ECGost3410Parameters gostParams = new ECGost3410Parameters(ecp, oid, RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512, null); ECKeyGenerationParameters parameters = new ECKeyGenerationParameters(gostParams, new SecureRandom()); ECKeyPairGenerator engine = new ECKeyPairGenerator(); @@ -141,13 +141,13 @@ namespace Org.BouncyCastle.Crypto.Tests ECPrivateKeyParameters sKey = (ECPrivateKeyParameters)p.Private; ECPublicKeyParameters vKey = (ECPublicKeyParameters)p.Public; - ECGOST3410_2012Signer s = new ECGOST3410_2012Signer(); + ECGost3410_2012Signer s = new ECGost3410_2012Signer(); s.Init(true, sKey); BigInteger[] sig = s.GenerateSignature(data); - s = new ECGOST3410_2012Signer(); + s = new ECGost3410_2012Signer(); s.Init(false, vKey); if (!s.VerifySignature(data, sig[0], sig[1])) @@ -159,8 +159,8 @@ namespace Org.BouncyCastle.Crypto.Tests // Test with Digest signer. // Gost3410DigestSigner digestSigner = new Gost3410DigestSigner( - new ECGOST3410_2012Signer(), - DigestUtilities.GetDigest(((ECGOST3410Parameters)vKey.Parameters).DigestParamSet)); + new ECGost3410_2012Signer(), + DigestUtilities.GetDigest(((ECGost3410Parameters)vKey.Parameters).DigestParamSet)); digestSigner.Init(true, sKey); digestSigner.BlockUpdate(data, 0, data.Length); byte[] sigBytes = digestSigner.GenerateSignature(); @@ -171,8 +171,8 @@ namespace Org.BouncyCastle.Crypto.Tests } digestSigner = new Gost3410DigestSigner( - new ECGOST3410_2012Signer(), - DigestUtilities.GetDigest(((ECGOST3410Parameters)vKey.Parameters).DigestParamSet)); + new ECGost3410_2012Signer(), + DigestUtilities.GetDigest(((ECGost3410Parameters)vKey.Parameters).DigestParamSet)); digestSigner.Init(false, vKey); digestSigner.BlockUpdate(data, 0, data.Length); diff --git a/crypto/test/src/crypto/test/GOST3411_2012_256DigestTest.cs b/crypto/test/src/crypto/test/GOST3411_2012_256DigestTest.cs index 5b20f46be..1f2ef1823 100644 --- a/crypto/test/src/crypto/test/GOST3411_2012_256DigestTest.cs +++ b/crypto/test/src/crypto/test/GOST3411_2012_256DigestTest.cs @@ -61,7 +61,7 @@ namespace Org.BouncyCastle.Crypto.Tests }; public GOST3411_2012_256DigestTest() - : base(new GOST3411_2012_256Digest(), messages, digests) + : base(new Gost3411_2012_256Digest(), messages, digests) { } @@ -69,7 +69,7 @@ namespace Org.BouncyCastle.Crypto.Tests { base.PerformTest(); - HMac gMac = new HMac(new GOST3411_2012_256Digest()); + HMac gMac = new HMac(new Gost3411_2012_256Digest()); gMac.Init(new KeyParameter(Hex.Decode("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"))); @@ -88,7 +88,7 @@ namespace Org.BouncyCastle.Crypto.Tests protected override IDigest CloneDigest(IDigest digest) { - return new GOST3411_2012_256Digest((GOST3411_2012_256Digest)digest); + return new Gost3411_2012_256Digest((Gost3411_2012_256Digest)digest); } [Test] diff --git a/crypto/test/src/crypto/test/GOST3411_2012_512DigestTest.cs b/crypto/test/src/crypto/test/GOST3411_2012_512DigestTest.cs index 05b33e7f9..f4398952b 100644 --- a/crypto/test/src/crypto/test/GOST3411_2012_512DigestTest.cs +++ b/crypto/test/src/crypto/test/GOST3411_2012_512DigestTest.cs @@ -61,7 +61,7 @@ namespace Org.BouncyCastle.Crypto.Tests { base.PerformTest(); - HMac gMac = new HMac(new GOST3411_2012_512Digest()); + HMac gMac = new HMac(new Gost3411_2012_512Digest()); gMac.Init(new KeyParameter(Hex.Decode("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"))); @@ -79,13 +79,13 @@ namespace Org.BouncyCastle.Crypto.Tests } public GOST3411_2012_512DigestTest() - : base(new GOST3411_2012_512Digest(), messages, digests) + : base(new Gost3411_2012_512Digest(), messages, digests) { } protected override IDigest CloneDigest(IDigest digest) { - return new GOST3411_2012_512Digest((GOST3411_2012_512Digest)digest); + return new Gost3411_2012_512Digest((Gost3411_2012_512Digest)digest); } [Test] |