Skip to content

Commit

Permalink
Correct inverted logic in OpenSSLXDHKeyFactory. (#1165)
Browse files Browse the repository at this point in the history
And add missing tests to the OpenJDK suite which
is how this got missed in #1156.
  • Loading branch information
prbprbprb authored Sep 5, 2023
1 parent 2549bad commit 44a9e4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected <T extends KeySpec> T engineGetKeySpec(Key key, Class<T> keySpec)
}

// Support XDH or X25519 algorithm names per JEP 324
if (!"XDH".equals(key.getAlgorithm()) || !"X25519".equals(key.getAlgorithm()) ) {
if (!"XDH".equals(key.getAlgorithm()) && !"X25519".equals(key.getAlgorithm()) ) {
throw new InvalidKeySpecException("Key must be an XDH or X25519 key");
}

Expand Down
4 changes: 4 additions & 0 deletions common/src/test/java/org/conscrypt/ConscryptSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import org.conscrypt.java.security.KeyFactoryTestEC;
import org.conscrypt.java.security.KeyFactoryTestRSA;
import org.conscrypt.java.security.KeyFactoryTestRSACrt;
import org.conscrypt.java.security.KeyFactoryTestRSACustom;
import org.conscrypt.java.security.KeyFactoryTestXDH;
import org.conscrypt.java.security.KeyPairGeneratorTest;
import org.conscrypt.java.security.KeyPairGeneratorTestDH;
import org.conscrypt.java.security.KeyPairGeneratorTestDSA;
Expand Down Expand Up @@ -115,6 +117,8 @@
KeyFactoryTestEC.class,
KeyFactoryTestRSA.class,
KeyFactoryTestRSACrt.class,
KeyFactoryTestRSACustom.class,
KeyFactoryTestXDH.class,
KeyPairGeneratorTest.class,
KeyPairGeneratorTestDH.class,
KeyPairGeneratorTestDSA.class,
Expand Down

0 comments on commit 44a9e4c

Please sign in to comment.