Class TestSslUtils.CertificateBuilder

java.lang.Object
org.apache.kafka.test.TestSslUtils.CertificateBuilder
Enclosing class:
TestSslUtils

public static class TestSslUtils.CertificateBuilder extends Object
  • Constructor Details

    • CertificateBuilder

      public CertificateBuilder()
    • CertificateBuilder

      public CertificateBuilder(int days, String algorithm)
  • Method Details

    • sanDnsNames

      public TestSslUtils.CertificateBuilder sanDnsNames(String... hostNames) throws IOException
      Throws:
      IOException
    • algorithm

      public TestSslUtils.CertificateBuilder algorithm(String algorithm)
    • days

      public TestSslUtils.CertificateBuilder days(int days)
    • sanRaw

      public TestSslUtils.CertificateBuilder sanRaw(byte[] rawSan) throws IOException
      Throws:
      IOException
    • sanIpAddress

      public TestSslUtils.CertificateBuilder sanIpAddress(InetAddress hostAddress) throws IOException
      Throws:
      IOException
    • sanUris

      public TestSslUtils.CertificateBuilder sanUris(String... uris) throws IOException
      Throws:
      IOException
    • generate

      public X509Certificate generate(String dn, KeyPair keyPair) throws CertificateException
      Throws:
      CertificateException
    • generate

      public X509Certificate generate(String commonName, String org, boolean utf8, KeyPair keyPair) throws CertificateException
      Throws:
      CertificateException
    • generate

      public X509Certificate generate(org.bouncycastle.asn1.x500.X500Name dn, KeyPair keyPair) throws CertificateException
      Throws:
      CertificateException
    • generateSignedCertificate

      public X509Certificate generateSignedCertificate(String dn, KeyPair keyPair, int daysBeforeNow, int daysAfterNow, String issuer, KeyPair parentKeyPair, boolean isCA, boolean isServerCert, boolean isClientCert) throws CertificateException
      Parameters:
      dn - The distinguished name to use
      keyPair - A key pair to use
      daysBeforeNow - how many days before now the Certificate is valid for
      daysAfterNow - how many days from now the Certificate is valid for
      issuer - The issuer name. if null, "dn" is used
      parentKeyPair - The parent key pair used to sign this certificate. If null, create self-signed certificate authority (CA)
      Returns:
      A (self-) signed certificate
      Throws:
      CertificateException
    • generateSignedCertificateMilliUnit

      public X509Certificate generateSignedCertificateMilliUnit(String dn, KeyPair keyPair, long millisBeforeNow, long millisAfterNow, String issuer, KeyPair parentKeyPair, boolean isCA, boolean isServerCert, boolean isClientCert) throws CertificateException
      Parameters:
      dn - The distinguished name to use
      keyPair - A key pair to use
      millisBeforeNow - how many milliseconds before now the Certificate is valid for
      millisAfterNow - how many milliseconds from now the Certificate is valid for
      issuer - The issuer name. if null, "dn" is used
      parentKeyPair - The parent key pair used to sign this certificate. If null, create self-signed certificate authority (CA)
      Returns:
      A (self-) signed certificate
      Throws:
      CertificateException
    • generateSignedCertificate

      public X509Certificate generateSignedCertificate(org.bouncycastle.asn1.x500.X500Name dn, KeyPair keyPair, int daysBeforeNow, int daysAfterNow, org.bouncycastle.asn1.x500.X500Name issuer, KeyPair parentKeyPair, boolean isCA, boolean isServerCert, boolean isClientCert) throws CertificateException
      Parameters:
      dn - The distinguished name to use
      keyPair - A key pair to use
      daysBeforeNow - how many days before now the Certificate is valid for
      daysAfterNow - how many days from now the Certificate is valid for
      issuer - The issuer name. if null, "dn" is used
      parentKeyPair - The parent key pair used to sign this certificate. If null, create self-signed certificate authority (CA)
      Returns:
      A (self-) signed certificate
      Throws:
      CertificateException
    • generateSignedCertificateMilliUnit

      public X509Certificate generateSignedCertificateMilliUnit(org.bouncycastle.asn1.x500.X500Name dn, KeyPair keyPair, long millisBeforeNow, long millisAfterNow, org.bouncycastle.asn1.x500.X500Name issuer, KeyPair parentKeyPair, boolean isCA, boolean isServerCert, boolean isClientCert) throws CertificateException
      Parameters:
      dn - The distinguished name to use
      keyPair - A key pair to use
      millisBeforeNow - how many milliseconds before now the Certificate is valid for
      millisAfterNow - how many milliseconds from now the Certificate is valid for
      issuer - The issuer name. if null, "dn" is used
      parentKeyPair - The parent key pair used to sign this certificate. If null, create self-signed certificate authority (CA)
      Returns:
      A (self-) signed certificate
      Throws:
      CertificateException