File tree 2 files changed +24
-6
lines changed
test/jdk/sun/security/mscapi
2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
23
23
24
24
/**
25
25
* @test
26
- * @bug 8213009
26
+ * @bug 8213009 8237804
27
27
* @summary Make sure SunMSCAPI keys have correct algorithm names
28
28
* @requires os.family == "windows"
29
29
* @library /test/lib
@@ -42,6 +42,7 @@ public class KeyAlgorithms {
42
42
43
43
public static void main (String [] arg ) throws Exception {
44
44
45
+ cleanup ();
45
46
SecurityTools .keytool ("-genkeypair" ,
46
47
"-storetype" , "Windows-My" ,
47
48
"-keyalg" , ALG ,
@@ -52,13 +53,21 @@ public static void main(String[] arg) throws Exception {
52
53
try {
53
54
test (loadKeysFromKeyStore ());
54
55
} finally {
56
+ cleanup ();
57
+ }
58
+
59
+ test (generateKeys ());
60
+ }
61
+
62
+ private static void cleanup () {
63
+ try {
55
64
KeyStore ks = KeyStore .getInstance ("Windows-MY" );
56
65
ks .load (null , null );
57
66
ks .deleteEntry (ALIAS );
58
67
ks .store (null , null );
68
+ } catch (Exception e ) {
69
+ System .out .println ("No such entry." );
59
70
}
60
-
61
- test (generateKeys ());
62
71
}
63
72
64
73
static KeyPair loadKeysFromKeyStore () throws Exception {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2011, 2018 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2011, 2020 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
23
23
24
24
/**
25
25
* @test
26
- * @bug 6888925 8180570
26
+ * @bug 6888925 8180570 8237804
27
27
* @summary SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
28
28
* @requires os.family == "windows"
29
29
* @library /test/lib
@@ -45,6 +45,7 @@ public class PublicKeyInterop {
45
45
46
46
public static void main (String [] arg ) throws Exception {
47
47
48
+ cleanup ();
48
49
SecurityTools .keytool ("-genkeypair" ,
49
50
"-storetype" , "Windows-My" ,
50
51
"-keyalg" , "RSA" ,
@@ -55,10 +56,18 @@ public static void main(String[] arg) throws Exception {
55
56
try {
56
57
run ();
57
58
} finally {
59
+ cleanup ();
60
+ }
61
+ }
62
+
63
+ private static void cleanup () {
64
+ try {
58
65
KeyStore ks = KeyStore .getInstance ("Windows-MY" );
59
66
ks .load (null , null );
60
67
ks .deleteEntry ("6888925" );
61
68
ks .store (null , null );
69
+ } catch (Exception e ) {
70
+ System .out .println ("No such entry." );
62
71
}
63
72
}
64
73
You can’t perform that action at this time.
0 commit comments