Class SelfSignedCertificate.Builder

java.lang.Object
io.netty.handler.ssl.util.SelfSignedCertificate.Builder
Enclosing class:
SelfSignedCertificate

public static final class SelfSignedCertificate.Builder extends java.lang.Object
  • Field Details

    • fqdn

      java.lang.String fqdn
    • random

      java.security.SecureRandom random
    • bits

      int bits
    • notBefore

      java.util.Date notBefore
    • notAfter

      java.util.Date notAfter
    • algorithm

      java.lang.String algorithm
    • failure

      java.lang.Throwable failure
    • keypair

      java.security.KeyPair keypair
    • privateKey

      java.security.PrivateKey privateKey
    • paths

      java.lang.String[] paths
  • Constructor Details

    • Builder

      private Builder()
  • Method Details

    • fqdn

      public SelfSignedCertificate.Builder fqdn(java.lang.String fqdn)
      Set the fully-qualified domain name of the certificate that should be generated.
      Parameters:
      fqdn - The FQDN
      Returns:
      This builder
    • random

      public SelfSignedCertificate.Builder random(java.security.SecureRandom random)
      Set the RNG to use for key generation. This setting is not supported by the keytool-based generator.
      Parameters:
      random - The CSPRNG
      Returns:
      This builder
    • bits

      public SelfSignedCertificate.Builder bits(int bits)
      Set the key size.
      Parameters:
      bits - The key size
      Returns:
      This builder
    • notBefore

      public SelfSignedCertificate.Builder notBefore(java.util.Date notBefore)
      Set the start of the certificate validity period.
      Parameters:
      notBefore - The start date
      Returns:
      This builder
    • notAfter

      public SelfSignedCertificate.Builder notAfter(java.util.Date notAfter)
      Set the end of the certificate validity period.
      Parameters:
      notAfter - The start date
      Returns:
      This builder
    • algorithm

      public SelfSignedCertificate.Builder algorithm(java.lang.String algorithm)
      Set the key algorithm. Only RSA and EC are supported.
      Parameters:
      algorithm - The key algorithm
      Returns:
      This builder
    • randomOrDefault

      private java.security.SecureRandom randomOrDefault()
    • generateKeyPairLocally

      private void generateKeyPairLocally()
    • addFailure

      private void addFailure(java.lang.Throwable t)
    • generateBc

      boolean generateBc()
    • generateKeytool

      boolean generateKeytool()
    • generateCertificateBuilder

      boolean generateCertificateBuilder()
    • generateSunMiscSecurity

      boolean generateSunMiscSecurity()
    • build

      public SelfSignedCertificate build() throws java.security.cert.CertificateException
      Build the certificate. This builder must not be used again after this method is called.
      Returns:
      The certificate
      Throws:
      java.security.cert.CertificateException - If generation fails