Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
8237804: sun/security/mscapi tests fail with "Key pair not generated,…
… alias <nnnnnn> already exists"
Reviewed-by: mullan
- Loading branch information
|
|
@@ -1,5 +1,5 @@ |
|
|
/* |
|
|
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
|
|
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. |
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
|
* |
|
|
* This code is free software; you can redistribute it and/or modify it |
|
@@ -23,7 +23,7 @@ |
|
|
|
|
|
/** |
|
|
* @test |
|
|
* @bug 8213009 |
|
|
* @bug 8213009 8237804 |
|
|
* @summary Make sure SunMSCAPI keys have correct algorithm names |
|
|
* @requires os.family == "windows" |
|
|
* @library /test/lib |
|
@@ -42,6 +42,7 @@ |
|
|
|
|
|
public static void main(String[] arg) throws Exception { |
|
|
|
|
|
cleanup(); |
|
|
SecurityTools.keytool("-genkeypair", |
|
|
"-storetype", "Windows-My", |
|
|
"-keyalg", ALG, |
|
@@ -52,13 +53,21 @@ public static void main(String[] arg) throws Exception { |
|
|
try { |
|
|
test(loadKeysFromKeyStore()); |
|
|
} finally { |
|
|
cleanup(); |
|
|
} |
|
|
|
|
|
test(generateKeys()); |
|
|
} |
|
|
|
|
|
private static void cleanup() { |
|
|
try { |
|
|
KeyStore ks = KeyStore.getInstance("Windows-MY"); |
|
|
ks.load(null, null); |
|
|
ks.deleteEntry(ALIAS); |
|
|
ks.store(null, null); |
|
|
} catch (Exception e) { |
|
|
System.out.println("No such entry."); |
|
|
} |
|
|
|
|
|
test(generateKeys()); |
|
|
} |
|
|
|
|
|
static KeyPair loadKeysFromKeyStore() throws Exception { |
|
|
|
|
@@ -1,5 +1,5 @@ |
|
|
/* |
|
|
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. |
|
|
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. |
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
|
* |
|
|
* This code is free software; you can redistribute it and/or modify it |
|
@@ -23,7 +23,7 @@ |
|
|
|
|
|
/** |
|
|
* @test |
|
|
* @bug 6888925 8180570 |
|
|
* @bug 6888925 8180570 8237804 |
|
|
* @summary SunMSCAPI's Cipher can't use RSA public keys obtained from other sources. |
|
|
* @requires os.family == "windows" |
|
|
* @library /test/lib |
|
@@ -45,6 +45,7 @@ |
|
|
|
|
|
public static void main(String[] arg) throws Exception { |
|
|
|
|
|
cleanup(); |
|
|
SecurityTools.keytool("-genkeypair", |
|
|
"-storetype", "Windows-My", |
|
|
"-keyalg", "RSA", |
|
@@ -55,10 +56,18 @@ public static void main(String[] arg) throws Exception { |
|
|
try { |
|
|
run(); |
|
|
} finally { |
|
|
cleanup(); |
|
|
} |
|
|
} |
|
|
|
|
|
private static void cleanup() { |
|
|
try { |
|
|
KeyStore ks = KeyStore.getInstance("Windows-MY"); |
|
|
ks.load(null, null); |
|
|
ks.deleteEntry("6888925"); |
|
|
ks.store(null, null); |
|
|
} catch (Exception e) { |
|
|
System.out.println("No such entry."); |
|
|
} |
|
|
} |
|
|
|
|
|