I use BouncyCastle to generate certificats. Now I want to add some SubjectAlternativeName
, just like:
...
ArrayList namesList = new ArrayList();
namesList.add(new GeneralName(GeneralName.dNSName, "*.test"));
namesList.add(new GeneralName(GeneralName.iPAddress, "127.0.0.1"));
namesList.add(new GeneralName(GeneralName.rfc822Name, "zoltar@spkac.spectra.org"));
GeneralNames subjectAltNames = new GeneralNames(new DERSequence((GeneralName[])namesList.toArray(new GeneralName [] {})));
new_cert.addExtension(X509Extensions.SubjectAlternativeName, false, subjectAltNames);
...
Program executes without exception, but then I cannot see "IP Address". With openssl
I see:
...
DNS:*.test, IP Address:<invalid>, email:zoltar@spkac.spectra.org
...
What is the correct form of IP address in call of GeneralName(GeneralName.iPAddress, ...))
?