Skip to content

Commit

Permalink
workaround for java 1.8+ [closes #21]
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrandes committed Nov 1, 2017
1 parent 5df3d46 commit e3857b4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/org/javastack/bouncer/KeyGenerator.java
Expand Up @@ -114,8 +114,14 @@ static X509Certificate generateCertificate(String dn, KeyPair pair, int days, St
final AlgorithmId algo = AlgorithmId.get(algName);
info.set(X509CertInfo.VALIDITY, interval);
info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(sn));
info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(owner));
info.set(X509CertInfo.ISSUER, new CertificateIssuerName(owner));
try {
info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(owner));
info.set(X509CertInfo.ISSUER, new CertificateIssuerName(owner));
} catch (Exception e) {
// Ugly workaround for Java 1.8 [issue #21]
info.set(X509CertInfo.SUBJECT, owner);
info.set(X509CertInfo.ISSUER, owner);
}
info.set(X509CertInfo.KEY, new CertificateX509Key(pair.getPublic()));
info.set(X509CertInfo.VERSION, new CertificateVersion(CertificateVersion.V3));
info.set(X509CertInfo.ALGORITHM_ID, new CertificateAlgorithmId(algo));
Expand Down

0 comments on commit e3857b4

Please sign in to comment.