Skip to content

Instantly share code, notes, and snippets.

View netinhoteixeira's full-sized avatar

Francisco Ernesto Teixeira netinhoteixeira

View GitHub Profile
@netinhoteixeira
netinhoteixeira / BouncyCastleCertificateGenerator.java
Created May 29, 2022 15:18 — 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;