Package com.unboundid.ldap.listener
Class SelfSignedCertificateGenerator
java.lang.Object
com.unboundid.ldap.listener.SelfSignedCertificateGenerator
@ThreadSafety(level=NOT_THREADSAFE)
public final class SelfSignedCertificateGenerator
extends Object
This class provides a mechanism for generating a self-signed certificate for
use by a listener that supports SSL or StartTLS.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidgenerateSelfSignedCertificate(String toolName, File keyStoreFile, String keyStorePIN, String keyStoreType, String alias) Generates a self-signed certificate in the specified keystore.static ObjectPair<File, char[]> generateTemporarySelfSignedCertificate(String toolName, String keyStoreType) Generates a temporary keystore containing a self-signed certificate for use by a listener that supports SSL or StartTLS.
-
Method Details
-
generateTemporarySelfSignedCertificate
@NotNull public static ObjectPair<File,char[]> generateTemporarySelfSignedCertificate(@NotNull String toolName, @NotNull String keyStoreType) throws CertException Generates a temporary keystore containing a self-signed certificate for use by a listener that supports SSL or StartTLS.- Parameters:
toolName- The name of the tool for which the certificate is to be generated.keyStoreType- The key store type for the keystore to be created. It must not benull.- Returns:
- An
ObjectPaircontaining the path and PIN for the keystore that was generated. - Throws:
CertException- If a problem occurs while trying to generate the temporary keystore containing the self-signed certificate.
-
generateSelfSignedCertificate
public static void generateSelfSignedCertificate(@NotNull String toolName, @NotNull File keyStoreFile, @NotNull String keyStorePIN, @NotNull String keyStoreType, @NotNull String alias) throws CertException Generates a self-signed certificate in the specified keystore.- Parameters:
toolName- The name of the tool for which the certificate is to be generated.keyStoreFile- The path to the keystore file in which the certificate is to be generated. This must not benull, and if the target file exists, then it must be a JKS or PKCS #12 keystore. If it does not exist, then at least the parent directory must exist.keyStorePIN- The PIN needed to access the keystore. It must not benull.keyStoreType- The key store type for the keystore to be created, if it does not already exist. It must not benull.alias- The alias to use for the certificate in the keystore. It must not benull.- Throws:
CertException- If a problem occurs while trying to generate self-signed certificate.
-