private static X509v3CertificateBuilder initCertBuilder(X500Name issuer, LocalDate notBefore,
    LocalDate notAfter, X500Name subject, PublicKey subjectPublicKey) {
    return new X509v3CertificateBuilder(issuer, new BigInteger(SERIAL_NUMBER_MAX_BITS, PRNG),
      java.sql.Date.valueOf(notBefore), java.sql.Date.valueOf(notAfter), subject,
      SubjectPublicKeyInfo.getInstance(subjectPublicKey.getEncoded()));
  }
Helper method for newSelfSignedCACert() and newCert(). Initializes a X509v3CertificateBuilder
with logic that's common to both methods.
@param issuer           Issuer field of the new cert.
@param notBefore        date before which the new cert is not valid.
@param notAfter         date after which the new cert is not valid.
@param subject          Subject field of the new cert.
@param subjectPublicKey public key to store in the new cert.
@return a X509v3CertificateBuilder that can be further customized to finish creating the new
        cert.
hbase-common/src/test/java/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.java