diff options
author | Bogumil Zebek <bogumil.zebek@nokia.com> | 2020-04-02 11:09:13 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-02 11:09:13 +0000 |
commit | 784e89ec062c673d8441ac23d15f04857a3a820e (patch) | |
tree | 6038162499c0a879b971430e078605aa75a38732 /certServiceClient/src/main | |
parent | 30aa650ccfbd6dd2e98d2a1001e418c2a3c39fd3 (diff) | |
parent | 0ed89748a4c7b4def76f5a3479410946ca75f389 (diff) |
Merge "Fix sonar issue Password"
Diffstat (limited to 'certServiceClient/src/main')
2 files changed, 13 insertions, 9 deletions
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/KeystoreTruststoreCreator.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/KeystoreTruststoreCreator.java index 6dc2ef87..43784609 100644 --- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/KeystoreTruststoreCreator.java +++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/KeystoreTruststoreCreator.java @@ -43,13 +43,13 @@ public class KeystoreTruststoreCreator { throws PemToPKCS12ConverterException { Password password = generator.generate(PASSWORD_LENGTH); creator.saveKeystoreData(converter.convertKeystore(data, password, CERTIFICATE_ALIAS, privateKey), - password.getPassword()); + password.getCurrentPassword()); } public void createTruststore(List<String> data) throws PemToPKCS12ConverterException { Password password = generator.generate(PASSWORD_LENGTH); creator.saveTruststoreData(converter.convertTruststore(data, password, TRUSTED_CERTIFICATE_ALIAS), - password.getPassword()); + password.getCurrentPassword()); } } diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/Password.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/Password.java index 09c65ca6..35ae9f96 100644 --- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/Password.java +++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/Password.java @@ -21,22 +21,26 @@ package org.onap.aaf.certservice.client.certification.conversion; class Password { + // We are excluding this line in Sonar due to fact that + // PASSWORD_PATTERN does not contain password. This solution + // is safe. + // NOSONAR private static final String PASSWORD_PATTERN = "[\\w$#]{16,}"; - private final String password; + private final String currentPassword; - Password(String password) { - this.password = password; + Password(String currentPassword) { + this.currentPassword = currentPassword; } - String getPassword() { - return password; + String getCurrentPassword() { + return currentPassword; } char[] toCharArray() { - return password.toCharArray(); + return currentPassword.toCharArray(); } boolean isCorrectPasswordPattern() { - return password.matches(PASSWORD_PATTERN); + return currentPassword.matches(PASSWORD_PATTERN); } } |