Home / Class/ CertificateBuilder Class — netty Architecture

CertificateBuilder Class — netty Architecture

Architecture documentation for the CertificateBuilder class in CertificateBuilder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4aeffc80_93f6_788a_f8c6_901cee3b8997["CertificateBuilder"]
  5f01b946_c84e_64ab_9bff_c20e1d44105f["CertificateBuilder.java"]
  4aeffc80_93f6_788a_f8c6_901cee3b8997 -->|defined in| 5f01b946_c84e_64ab_9bff_c20e1d44105f
  ed389979_8fbe_f00e_ebcd_801a08dd2149["CertificateBuilder()"]
  4aeffc80_93f6_788a_f8c6_901cee3b8997 -->|method| ed389979_8fbe_f00e_ebcd_801a08dd2149
  9b75bebe_dc8c_ed87_dffb_5dd2fde050c1["X509Bundle()"]
  4aeffc80_93f6_788a_f8c6_901cee3b8997 -->|method| 9b75bebe_dc8c_ed87_dffb_5dd2fde050c1
  77b332f9_dcd9_f4b6_a769_4e6222101897["String()"]
  4aeffc80_93f6_788a_f8c6_901cee3b8997 -->|method| 77b332f9_dcd9_f4b6_a769_4e6222101897
  92ddc979_29c3_bea7_2a06_8e5cd6aa75aa["KeyPair()"]
  4aeffc80_93f6_788a_f8c6_901cee3b8997 -->|method| 92ddc979_29c3_bea7_2a06_8e5cd6aa75aa
  9a104d66_79c8_861e_9dfd_0b988e39aa69["V3TBSCertificateGenerator()"]
  4aeffc80_93f6_788a_f8c6_901cee3b8997 -->|method| 9a104d66_79c8_861e_9dfd_0b988e39aa69
  7f0492f6_2e60_9417_a2b0_f833730fbeeb["tbsCertToBytes()"]
  4aeffc80_93f6_788a_f8c6_901cee3b8997 -->|method| 7f0492f6_2e60_9417_a2b0_f833730fbeeb
  6a488aa9_c998_c3d5_e687_7299654e796d["SecureRandom()"]
  4aeffc80_93f6_788a_f8c6_901cee3b8997 -->|method| 6a488aa9_c998_c3d5_e687_7299654e796d
  289e8fd2_3516_bf8c_5bc7_04d3ee513ffc["addExtensions()"]
  4aeffc80_93f6_788a_f8c6_901cee3b8997 -->|method| 289e8fd2_3516_bf8c_5bc7_04d3ee513ffc

Relationship Graph

Source Code

pkitesting/src/main/java/io/netty/pkitesting/CertificateBuilder.java lines 106–1339

public final class CertificateBuilder {

    static final String OID_X509_NAME_CONSTRAINTS = "2.5.29.30";
    static final String OID_PKIX_KP = "1.3.6.1.5.5.7.3";
    static final String OID_PKIX_KP_SERVER_AUTH = OID_PKIX_KP + ".1";
    static final String OID_PKIX_KP_CLIENT_AUTH = OID_PKIX_KP + ".2";
    static final String OID_PKIX_KP_CODE_SIGNING = OID_PKIX_KP + ".3";
    static final String OID_PKIX_KP_EMAIL_PROTECTION = OID_PKIX_KP + ".4";
    static final String OID_PKIX_KP_TIME_STAMPING = OID_PKIX_KP + ".8";
    static final String OID_PKIX_KP_OCSP_SIGNING = OID_PKIX_KP + ".9";
    static final String OID_KERBEROS_KEY_PURPOSE_CLIENT_AUTH = "1.3.6.1.5.2.3.4";
    static final String OID_MICROSOFT_SMARTCARD_LOGIN = "1.3.6.1.4.1.311.20.2.2";
    private static final GeneralName[] EMPTY_GENERAL_NAMES = new GeneralName[0];
    private static final DistributionPoint[] EMPTY_DIST_POINTS = new DistributionPoint[0];
    private static final AlgorithmParameterSpec UNSUPPORTED_SPEC = new AlgorithmParameterSpec() {
    };
    private static final String UNSUPPORTED_SIGN = "UNSUPPORTED_SIGN";

    Provider provider;
    SecureRandom random;
    Algorithm algorithm = Algorithm.ecp256;
    Instant notBefore = Instant.now().minus(1, ChronoUnit.DAYS);
    Instant notAfter = Instant.now().plus(1, ChronoUnit.DAYS);
    List<BuilderCallback> modifierCallbacks = new ArrayList<>();
    List<GeneralName> subjectAlternativeNames = new ArrayList<>();
    List<DistributionPoint> crlDistributionPoints = new ArrayList<>();
    BigInteger serial;
    X500Principal subject;
    boolean isCertificateAuthority;
    OptionalInt pathLengthConstraint = OptionalInt.empty();
    KeyPair keyPair;
    Set<String> extendedKeyUsage = new TreeSet<>();
    Extension keyUsage;

    /**
     * Create a new certificate builder with a default configuration.
     * Unless specified otherwise, the builder will produce bundles that use the
     * {@linkplain Algorithm#ecp256 NIST EC-P 256} key algorithm,
     * and the certificates will be valid as of yesterday and expire tomorrow.
     */
    public CertificateBuilder() {
    }

    /**
     * Produce a copy of the current state in this certificate builder.
     * @return A copy of this certificate builder.
     */
    public CertificateBuilder copy() {
        CertificateBuilder copy = new CertificateBuilder();
        copy.random = random;
        copy.algorithm = algorithm;
        copy.notBefore = notBefore;
        copy.notAfter = notAfter;
        copy.modifierCallbacks = new ArrayList<>(modifierCallbacks);
        copy.subjectAlternativeNames = new ArrayList<>(subjectAlternativeNames);
        copy.crlDistributionPoints = new ArrayList<>(crlDistributionPoints);
        copy.serial = serial;
        copy.subject = subject;
        copy.isCertificateAuthority = isCertificateAuthority;
        copy.pathLengthConstraint = pathLengthConstraint;
        copy.keyPair = keyPair;
        copy.keyUsage = keyUsage;
        copy.extendedKeyUsage = new TreeSet<>(extendedKeyUsage);
        copy.provider = provider;
        return copy;
    }

    /**
     * Set the {@link Provider} instance to use when generating keys.
     * @param provider The provider instance to use.
     * @return This certificate builder.
     */
    public CertificateBuilder provider(Provider provider) {
        this.provider = provider;
        return this;
    }

    /**
     * Set the {@link SecureRandom} instance to use when generating keys.
     * @param secureRandom The secure random instance to use.
     * @return This certificate builder.

Frequently Asked Questions

What is the CertificateBuilder class?
CertificateBuilder is a class in the netty codebase, defined in pkitesting/src/main/java/io/netty/pkitesting/CertificateBuilder.java.
Where is CertificateBuilder defined?
CertificateBuilder is defined in pkitesting/src/main/java/io/netty/pkitesting/CertificateBuilder.java at line 106.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free