Fixed typo in line 832 of SecurityUtils.java which prevented the contract certificate to be saved. This typo probably remained from a negative test and should not have made its way to the public repo. Anyway, is fixed now.

Added logger message in case the private key for the contract certificate to be saved is not valid.
This commit is contained in:
Marc Mültin 2016-11-06 18:59:20 +09:00
parent 258af9b5ac
commit b9987c2295
1 changed files with 3 additions and 2 deletions

View File

@ -763,7 +763,7 @@ public final class SecurityUtils {
*/
public static SignedInfoType getSignedInfo(HashMap<String, byte[]> xmlSignatureRefElements) {
/*
* According to requirement [V2G2-771] in ISO/IEC 15118-2 the following messages elements of the
* According to requirement [V2G2-771] in ISO/IEC 15118-2 the following message elements of the
* XML signature framework shall not be used:
* - Id (attribute in SignedInfo)
* - ##any in SignedInfo CanonicalizationMethod
@ -829,7 +829,7 @@ public final class SecurityUtils {
KeyStore keyStore = getKeyStore(GlobalValues.EVCC_KEYSTORE_FILEPATH.toString(), keyStorePassword);
try {
if (!isPrivateKeyValid(contractCertPrivateKey, contractCertChain)) {
if (isPrivateKeyValid(contractCertPrivateKey, contractCertChain)) {
keyStore.setKeyEntry(
GlobalValues.ALIAS_CONTRACT_CERTIFICATE.toString(),
contractCertPrivateKey,
@ -848,6 +848,7 @@ public final class SecurityUtils {
"Valid until " + contractCert.getNotAfter()
);
} else {
getLogger().error("Private key for contract certificate is not valid");
return false;
}
} catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException | NullPointerException e) {