@Override
public KeyStore toKeyStore() {
JCAStore jcaStore = new JCAStore(KeyStoreType.JKS);
for (Entry<String, Certificate> entry : this.certificateMap.entrySet()) {
jcaStore.add(new CertificateEntry(new Alias(entry.getKey()), entry.getValue()));
}
for (Entry<String, Identity> entry : this.privateKeyMap.entrySet()) {
jcaStore.add(new PrivateKeyEntry(new Alias(entry.getKey()), entry.getValue().getPrivateKey(), entry.getValue().getChain()));
}
for (Entry<String, PublicKey> entry : this.publicKeyMap.entrySet()) {
jcaStore.add(new PublicKeyEntry(new Alias(entry.getKey()), entry.getValue()));
}
for (Entry<String, SecretKey> entry : this.secretKeyMap.entrySet()) {
jcaStore.add(new SecretKeyEntry(new Alias(entry.getKey()), entry.getValue()));
}
return jcaStore.toKeyStore();
}