public static final class HeldCertificate.Builder extends Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
HeldCertificate.Builder |
addSubjectAlternativeName(String altName)
Adds a subject alternative name (SAN) to the certificate.
|
HeldCertificate |
build() |
HeldCertificate.Builder |
certificateAuthority(int maxIntermediateCas)
Set this certificate to be a signing certificate, with up to
maxIntermediateCas
intermediate signing certificates beneath it. |
HeldCertificate.Builder |
commonName(String cn)
Set this certificate's common name (CN).
|
HeldCertificate.Builder |
duration(long duration,
TimeUnit unit)
Sets the certificate to be valid immediately and until the specified duration has elapsed.
|
HeldCertificate.Builder |
ecdsa256()
Configure the certificate to generate a 256-bit ECDSA key, which provides about 128 bits of
security.
|
HeldCertificate.Builder |
keyPair(KeyPair keyPair)
Sets the public/private key pair used for this certificate.
|
HeldCertificate.Builder |
keyPair(PublicKey publicKey,
PrivateKey privateKey)
Sets the public/private key pair used for this certificate.
|
HeldCertificate.Builder |
organizationalUnit(String ou)
Sets the certificate's organizational unit (OU).
|
HeldCertificate.Builder |
rsa2048()
Configure the certificate to generate a 2048-bit RSA key, which provides about 112 bits of
security.
|
HeldCertificate.Builder |
serialNumber(BigInteger serialNumber)
Sets this certificate's serial number.
|
HeldCertificate.Builder |
serialNumber(long serialNumber)
Sets this certificate's serial number.
|
HeldCertificate.Builder |
signedBy(HeldCertificate signedBy)
Set the certificate that will issue this certificate.
|
HeldCertificate.Builder |
validityInterval(long notBefore,
long notAfter)
Sets the certificate to be valid in
[notBefore..notAfter] . |
public HeldCertificate.Builder validityInterval(long notBefore, long notAfter)
[notBefore..notAfter]
. Both endpoints are
specified in the format of System.currentTimeMillis()
. Specify -1L for both values
to use the default interval, 24 hours starting when the certificate is created.public HeldCertificate.Builder duration(long duration, TimeUnit unit)
public HeldCertificate.Builder addSubjectAlternativeName(String altName)
public HeldCertificate.Builder commonName(String cn)
subject alternative names
. If unset a random string will
be used.public HeldCertificate.Builder organizationalUnit(String ou)
public HeldCertificate.Builder serialNumber(BigInteger serialNumber)
public HeldCertificate.Builder serialNumber(long serialNumber)
public HeldCertificate.Builder keyPair(KeyPair keyPair)
public HeldCertificate.Builder keyPair(PublicKey publicKey, PrivateKey privateKey)
public HeldCertificate.Builder signedBy(HeldCertificate signedBy)
public HeldCertificate.Builder certificateAuthority(int maxIntermediateCas)
maxIntermediateCas
intermediate signing certificates beneath it.
By default this certificate cannot not sign other certificates. Set this to 0 so this certificate can sign other certificates (but those certificates cannot themselves sign certificates). Set this to 1 so this certificate can sign intermediate certificates that can themselves sign certificates. Add one for each additional layer of intermediates to permit.
public HeldCertificate.Builder ecdsa256()
This is the default configuration and has been since this API was introduced in OkHttp 3.11.0. Note that the default may change in future releases.
public HeldCertificate.Builder rsa2048()
public HeldCertificate build()
Copyright © 2019. All rights reserved.