@ThreadSafety(level=NOT_THREADSAFE) public final class SelfSignedCertificateGenerator extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
generateSelfSignedCertificate(java.lang.String toolName,
java.io.File keyStoreFile,
java.lang.String keyStorePIN,
java.lang.String keyStoreType,
java.lang.String alias)
Generates a self-signed certificate in the specified keystore.
|
static ObjectPair<java.io.File,char[]> |
generateTemporarySelfSignedCertificate(java.lang.String toolName,
java.lang.String keyStoreType)
Generates a temporary keystore containing a self-signed certificate for
use by a listener that supports SSL or StartTLS.
|
@NotNull public static ObjectPair<java.io.File,char[]> generateTemporarySelfSignedCertificate(@NotNull java.lang.String toolName, @NotNull java.lang.String keyStoreType) throws CertException
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 be null
.ObjectPair
containing the path and PIN for the keystore
that was generated.CertException
- If a problem occurs while trying to generate the
temporary keystore containing the self-signed
certificate.public static void generateSelfSignedCertificate(@NotNull java.lang.String toolName, @NotNull java.io.File keyStoreFile, @NotNull java.lang.String keyStorePIN, @NotNull java.lang.String keyStoreType, @NotNull java.lang.String alias) throws CertException
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 be
null
, 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
be null
.keyStoreType
- The key store type for the keystore to be created, if
it does not already exist. It must not be
null
.alias
- The alias to use for the certificate in the keystore.
It must not be null
.CertException
- If a problem occurs while trying to generate
self-signed certificate.