瀏覽代碼

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.

Marc Mültin 9 年之前
父節點
當前提交
b9987c2295
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      RISE-V2G-Shared/src/main/java/org/eclipse/risev2g/shared/utils/SecurityUtils.java

+ 3 - 2
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<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) {