X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-certman%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fcm%2Fca%2FLocalCA.java;fp=auth%2Fauth-certman%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fcm%2Fca%2FLocalCA.java;h=2a3ce537cc9d46bfd265c3d40061ae02cf61c8a5;hb=7e966914050e66219689001ff4ab601a49eef0ac;hp=b7d78f05ee1721946ce2e99f38a8da890061c626;hpb=ead32f193586e39b59bb366bddf70e665173a52d;p=aaf%2Fauthz.git diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java index b7d78f05..2a3ce537 100644 --- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java +++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java @@ -92,55 +92,55 @@ public class LocalCA extends CA { serial = new BigInteger(64,random); - if(params.length<1 || params[0].length<2) { + if (params.length<1 || params[0].length<2) { throw new IOException("LocalCA expects cm_ca.=org.onap.aaf.auth.cm.ca.LocalCA,[;]+"); } // Read in the Private Key String configured; File f = new File(params[0][0]); - if(f.exists() && f.isFile()) { + if (f.exists() && f.isFile()) { String fileName = f.getName(); - if(fileName.endsWith(".key")) { + if (fileName.endsWith(".key")) { caKey = Factory.toPrivateKey(NullTrans.singleton(),f); List frs = new ArrayList<>(params.length-1); try { String dir = access.getProperty(CM_PUBLIC_DIR, ""); - if(!"".equals(dir) && !dir.endsWith("/")) { + if (!"".equals(dir) && !dir.endsWith("/")) { dir = dir + '/'; } String path; - for(int i=1; i; enc:>"); } try { Provider p; KeyStore keyStore; FileInputStream fis = null; - if(fileName.endsWith(".pkcs11")) { + if (fileName.endsWith(".pkcs11")) { String ksType="PKCS11"; p = Factory.getSecurityProvider(ksType,params); keyStore = KeyStore.getInstance(ksType,p); - } else if(fileName.endsWith(".jks")) { + } else if (fileName.endsWith(".jks")) { keyStore = KeyStore.getInstance("JKS"); fis = new FileInputStream(f); - } else if(fileName.endsWith(".p12") || fileName.endsWith(".pkcs12")) { + } else if (fileName.endsWith(".p12") || fileName.endsWith(".pkcs12")) { keyStore = KeyStore.getInstance("PKCS12"); fis = new FileInputStream(f); } else { @@ -151,7 +151,7 @@ public class LocalCA extends CA { try { String pass = access.decrypt(params[0][2]/*encrypted passcode*/, true); - if(pass==null) { + if (pass==null) { throw new CertException("Passcode for " + fileName + " cannot be decrypted."); } char[] ksPass = pass.toCharArray(); @@ -164,12 +164,12 @@ public class LocalCA extends CA { fis.close(); } Entry entry; - if(fileName.endsWith(".pkcs11")) { + if (fileName.endsWith(".pkcs11")) { entry = keyStore.getEntry(params[0][1]/*alias*/, null); } else { entry = keyStore.getEntry(params[0][1]/*alias*/, keyPass); } - if(entry==null) { + if (entry==null) { throw new CertException("There is no Keystore entry with name '" + params[0][1] +'\''); } PrivateKeyEntry privateKeyEntry = (PrivateKeyEntry)entry; @@ -188,7 +188,7 @@ public class LocalCA extends CA { X500NameBuilder xnb = new X500NameBuilder(); List rp = RDN.parse(',', x509cwi.getIssuerDN()); Collections.reverse(rp); - for(RDN rnd : rp) { + for (RDN rnd : rp) { xnb.addRDN(rnd.aoi,rnd.value); } issuer = xnb.build(); @@ -226,7 +226,7 @@ public class LocalCA extends CA { // new SubjectPublicKeyInfo(ASN1Sequence.getInstance(caCert.getPublicKey().getEncoded())) ); List lsan = new ArrayList<>(); - for(String s : csrmeta.sans()) { + for (String s : csrmeta.sans()) { lsan.add(new GeneralName(GeneralName.dNSName,s)); } GeneralName[] sans = new GeneralName[lsan.size()];