76 return signedBy(cert, cert);
77 }
78
79 public static boolean signedBy(X509Certificate end, X509Certificate ca) {
80 if (!ca.getSubjectX500Principal().equals(end.getIssuerX500Principal())) {
81 return false;
82 }
83 try {
84 end.verify(ca.getPublicKey());
85 return true;
86 } catch (Exception e) {
87 return false;
88 }
89 }
90
91 /**
92 * Returns true if KeyStore has a password. This is true except for
93 * MSCAPI KeyStores
94 */
95 public static boolean isWindowsKeyStore(String storetype) {
96 return storetype.equalsIgnoreCase("Windows-MY")
97 || storetype.equalsIgnoreCase("Windows-ROOT");
98 }
99
100 /**
101 * Returns standard-looking names for storetype
102 */
103 public static String niceStoreTypeName(String storetype) {
104 if (storetype.equalsIgnoreCase("Windows-MY")) {
105 return "Windows-MY";
106 } else if(storetype.equalsIgnoreCase("Windows-ROOT")) {
107 return "Windows-ROOT";
108 } else {
109 return storetype.toUpperCase(Locale.ENGLISH);
110 }
111 }
112
113 /**
114 * Returns the file name of the keystore with the configured CA certificates.
115 */
116 public static String getCacerts() {
117 String sep = File.separator;
|
76 return signedBy(cert, cert);
77 }
78
79 public static boolean signedBy(X509Certificate end, X509Certificate ca) {
80 if (!ca.getSubjectX500Principal().equals(end.getIssuerX500Principal())) {
81 return false;
82 }
83 try {
84 end.verify(ca.getPublicKey());
85 return true;
86 } catch (Exception e) {
87 return false;
88 }
89 }
90
91 /**
92 * Returns true if KeyStore has a password. This is true except for
93 * MSCAPI KeyStores
94 */
95 public static boolean isWindowsKeyStore(String storetype) {
96 return storetype != null
97 && (storetype.equalsIgnoreCase("Windows-MY")
98 || storetype.equalsIgnoreCase("Windows-ROOT"));
99 }
100
101 /**
102 * Returns standard-looking names for storetype
103 */
104 public static String niceStoreTypeName(String storetype) {
105 if (storetype.equalsIgnoreCase("Windows-MY")) {
106 return "Windows-MY";
107 } else if(storetype.equalsIgnoreCase("Windows-ROOT")) {
108 return "Windows-ROOT";
109 } else {
110 return storetype.toUpperCase(Locale.ENGLISH);
111 }
112 }
113
114 /**
115 * Returns the file name of the keystore with the configured CA certificates.
116 */
117 public static String getCacerts() {
118 String sep = File.separator;
|