AnsweredAssumed Answered

How to add OtherName in the SubjectAlternativeName in CryptoJ 6

Question asked by dptiyrfpwgqwydakpd2xuwcbcrlp2mo4edzbpyp7af0= on Sep 16, 2016

I would like to know the correct way add the OtherName in the SubjectAlternativeName as extensions to the template object below . Also how to extract the other name from subject alternate name using CryptoJ 6.0



X509Certificate pivCert = CertUtils.loadX509Certificate("abc.cer");

X509ExtensionRequestSpec extensions = new X509ExtensionRequestSpec();

Collection<List<?>> subAltNames = pivCert.getSubjectAlternativeNames();

                      Iterator itr = subAltNames.iterator();

                      while (itr.hasNext()) {

                            List list = (List);

                            Integer type = (Integer) list.get(0);

                                  if((type.intValue() == 0) ){

                                   GeneralName name = new GeneralName((byte[])list.get(1));  // As this line throws general name encoding error .

                                    List<GeneralName> generalNames = new ArrayList<GeneralName>();

                                 //How to extract the other name from a subject alternate name of the certificate and add it to another template                                       //extension