Class SelfSignedCertificateGenerator

java.lang.Object
net.targetr.wtm3.net.tls.SelfSignedCertificateGenerator

public class SelfSignedCertificateGenerator extends Object
Generates self signed certificates for TLS.
Author:
Dr Michael Gardiner
  • Constructor Details

    • SelfSignedCertificateGenerator

      public SelfSignedCertificateGenerator()
      Constructs a new SelfSignedCertificateGenerator.
  • Method Details

    • createCertificate

      public static GeneratedCert createCertificate(String commonName, String domain, GeneratedCert issuer, boolean isCA, int expryDays) throws org.bouncycastle.cert.CertIOException, CertificateException, NoSuchAlgorithmException
      Creates a new self-signed or CA-signed certificate.
      Parameters:
      commonName - The CN={name} of the certificate. When the certificate is for a domain it should be the domain name
      domain - Nullable. The DNS domain for the certificate.
      issuer - Issuer who signs this certificate. Null for a self-signed certificate
      isCA - Can this certificate be used to sign other certificates
      expryDays - Days this certificate this is valid
      Returns:
      Newly created certificate with its private key
      Throws:
      org.bouncycastle.cert.CertIOException - if a certificate I/O error occurs
      CertificateException - if a certificate error occurs
      NoSuchAlgorithmException - if a required algorithm is missing