From b9987c22958fff0cedd434daac4d0d6693d38fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20M=C3=BCltin?= Date: Sun, 6 Nov 2016 18:59:20 +0900 Subject: [PATCH] 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. --- .../java/org/eclipse/risev2g/shared/utils/SecurityUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/RISE-V2G-Shared/src/main/java/org/eclipse/risev2g/shared/utils/SecurityUtils.java b/RISE-V2G-Shared/src/main/java/org/eclipse/risev2g/shared/utils/SecurityUtils.java index fc2efe2..cabd8c1 100644 --- a/RISE-V2G-Shared/src/main/java/org/eclipse/risev2g/shared/utils/SecurityUtils.java +++ b/RISE-V2G-Shared/src/main/java/org/eclipse/risev2g/shared/utils/SecurityUtils.java @@ -763,7 +763,7 @@ public final class SecurityUtils { */ public static SignedInfoType getSignedInfo(HashMap 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) {