aboutsummaryrefslogtreecommitdiffstats
path: root/certService/src
diff options
context:
space:
mode:
authorMichal Banka <michal.banka@nokia.com>2020-02-28 16:49:52 +0100
committerMichał Bańka <michal.banka@nokia.com>2020-03-11 11:02:33 +0000
commitc9639b32eeefdc1ec028bcbfc6ca2e8474042eb1 (patch)
treed1cf666397a550ec195729586231f7bdb26d4e20 /certService/src
parent0855846bc0ab2dcdadc5ef7ed9588f70124ce21e (diff)
Fixed sonar issues in Factory class
Signed-off-by: Michal Banka <michal.banka@nokia.com> Change-Id: Idde6d2d79d13d25427a8d3e516945e2fb3a7bafa Issue-ID: AAF-997
Diffstat (limited to 'certService/src')
-rw-r--r--certService/src/main/java/org/onap/aaf/certservice/cmpv2client/external/Factory.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/certService/src/main/java/org/onap/aaf/certservice/cmpv2client/external/Factory.java b/certService/src/main/java/org/onap/aaf/certservice/cmpv2client/external/Factory.java
index 7072abfd..e570f9ab 100644
--- a/certService/src/main/java/org/onap/aaf/certservice/cmpv2client/external/Factory.java
+++ b/certService/src/main/java/org/onap/aaf/certservice/cmpv2client/external/Factory.java
@@ -1,4 +1,4 @@
-/**
+/*
* ============LICENSE_START====================================================
* org.onap.aaf
* ===========================================================================
@@ -22,6 +22,9 @@
*/
package org.onap.aaf.certservice.cmpv2client.external;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
@@ -29,25 +32,27 @@ import java.security.SecureRandom;
public class Factory {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Factory.class);
private static final KeyPairGenerator keygen;
private static final SecureRandom random;
- private static final String KEY_ALGO = "RSA";
+ private static final String KEY_ALGORITHM = "RSA";
private static final int KEY_LENGTH = 2048;
- private static final int SUB = 0x08;
static {
random = new SecureRandom();
KeyPairGenerator tempKeygen;
try {
- tempKeygen = KeyPairGenerator.getInstance(KEY_ALGO); // ,"BC");
+ tempKeygen = KeyPairGenerator.getInstance(KEY_ALGORITHM);
tempKeygen.initialize(KEY_LENGTH, random);
} catch (NoSuchAlgorithmException e) {
tempKeygen = null;
- e.printStackTrace(System.err);
+ LOGGER.error("Given KEY_ALGORITHM is invalid.", e);
}
keygen = tempKeygen;
}
+ private Factory() { }
+
public static KeyPair generateKeyPair() {
return keygen.generateKeyPair();
}