X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aaf%2Fauthz.git;a=blobdiff_plain;f=auth%2Fauth-certman%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fcm%2Fcert%2FCSRMeta.java;h=e0ee03656b765209a5eadc7f28c70cf1f1dea2cc;hp=f67f445fd3e23d5a6abb81e82bba0b6c1e87957d;hb=be1edcb6830745015f5de72e820f40f36dd571ad;hpb=f727f876191f815a850b89eb501f49bfd6e65c5d diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java index f67f445f..e0ee0365 100644 --- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java +++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -75,7 +75,8 @@ public class CSRMeta { if (name==null) { X500NameBuilder xnb = new X500NameBuilder(); xnb.addRDN(BCStyle.CN,cn); - xnb.addRDN(BCStyle.E,email); + // Add as Subject Alternate Name, email + // xnb.addRDN(BCStyle.E,email); if (mechID!=null) { if (environment==null) { xnb.addRDN(BCStyle.OU,mechID); @@ -90,15 +91,15 @@ public class CSRMeta { } return name; } - - + + public PKCS10CertificationRequest generateCSR(Trans trans) throws IOException, CertException { PKCS10CertificationRequestBuilder builder = new JcaPKCS10CertificationRequestBuilder(x500Name(),keypair(trans).getPublic()); if (challenge!=null) { DERPrintableString password = new DERPrintableString(challenge); builder.addAttribute(PKCSObjectIdentifiers.pkcs_9_at_challengePassword, password); } - + int plus = email==null?0:1; if (!sanList.isEmpty()) { GeneralName[] gna = new GeneralName[sanList.size()+plus]; @@ -107,7 +108,7 @@ public class CSRMeta { gna[++i]=new GeneralName(GeneralName.dNSName,s); } gna[++i]=new GeneralName(GeneralName.rfc822Name,email); - + builder.addAttribute( PKCSObjectIdentifiers.pkcs_9_at_extensionRequest, new Extensions(new Extension[] { @@ -122,7 +123,7 @@ public class CSRMeta { throw new CertException(e); } } - + @SuppressWarnings("deprecation") public static void dump(PKCS10CertificationRequest csr) { Attribute[] certAttributes = csr.getAttributes(); @@ -152,7 +153,7 @@ public class CSRMeta { } } } - + public X509Certificate initialConversationCert(Trans trans) throws CertificateException, OperatorCreationException { GregorianCalendar gc = new GregorianCalendar(); Date start = gc.getTime(); @@ -209,15 +210,15 @@ public class CSRMeta { public void environment(String env) { environment = env; } - + /** - * + * * @return */ public String environment() { return environment; } - + /** * @return the mechID */ @@ -263,5 +264,5 @@ public class CSRMeta { public void challenge(String challenge) { this.challenge = challenge; } - + }