List of utility methods to do Key Create
KeyStore | getKeyStore(File keystore) get Key Store KeyStore keystore_client = KeyStore.getInstance("JKS"); keystore_client.load(keystore != null ? new FileInputStream(keystore) : null, null); return keystore_client; |
KeyStore | getKeyStore(File keyStore) get Key Store KeyStore ks; try (InputStream is = new FileInputStream(keyStore)) { ks = KeyStore.getInstance("PKCS12"); ks.load(is, "ballerina".toCharArray()); return ks; |
KeyStore | getKeyStore(final URL url, final String password) Return the KeyStore by given URL and password if (url == null) { throw new IllegalArgumentException("Keystore url may not be null"); KeyStore keystore = KeyStore.getInstance("jks"); InputStream is = null; try { is = url.openStream(); keystore.load(is, password != null ? password.toCharArray() : null); ... |
KeyStore | getKeyStore(InputStream ksStream, char[] storePass) Get the Key Store Note: This method wants the InputStream to be not null. if (ksStream == null) throw new IllegalArgumentException("InputStream for the KeyStore is null"); KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(ksStream, storePass); return ks; |
KeyStore | getKeyStore(String file_name, char[] storepass) get Key Store FileInputStream in = new FileInputStream(file_name); KeyStore ks; try { ks = KeyStore.getInstance("IAIKKeyStore", "IAIK"); } catch (java.security.NoSuchProviderException ex) { System.err.println(ex.toString()); ks = KeyStore.getInstance("jks"); ks.load(in, storepass); in.close(); return ks; |
KeyStore | getKeyStore(String filename, char[] password) get Key Store try { KeyStore result = KeyStore.getInstance(KeyStore.getDefaultType()); FileInputStream in = new FileInputStream(filename); result.load(in, password); in.close(); return result; } catch (IOException ex) { throw new GeneralSecurityException(ex.getMessage(), ex); ... |
KeyStore | getKeyStore(String filename, String password) Get a KeyStore object given the keystore filename and password. KeyStore result = KeyStore.getInstance(KeyStore.getDefaultType()); try { FileInputStream in = new FileInputStream(filename); result.load(in, password.toCharArray()); in.close(); } catch (Exception ex) { System.out.println("Failed to read keystore:"); ex.printStackTrace(); ... |
KeyStore | getKeyStore(String keyStoreName, String password) get Key Store KeyStore ks = null; FileInputStream fis = null; try { ks = KeyStore.getInstance("JKS"); char[] passwordArray = password.toCharArray(); fis = new java.io.FileInputStream(keyStoreName); ks.load(fis, passwordArray); fis.close(); ... |
KeyStore | getKeyStore(String keystorePath, String keystorePassword) get Key Store try { KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); keystore.load(new FileInputStream(keystorePath), keystorePassword.toCharArray()); return keystore; } catch (KeyStoreException | CertificateException | NoSuchAlgorithmException | IOException e) { e.printStackTrace(); return null; ... |
KeyStore | getKeyStore(String keyStorePath, String password) get Key Store FileInputStream is = new FileInputStream(keyStorePath); KeyStore ks = KeyStore.getInstance(KEY_STORE); ks.load(is, password.toCharArray()); is.close(); return ks; |