@Test void testNewKeyStore_from_existing_file() throws UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { val fileName = RandomStringUtils.randomAlphabetic(10); keyStoreFilePath = Paths.get(fileName); val keyStoreType = KeyStoreType.getDefaultType(); val keyStorePassword = RandomStringUtils.randomAscii(12); val privateKeyPassword = RandomStringUtils.randomAlphanumeric(12); val keyStore = KeyStore.builder() .keyStoreFilePath(keyStoreFilePath) .keyStoreType(keyStoreType) .keyStorePassword(keyStorePassword) .build(); val privateKeyEntry = PrivateKeyEntry.builder() .alias(ENTRY_ALIAS) .privateKey(x509Svid.getPrivateKey()) .certificateChain(x509Svid.getChainArray()) .password(privateKeyPassword) .build(); keyStore.storePrivateKeyEntry(privateKeyEntry); KeyStore.builder() .keyStoreFilePath(keyStoreFilePath) .keyStoreType(keyStoreType) .keyStorePassword(keyStorePassword) .build(); }
void storePrivateKeyEntry(final PrivateKeyEntry keyEntry) throws KeyStoreException { javaKeyStore.setKeyEntry( keyEntry.getAlias(), keyEntry.getPrivateKey(), keyEntry.getPassword().toCharArray(), keyEntry.getCertificateChain() ); this.flush(); }
KeyStore { void storePrivateKeyEntry(final PrivateKeyEntry keyEntry) throws KeyStoreException { javaKeyStore.setKeyEntry( keyEntry.getAlias(), keyEntry.getPrivateKey(), keyEntry.getPassword().toCharArray(), keyEntry.getCertificateChain() ); this.flush(); } }
KeyStore { void storePrivateKeyEntry(final PrivateKeyEntry keyEntry) throws KeyStoreException { javaKeyStore.setKeyEntry( keyEntry.getAlias(), keyEntry.getPrivateKey(), keyEntry.getPassword().toCharArray(), keyEntry.getCertificateChain() ); this.flush(); } @Builder  KeyStore(
            @NonNull final Path keyStoreFilePath,
            @NonNull final KeyStoreType keyStoreType,
            @NonNull final String keyStorePassword); }
KeyStore { void storePrivateKeyEntry(final PrivateKeyEntry keyEntry) throws KeyStoreException { javaKeyStore.setKeyEntry( keyEntry.getAlias(), keyEntry.getPrivateKey(), keyEntry.getPassword().toCharArray(), keyEntry.getCertificateChain() ); this.flush(); } @Builder  KeyStore(
            @NonNull final Path keyStoreFilePath,
            @NonNull final KeyStoreType keyStoreType,
            @NonNull final String keyStorePassword);  }
KeyStore { void storePrivateKeyEntry(final PrivateKeyEntry keyEntry) throws KeyStoreException { javaKeyStore.setKeyEntry( keyEntry.getAlias(), keyEntry.getPrivateKey(), keyEntry.getPassword().toCharArray(), keyEntry.getCertificateChain() ); this.flush(); } @Builder  KeyStore(
            @NonNull final Path keyStoreFilePath,
            @NonNull final KeyStoreType keyStoreType,
            @NonNull final String keyStorePassword);   }