author | erikj |
Fri, 01 Apr 2016 17:08:43 +0200 | |
changeset 36725 | f458544b0d76 |
parent 34334 | 512c85086978 |
child 45028 | b0ea3c0bfb81 |
permissions | -rw-r--r-- |
34334
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
1 |
/* |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
2 |
* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
4 |
* |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
8 |
* |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
13 |
* accompanied this code). |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
14 |
* |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
18 |
* |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
21 |
* questions. |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
22 |
*/ |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
23 |
|
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
24 |
import java.io.File; |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
25 |
import java.security.KeyStore; |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
26 |
import java.security.PrivateKey; |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
27 |
import java.security.cert.Certificate; |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
28 |
|
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
29 |
/** |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
30 |
* @test |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
31 |
* @bug 8143913 |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
32 |
* @requires os.family == "windows" |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
33 |
* @summary MSCAPI keystore should accept Certificate[] in setEntry() |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
34 |
*/ |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
35 |
|
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
36 |
public class CastError { |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
37 |
public static void main(String[] args) throws Exception { |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
38 |
KeyStore ks = KeyStore.getInstance( |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
39 |
new File(System.getProperty("test.src"), |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
40 |
"../tools/jarsigner/JarSigning.keystore"), |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
41 |
"bbbbbb".toCharArray()); |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
42 |
|
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
43 |
PrivateKey pk = (PrivateKey) ks.getKey("c", "bbbbbb".toCharArray()); |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
44 |
Certificate cert = ks.getCertificate("c"); |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
45 |
|
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
46 |
ks = KeyStore.getInstance("Windows-MY"); |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
47 |
ks.load(null, null); |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
48 |
|
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
49 |
ks.setKeyEntry("8143913", pk, null, new Certificate[]{cert}); |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
50 |
ks.deleteEntry("8143913"); |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
51 |
} |
512c85086978
8143913: MSCAPI keystore should accept Certificate[] in setEntry()
weijun
parents:
diff
changeset
|
52 |
} |