diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-09-11 12:00:39 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-09-11 12:00:39 +0700 |
commit | 67d33a2258f53f50f348a1362335e8201d3a77b2 (patch) | |
tree | f5345c561cfc01c592613e8d845a48f789a81635 | |
parent | CRL NextUpdate can be null (diff) | |
download | BouncyCastle.NET-ed25519-67d33a2258f53f50f348a1362335e8201d3a77b2.tar.xz |
Check DH standard group lookup
-rw-r--r-- | crypto/test/src/tls/crypto/test/BcTlsCryptoTest.cs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crypto/test/src/tls/crypto/test/BcTlsCryptoTest.cs b/crypto/test/src/tls/crypto/test/BcTlsCryptoTest.cs index 60f88bd05..a274cc5ba 100644 --- a/crypto/test/src/tls/crypto/test/BcTlsCryptoTest.cs +++ b/crypto/test/src/tls/crypto/test/BcTlsCryptoTest.cs @@ -4,6 +4,7 @@ using System.IO; using NUnit.Framework; +using Org.BouncyCastle.Math; using Org.BouncyCastle.Security; using Org.BouncyCastle.Tls.Crypto.Impl.BC; using Org.BouncyCastle.Tls.Tests; @@ -183,7 +184,15 @@ namespace Org.BouncyCastle.Tls.Crypto.Tests IList groups = new TestTlsDHGroupVerifier().Groups; foreach (DHGroup dhGroup in groups) { - int namedGroup = TlsDHUtilities.GetNamedGroupForDHParameters(dhGroup.P, dhGroup.G); + BigInteger p = dhGroup.P, g = dhGroup.G; + + /* + * DefaultTlsDHGroupVerifier default groups are configured from DHStandardGroups, so + * we expect to recover the exact instance here. + */ + Assert.AreSame(dhGroup, TlsDHUtilities.GetStandardGroupForDHParameters(p, g)); + + int namedGroup = TlsDHUtilities.GetNamedGroupForDHParameters(p, g); // Already tested the named groups if (NamedGroup.RefersToASpecificFiniteField(namedGroup)) |