diff options
Diffstat (limited to 'certService/src')
3 files changed, 10 insertions, 17 deletions
diff --git a/certService/src/main/java/org/onap/aaf/certservice/api/ReloadConfigController.java b/certService/src/main/java/org/onap/aaf/certservice/api/ReloadConfigController.java index b6673ce2..c52cf4f2 100644 --- a/certService/src/main/java/org/onap/aaf/certservice/api/ReloadConfigController.java +++ b/certService/src/main/java/org/onap/aaf/certservice/api/ReloadConfigController.java @@ -29,8 +29,6 @@ import io.swagger.v3.oas.annotations.tags.Tag; import org.onap.aaf.certservice.certification.configuration.CmpServersConfig; import org.onap.aaf.certservice.certification.configuration.CmpServersConfigLoadingException; import org.onap.aaf.certservice.certification.exception.ErrorResponseModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -41,8 +39,6 @@ import org.springframework.web.bind.annotation.RestController; @Tag(name = "CertificationService") public class ReloadConfigController { - private static final Logger LOGGER = LoggerFactory.getLogger(ReloadConfigController.class); - private final CmpServersConfig cmpServersConfig; @Autowired diff --git a/certService/src/main/java/org/onap/aaf/certservice/certification/CertificationModelFactory.java b/certService/src/main/java/org/onap/aaf/certservice/certification/CertificationModelFactory.java index 1d586c17..73661a0b 100644 --- a/certService/src/main/java/org/onap/aaf/certservice/certification/CertificationModelFactory.java +++ b/certService/src/main/java/org/onap/aaf/certservice/certification/CertificationModelFactory.java @@ -23,7 +23,6 @@ package org.onap.aaf.certservice.certification; import org.onap.aaf.certservice.certification.configuration.Cmpv2ServerProvider; import org.onap.aaf.certservice.certification.configuration.model.Cmpv2Server; import org.onap.aaf.certservice.certification.exception.Cmpv2ClientAdapterException; -import org.onap.aaf.certservice.certification.exception.Cmpv2ServerNotFoundException; import org.onap.aaf.certservice.certification.exception.DecryptionException; import org.onap.aaf.certservice.certification.model.CertificationModel; import org.onap.aaf.certservice.certification.model.CsrModel; @@ -33,13 +32,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Arrays; - -import static org.onap.aaf.certservice.certification.CertificationData.CA_CERT; -import static org.onap.aaf.certservice.certification.CertificationData.ENTITY_CERT; -import static org.onap.aaf.certservice.certification.CertificationData.INTERMEDIATE_CERT; -import static org.onap.aaf.certservice.certification.CertificationData.EXTRA_CA_CERT; - @Service public class CertificationModelFactory { 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(); } |