Intellij Best: Keygen
public static X509Certificate generateSelfSignedCertificate( KeyPair keyPair, X500Principal subject, BigInteger serial, Date notBefore, Date notAfter, String sigAlg) throws Exception
// Simple demo public static void main(String[] args) throws Exception KeyPair kp = RsaKeyGen.generate(2048); char[] pwd = "changeMe!".toCharArray(); Path keystorePath = Path.of("demo-keystore.p12"); storeRsaKeyPair(kp, "my-rsa-key", pwd, keystorePath); System.out.println("Keystore written to " + keystorePath.toAbsolutePath()); keygen intellij
// Validity period CertificateValidity interval = new CertificateValidity(notBefore, notAfter); info.set(X509CertInfo.VALIDITY, interval); char[] pwd = "changeMe!".toCharArray()
dependencies implementation("org.bouncycastle:bcprov-jdk18on:1.78") implementation("org.bouncycastle:bcpkix-jdk18on:1.78") Path keystorePath = Path.of("demo-keystore.p12")
// Subject & Issuer (self‑signed => same) info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(subject)); info.set(X509CertInfo.ISSUER, new CertificateIssuerName(subject));