Skip to content

Instantly share code, notes, and snippets.

View krpors's full-sized avatar
🇺🇦

Kevin Pors krpors

🇺🇦
View GitHub Profile
@krpors
krpors / BouncyCastleCertificateGenerator.java
Created September 21, 2021 10:10 — forked from vivekkr12/BouncyCastleCertificateGenerator.java
Generate root X509Certificate, Sign a Certificate from the root certificate by generating a CSR (Certificate Signing Request) and save the certificates to a keystore using BouncyCastle 1.5x
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x509.BasicConstraints;
import org.bouncycastle.asn1.x509.Extension;
import org.bouncycastle.asn1.x509.GeneralName;
import org.bouncycastle.asn1.x509.KeyUsage;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.X509v3CertificateBuilder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;