diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-24 17:31:14 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-24 17:31:14 +0700 |
commit | 0fc832a4e64f4b5bd3413531979bb90117ce375f (patch) | |
tree | 12b175b02ba3a1797f7f472451251a7608177d5d /crypto/test | |
parent | Cleanup Exception classes (diff) | |
download | BouncyCastle.NET-ed25519-0fc832a4e64f4b5bd3413531979bb90117ce375f.tar.xz |
Remove bridging version of Curve25519
Diffstat (limited to 'crypto/test')
-rw-r--r-- | crypto/test/src/crypto/test/ECTest.cs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/crypto/test/src/crypto/test/ECTest.cs b/crypto/test/src/crypto/test/ECTest.cs index 18abb8df1..58dc75e2f 100644 --- a/crypto/test/src/crypto/test/ECTest.cs +++ b/crypto/test/src/crypto/test/ECTest.cs @@ -745,8 +745,19 @@ namespace Org.BouncyCastle.Crypto.Tests { SecureRandom random = new SecureRandom(); - X9ECParameters x9 = CustomNamedCurves.GetByName("curve25519"); - ECDomainParameters ec = new ECDomainParameters(x9.Curve, x9.G, x9.N, x9.H, x9.GetSeed()); + // "curve25519" in short Weierstrass form + BigInteger q = BigInteger.One.ShiftLeft(255).Subtract(BigInteger.ValueOf(19)); + BigInteger a = new BigInteger(1, Hex.DecodeStrict("2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA984914A144")); + BigInteger b = new BigInteger(1, Hex.DecodeStrict("7B425ED097B425ED097B425ED097B425ED097B425ED097B4260B5E9C7710C864")); + BigInteger n = new BigInteger(1, Hex.DecodeStrict("1000000000000000000000000000000014DEF9DEA2F79CD65812631A5CF5D3ED")); + BigInteger h = BigInteger.ValueOf(8); + + ECCurve curve = new FpCurve(q, a, b, n, h); + X9ECPoint G = new X9ECPoint(curve, + Hex.DecodeStrict("042AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD245A20AE19A1B8A086B4E01EDD2C7748D14C923D4D7E6D7C61B229E9C5A27ECED3D9")); + + X9ECParameters x9 = new X9ECParameters(curve, G, n, h); + ECDomainParameters ec = new ECDomainParameters(x9); ECKeyPairGenerator kpg = new ECKeyPairGenerator(); kpg.Init(new ECKeyGenerationParameters(ec, random)); |