Navigation Menu

Skip to content

Commit

Permalink
8278344: sun/security/pkcs12/KeytoolOpensslInteropTest.java test fail…
Browse files Browse the repository at this point in the history
…s because of different openssl output

Reviewed-by: mbaesken
Backport-of: 8b5ff4bdffc8f32317d67b00c085071d6c772b30
  • Loading branch information
RealCLanger committed Aug 26, 2022
1 parent 90a6418 commit 0cd49f5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/jdk/sun/security/pkcs12/KeytoolOpensslInteropTest.java
Expand Up @@ -168,19 +168,21 @@ private static void testWithJavaCommands() throws Throwable {
// Current default pkcs12 setting
keytool("-importkeystore -srckeystore ks -srcstorepass changeit "
+ "-destkeystore ksnormal -deststorepass changeit");

data = Files.readAllBytes(Path.of("ksnormal"));
checkInt(data, "22", 10000); // Mac ic
checkAlg(data, "2000", SHA_256); // Mac alg
checkAlg(data, "110c010c01000", PBES2); // key alg
checkInt(data, "110c010c01001011", 10000); // key ic
checkAlg(data, "110c10", ENCRYPTED_DATA_OID);
checkAlg(data, "110c110110", PBES2); // cert alg
check("ksnormal", "a", "changeit", "changeit", true, true, true);
check("ksnormal", "a", null, "changeit", true, false, true);
check("ksnormal", "a", "wrongpass", "-", IOException.class, "-", "-");

// Import it into a new keystore with legacy algorithms
keytool("-importkeystore -srckeystore ksnormal -srcstorepass changeit "
+ "-destkeystore kslegacyimp -deststorepass changeit "
+ "-destkeystore kslegacyimp -deststorepass changeit "
+ "-J-Dkeystore.pkcs12.legacy");
data = Files.readAllBytes(Path.of("kslegacyimp"));
checkInt(data, "22", 100000); // Mac ic
Expand Down Expand Up @@ -456,7 +458,7 @@ private static void testWithOpensslCommands(String opensslPath)
"pkcs12", "-in", "ksnormal", "-passin", "pass:changeit",
"-info", "-nokeys", "-nocerts");
output1.shouldHaveExitValue(0)
.shouldContain("MAC: sha1, Iteration 100000")
.shouldContain("MAC:").shouldContain("sha256").shouldContain("Iteration 10000")
.shouldContain("Shrouded Keybag: PBES2, PBKDF2, AES-256-CBC,"
+ " Iteration 10000, PRF hmacWithSHA256")
.shouldContain("PKCS7 Encrypted data: PBES2, PBKDF2, AES-256-CBC,"
Expand Down Expand Up @@ -499,7 +501,7 @@ private static void testWithOpensslCommands(String opensslPath)
"ksnewic", "-passin", "pass:changeit", "-info", "-nokeys",
"-nocerts");
output1.shouldHaveExitValue(0)
.shouldContain("MAC: sha1, Iteration 5555")
.shouldContain("MAC:").shouldContain("sha256").shouldContain("Iteration 5555")
.shouldContain("Shrouded Keybag: PBES2, PBKDF2, AES-256-CBC,"
+ " Iteration 7777, PRF hmacWithSHA256")
.shouldContain("Shrouded Keybag: pbeWithSHA1And128BitRC4,"
Expand Down

1 comment on commit 0cd49f5

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.