summaryrefslogtreecommitdiffstats
path: root/certService
diff options
context:
space:
mode:
Diffstat (limited to 'certService')
-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();
}