Class CertificateDataReplaceCertificateKeyStoreContent
java.lang.Object
com.unboundid.ldap.sdk.unboundidds.extensions.ReplaceCertificateKeyStoreContent
com.unboundid.ldap.sdk.unboundidds.extensions.CertificateDataReplaceCertificateKeyStoreContent
- All Implemented Interfaces:
Serializable
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class CertificateDataReplaceCertificateKeyStoreContent
extends ReplaceCertificateKeyStoreContent
This class provides a
ReplaceCertificateKeyStoreContent
implementation to indicate that the certificate chain and private key (in
either PEM or DER format) are provided directly in the extended request.
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundidds package structure, are only
supported for use against Ping Identity, UnboundID, and
Nokia/Alcatel-Lucent 8661 server products. These classes provide support
for proprietary functionality or for external specifications that are not
considered stable or mature enough to be guaranteed to work in an
interoperable way with other types of LDAP servers.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCertificateDataReplaceCertificateKeyStoreContent(List<byte[]> certificateChainData, byte[] privateKeyData) Creates a new instance of this key store content object with the provided information.CertificateDataReplaceCertificateKeyStoreContent(List<File> certificateChainFiles, File privateKeyFile) Creates a new instance of this key store content object with the provided information.CertificateDataReplaceCertificateKeyStoreContent(List<File> certificateChainFiles, File privateKeyFile, File privateKeyEncryptionPasswordFile) Creates a new instance of this key store content object with the provided information. -
Method Summary
Modifier and TypeMethodDescriptionencode()Encodes this key store content object to an ASN.1 element suitable for inclusion in either a replace listener certificate or replace inter-server certificate request.List<byte[]> Retrieves a list of the DER-formatted or PEM-formatted representations of the X.509 certificates in the new certificate chain.byte[]Retrieves the DER-formatted or PEM-formatted PKCS #8 private key for the new certificate, if available.static List<byte[]> readCertificateChain(File... files) Reads a certificate chain from the given file or set of files.static List<byte[]> readCertificateChain(List<File> files) Reads a certificate chain from the given file or set of files.static byte[]readPrivateKey(File file) Reads a PKCS #8 private key from the given file.static byte[]readPrivateKey(File file, File encryptionPasswordFile) Reads a PKCS #8 private key from the given file.voidtoString(StringBuilder buffer) Appends a string representation of this key store content object to the provided buffer.Methods inherited from class com.unboundid.ldap.sdk.unboundidds.extensions.ReplaceCertificateKeyStoreContent
decode, toString
-
Constructor Details
-
CertificateDataReplaceCertificateKeyStoreContent
public CertificateDataReplaceCertificateKeyStoreContent(@NotNull List<byte[]> certificateChainData, @Nullable byte[] privateKeyData) Creates a new instance of this key store content object with the provided information.- Parameters:
certificateChainData- A list containing the encoded representations of the X.509 certificates in the new certificate chain. Each byte array must contain the PEM or DER representation of a single certificate in the chain, with the first certificate being the end-entity certificate, and each subsequent certificate being the issuer for the previous certificate. This must not benullor empty.privateKeyData- An array containing the encoded representation of the PKCS #8 private key for the end-entity certificate in the chain. It may be encoded in either PEM or DER format. This may benullif the new end-entity certificate uses the same private key as the certificate currently in use in the server.
-
CertificateDataReplaceCertificateKeyStoreContent
public CertificateDataReplaceCertificateKeyStoreContent(@NotNull List<File> certificateChainFiles, @Nullable File privateKeyFile) throws LDAPException Creates a new instance of this key store content object with the provided information.- Parameters:
certificateChainFiles- A list containing one or more files from which to read the PEM or DER representations of the X.509 certificates to include in the new certificate chain. The order of the files, and the order of the certificates in each file, should be arranged such that the first certificate read is the end-entity certificate and each subsequent certificate is the issuer for the previous. This must not benullor empty.privateKeyFile- A file from which to read the PEM or DER representation of the PKCS #8 private key for the end-entity certificate in the chain. This may benullif the new end-entity certificate uses the same private key as the certificate currently in use in the server. The private key must not be encrypted.- Throws:
LDAPException- If a problem occurs while trying to read or parse data contained in any of the provided files.
-
CertificateDataReplaceCertificateKeyStoreContent
public CertificateDataReplaceCertificateKeyStoreContent(@NotNull List<File> certificateChainFiles, @Nullable File privateKeyFile, @Nullable File privateKeyEncryptionPasswordFile) throws LDAPException Creates a new instance of this key store content object with the provided information.- Parameters:
certificateChainFiles- A list containing one or more files from which to read the PEM or DER representations of the X.509 certificates to include in the new certificate chain. The order of the files, and the order of the certificates in each file, should be arranged such that the first certificate read is the end-entity certificate and each subsequent certificate is the issuer for the previous. This must not benullor empty.privateKeyFile- A file from which to read the PEM or DER representation of the PKCS #8 private key for the end-entity certificate in the chain. This may benullif the new end-entity certificate uses the same private key as the certificate currently in use in the server.privateKeyEncryptionPasswordFile- A file that contains the password needed to decrypt the private key if it is encrypted. This may benullif the private key is not encrypted.- Throws:
LDAPException- If a problem occurs while trying to read or parse data contained in any of the provided files.
-
-
Method Details
-
readCertificateChain
@NotNull public static List<byte[]> readCertificateChain(@NotNull File... files) throws LDAPException Reads a certificate chain from the given file or set of files. Each file must contain the PEM or DER representations of one or more X.509 certificates. If a file contains multiple certificates, all certificates in that file must be either all PEM-formatted or all DER-formatted.- Parameters:
files- The set of files from which the certificate chain should be read. It must not benullor empty.- Returns:
- A list containing the encoded representation of the X.509 certificates read from the file, with each byte array containing the encoded representation for one certificate.
- Throws:
LDAPException- If a problem was encountered while attempting to read from or parse the content of any of the files.
-
readCertificateChain
@NotNull public static List<byte[]> readCertificateChain(@NotNull List<File> files) throws LDAPException Reads a certificate chain from the given file or set of files. Each file must contain the PEM or DER representations of one or more X.509 certificates. If a file contains multiple certificates, all certificates in that file must be either all PEM-formatted or all DER-formatted.- Parameters:
files- The set of files from which the certificate chain should be read. It must not benullor empty.- Returns:
- A list containing the encoded representation of the X.509 certificates read from the file, with each byte array containing the encoded representation for one certificate.
- Throws:
LDAPException- If a problem was encountered while attempting to read from or parse the content of any of the files.
-
readPrivateKey
Reads a PKCS #8 private key from the given file. The file must contain the PEM or DER representation of a single private key.- Parameters:
file- The file from which the private key should be read. It must not benull.- Returns:
- The encoded representation of the PKCS #8 private key that was read.
- Throws:
LDAPException- If a problem occurs while trying to read from or parse the content of the specified file.
-
readPrivateKey
@NotNull public static byte[] readPrivateKey(@NotNull File file, @Nullable File encryptionPasswordFile) throws LDAPException Reads a PKCS #8 private key from the given file. The file must contain the PEM or DER representation of a single private key.- Parameters:
file- The file from which the private key should be read. It must not benull.encryptionPasswordFile- The file containing the password needed to decrypt the private key if it is encrypted. It may benullif the private key is not encrypted.- Returns:
- The encoded representation of the PKCS #8 private key that was read.
- Throws:
LDAPException- If a problem occurs while trying to read from or parse the content of the specified file.
-
getCertificateChainData
Retrieves a list of the DER-formatted or PEM-formatted representations of the X.509 certificates in the new certificate chain.- Returns:
- A list of the encoded representations of the X.509 certificates in the new certificate chain.
-
getPrivateKeyData
Retrieves the DER-formatted or PEM-formatted PKCS #8 private key for the new certificate, if available.- Returns:
- The encoded representation of the PKCS #8 private key for the new
certificate, or
nullif the new certificate should use the same private key as the current certificate.
-
encode
Encodes this key store content object to an ASN.1 element suitable for inclusion in either a replace listener certificate or replace inter-server certificate request.- Specified by:
encodein classReplaceCertificateKeyStoreContent- Returns:
- The ASN.1 element containing an encoded representation of this key store content object.
-
toString
Appends a string representation of this key store content object to the provided buffer.- Specified by:
toStringin classReplaceCertificateKeyStoreContent- Parameters:
buffer- The buffer to which the encoded representation should be appended. It must not benull.
-