Skip to content

Commit

Permalink
Apply suggestion from Jesse
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlatombe committed Oct 10, 2024
1 parent 40bfc04 commit da7a566
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/main/java/jenkins/test/https/SelfSignedCertificates.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x509.BasicConstraints;
Expand Down Expand Up @@ -146,9 +145,7 @@ public static CertificateKeyPair createUserCert(String dnsName, CertificateKeyPa
keyPair.getPublic());
builder.addExtension(Extension.keyUsage, true, new KeyUsage(KeyUsage.digitalSignature));
builder.addExtension(Extension.basicConstraints, false, new BasicConstraints(false));
var altNames = List.of(new GeneralName(GeneralName.dNSName, dnsName));
var subjectAltNames = GeneralNames.getInstance(new DERSequence(altNames.toArray(new GeneralName[0])));
builder.addExtension(Extension.subjectAlternativeName, false, subjectAltNames);
builder.addExtension(Extension.subjectAlternativeName, false, GeneralNames.getInstance(new DERSequence(new GeneralName(GeneralName.dNSName, dnsName))));
return new CertificateKeyPair(
keyPair,
new JcaX509CertificateConverter().getCertificate(builder.build(newContentSigner(issuer.keyPair()))));
Expand Down

0 comments on commit da7a566

Please sign in to comment.