Skip to content

Conversation

@johnpeck-us-ibm
Copy link
Member

@johnpeck-us-ibm johnpeck-us-ibm commented Dec 11, 2025

Add Check for PQCPrivateKey in Decapsulator and add tests for invalid keys.

Signed-off-by: John Peck 140550562+johnpeck-us-ibm@users.noreply.github.com

Copy link
Member

@jasonkatonica jasonkatonica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tests are also failing with the following unused variables:

Error:  /home/runner/work/OpenJCEPlus/OpenJCEPlus/src/test/java/ibm/jceplus/junit/base/BaseTestKEM.java:190:16: Unused local variable 'encr'. [UnusedLocalVariable]
Error:  /home/runner/work/OpenJCEPlus/OpenJCEPlus/src/test/java/ibm/jceplus/junit/base/BaseTestKEM.java:197:16: Unused local variable 'decr'. [UnusedLocalVariable]
Error:  /home/runner/work/OpenJCEPlus/OpenJCEPlus/src/test/java/ibm/jceplus/junit/base/BaseTestKEM.java:208:16: Unused local variable 'encr'. [UnusedLocalVariable]
Error:  /home/runner/work/OpenJCEPlus/OpenJCEPlus/src/test/java/ibm/jceplus/junit/base/BaseTestKEM.java:215:16: Unused local variable 'decr'. [UnusedLocalVariable]

Copy link
Member

@jasonkatonica jasonkatonica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@johnpeck-us-ibm johnpeck-us-ibm deleted the PQCKEMPrivKeyCheck branch January 8, 2026 16:53
@johnpeck-us-ibm johnpeck-us-ibm restored the PQCKEMPrivKeyCheck branch January 8, 2026 21:51
… keys.

Signed-off-by: John Peck <140550562+johnpeck-us-ibm@users.noreply.github.com>

try {
kem.newDecapsulator(pqcKeyPair.getPrivate());
fail("testKEMKeys failed - RSA Private key did not cause an Invalid Key Excepton.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a typo. Saying Invalid Key Excepton instead of InvalidKeyException.


try {
kem.newEncapsulator(pqcKeyPair.getPublic());
fail("testKEMKeys failed - RSA Public key did not cause an Invalid Key Excepton.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a typo. Saying Invalid Key Excepton instead of InvalidKeyException.


try {
kem.newEncapsulator(pub);
fail("testKEMKeys failed - NULL Public key did not cause an Invalid Key Excepton.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a typo. Saying Invalid Key Excepton instead of InvalidKeyException.


try {
kem.newDecapsulator(priv);
fail("testKEMKeys failed - NULL Private key did not cause an Invalid Key Excepton.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a typo. Saying Invalid Key Excepton instead of InvalidKeyException.


if (getProviderName().equals("OpenJCEPlusFIPS") ||
getInteropProviderName().equals(Utils.PROVIDER_BC)) {
//This is not in the FIPS provider yet and Boucy Castle does not support this test.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BouncyCastle instead of Boucy Castle.

public void testPQCKeyGenKEMAutoKeyConvertion() throws Exception {
String pqcAlgorithm = "ML-KEM-512";

if (getProviderName().equals("OpenJCEPlusFIPS") ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could substitute this with:

assumeFalse("OpenJCEPlusFIPS".equals(getProviderName()));
assumeFalse(Utils.PROVIDER_BC.equals(getProviderName()));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants