Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,15 @@ public static X509Certificate generateCertificate(String dn, KeyPair pair, int d
KeyPair keyPair = pair;
X509V3CertificateGenerator certGen = new X509V3CertificateGenerator();

String hostName = InetAddress.getLocalHost().getHostName();
String hostAddress = InetAddress.getLocalHost().getHostAddress();
certGen.addExtension(X509Extensions.SubjectAlternativeName, false,
new GeneralNames(new GeneralName[] { new GeneralName(GeneralName.iPAddress, hostAddress),
new GeneralName(GeneralName.dNSName, "localhost") }));
new GeneralNames(new GeneralName[] {
new GeneralName(GeneralName.iPAddress, hostAddress),
new GeneralName(GeneralName.dNSName, hostName),
new GeneralName(GeneralName.dNSName, "localhost")
})
);
X500Principal dnName = new X500Principal(dn);

certGen.setSerialNumber(sn);
Expand Down