equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
33 import java.util.Enumeration; |
33 import java.util.Enumeration; |
34 |
34 |
35 public class AccessKeyStore { |
35 public class AccessKeyStore { |
36 |
36 |
37 public static void main(String[] args) throws Exception { |
37 public static void main(String[] args) throws Exception { |
38 |
|
39 // Check if the provider is available |
|
40 try { |
|
41 Class.forName("sun.security.mscapi.SunMSCAPI"); |
|
42 |
|
43 } catch (Exception e) { |
|
44 System.out.println( |
|
45 "The SunMSCAPI provider is not available on this platform: " + |
|
46 e); |
|
47 return; |
|
48 } |
|
49 |
38 |
50 // Check that a security manager has been installed |
39 // Check that a security manager has been installed |
51 if (System.getSecurityManager() == null) { |
40 if (System.getSecurityManager() == null) { |
52 throw new Exception("A security manager has not been installed"); |
41 throw new Exception("A security manager has not been installed"); |
53 } |
42 } |
84 throw se; |
73 throw se; |
85 } |
74 } |
86 } |
75 } |
87 |
76 |
88 int i = 0; |
77 int i = 0; |
89 for (Enumeration e = keyStore.aliases(); e.hasMoreElements(); ) { |
78 for (Enumeration<String> e = keyStore.aliases(); e.hasMoreElements(); ) { |
90 String alias = (String) e.nextElement(); |
79 String alias = e.nextElement(); |
91 displayEntry(keyStore, alias, i++); |
80 displayEntry(keyStore, alias, i++); |
92 } |
81 } |
93 } |
82 } |
94 |
83 |
95 private static void displayEntry(KeyStore keyStore, String alias, |
84 private static void displayEntry(KeyStore keyStore, String alias, |