@Override
public void read(final InputStream inputStream, final String password) throws IOException {
try {
XmlDocument document = XmlDocument.read(inputStream);
XmlElement root = document.getRoot();
String encoding = root.getAttribute(XMLStore.ENCODING_ATTRIBUTE);
XmlElement certificates = root.getElement(XMLStore.CERTIFICATES_ELEMENT);
XmlElement privateKeys = root.getElement(XMLStore.PRIVATE_KEYS_ELEMENT);
XmlElement publicKeys = root.getElement(XMLStore.PUBLIC_KEYS_ELEMENT);
XmlElement secretKeys = root.getElement(XMLStore.SECRET_KEYS_ELEMENT);
for (XmlElement certificateElement : certificates.getElements()) {
String alias = certificateElement.getAttribute(XMLStore.ALIAS_ATTRIBUTE);
Certificate certificate = this.getCertificate(certificateElement, encoding);
this.getCertificateMap().put(alias, certificate);
}
for (XmlElement privateKeyElement : privateKeys.getElements()) {
String alias = privateKeyElement.getAttribute(XMLStore.ALIAS_ATTRIBUTE);
Identity holder = this.getPrivateKey(privateKeyElement, encoding);
this.getPrivateKeyMap().put(alias, holder);
}
for (XmlElement publicKeyElement : publicKeys.getElements()) {
String alias = publicKeyElement.getAttribute(XMLStore.ALIAS_ATTRIBUTE);
PublicKey publicKey = this.getPublicKey(publicKeyElement, encoding);
this.getPublicKeyMap().put(alias, publicKey);
}
for (XmlElement secretKeyElement : secretKeys.getElements()) {
String alias = secretKeyElement.getAttribute(XMLStore.ALIAS_ATTRIBUTE);
SecretKey secretKey = this.getSecretKey(secretKeyElement, encoding);
this.getSecretKeyMap().put(alias, secretKey);
}
} catch (GeneralSecurityException e) {