http, , .
keystore = KeyStore.getInstance( "JKS" ), .
, ( ),
"keystore" = > , = > KeyStore.getInstance( "PKCS12" )
, , , . Keystores , . keystore.store(OutPutstream, password)..
, , :
@Entity
public class MyKeyStoreClass {
private Long id;
@Transient
private KeyStore keystore;
private String passwordForKeyStore;
private Byte[] keyStoreAsBytes;
@PreUpdate
@PrePersist
public void concertKeyStoreToBytes() {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
keystore.store(byteArrayOutputStream,
passwordForKeyStore.toCharArray());
keyStoreAsBytes = byteArrayOutputStream.toByteArray();
}
@PostLoad
public void getKeyStore() {
if (keystore == null && keyStoreAsBytes != null) {
keyStore = KeyStore.getInstance(getKeystoreType().getType());
keyStore.load(new ByteArrayInputStream(keystoreAsBytes), passwordForKeyStore.toCharArray());
}
}
100% , , . , , , ;)