List of utility methods to do Key Create
KeyStore | getKeyStore(String ksType, String file, String ksPassword) get Key Store String type = ksType != null ? ksType : KeyStore.getDefaultType(); char[] password = ksPassword != null ? ksPassword.toCharArray() : null; KeyStore keyStore = KeyStore.getInstance(type); keyStore.load(new FileInputStream(file), password); return keyStore; |
KeyStore | getKeyStore(String path, String passwd, String storeType) get Key Store try { InputStream fis = new FileInputStream(path); KeyStore store = KeyStore.getInstance(storeType); store.load(fis, passwd.toCharArray()); return store; } catch (Exception e) { throw new RuntimeException(e); |
KeyStore | getKeyStoreFromFile(String filePath, char[] password) get Key Store From File KeyStore store = KeyStore.getInstance("JKS"); store.load(new FileInputStream(filePath), password); return store; |
KeyStore | getKeyStoreFromFile(String keystoreName, String password, String home) Read Keystore from the file identified by given keystorename, password Path tenantKeystorePath = Paths.get(home, "repository", "resources", "security", keystoreName); FileInputStream file = new FileInputStream(tenantKeystorePath.toString()); KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); keystore.load(file, password.toCharArray()); return keystore; |
SortedSet | getKeyStores() Returns array of supported KeyStores final Set<String> tmpKeyStores = java.security.Security.getAlgorithms("KeyStore"); return new TreeSet<String>(tmpKeyStores); |
String | getKeyString(Key key) get Key String byte[] keyBytes = key.getEncoded(); String s = (new BASE64Encoder()).encode(keyBytes); return s; |
String | getKeyString(Key key) get Key String byte[] keyBytes = key.getEncoded(); return (new BASE64Encoder()).encode(keyBytes); |