Skip to content

Commit

Permalink
8295982: Failure in sun/security/tools/keytool/WeakAlg.java - ks: The…
Browse files Browse the repository at this point in the history
… process cannot access the file because it is being used by another process

Reviewed-by: dcherepanov
  • Loading branch information
Roman Marchenko authored and Andrew Brygin committed Dec 1, 2022
1 parent fcd3c9c commit 8356d04
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions jdk/test/sun/security/tools/keytool/WeakAlg.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,27 +329,33 @@ static void checkInplaceImportKeyStore() throws Exception {
.shouldMatch("The original.*ks.old5");

KeyStore test_ks = KeyStore.getInstance("JKS");
test_ks.load(new FileInputStream(new File("ks")),
FileInputStream inputStream = new FileInputStream(new File("ks"));
test_ks.load(inputStream,
"changeit".toCharArray());
Asserts.assertEQ(
test_ks.getType(), "JKS");
inputStream.close();

importkeystore("ks", "ks", "-deststoretype PKCS12")
.shouldContain("Warning:")
.shouldNotContain("proprietary format")
.shouldMatch("Migrated.*Non.*JKS.*ks.old6");

test_ks = KeyStore.getInstance("PKCS12");
test_ks.load(new FileInputStream(new File("ks")),
inputStream = new FileInputStream(new File("ks"));
test_ks.load(inputStream,
"changeit".toCharArray());
Asserts.assertEQ(
test_ks.getType(), "PKCS12");
inputStream.close();

test_ks = KeyStore.getInstance("JKS");
test_ks.load(new FileInputStream(new File("ks.old6")),
inputStream = new FileInputStream(new File("ks.old6"));
test_ks.load(inputStream,
"changeit".toCharArray());
Asserts.assertEQ(
test_ks.getType(), "JKS");
inputStream.close();

// One password prompt is enough for migration
kt0("-importkeystore -srckeystore ks -destkeystore ks", "changeit")
Expand Down

1 comment on commit 8356d04

@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.