Package org.apache.nifi.security.util
Class TemporaryKeyStoreBuilder
java.lang.Object
org.apache.nifi.security.util.TemporaryKeyStoreBuilder
KeyStore Factory for creating temporary files primarily used for testing
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final String
private static final String
private static final Base64.Encoder
private String
private static final String
private static final int
private static final String
private static final String
private static final KeystoreType
private static final int
private static final String
private String
private String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build Temporary KeyStore and TrustStore with configured values and set files with File.deleteOnExit()private X509Certificate
generateCertificate
(String hostname, KeyPair keyPair) private KeyPair
private String
private KeyStore
getNewKeyStore
(String newKeyStoreType) Set Hostname used for Certificate Common Name and DNS Subject Alternative Namesprivate KeyStoreConfiguration
setKeyStore
(PrivateKey privateKey, X509Certificate certificate) private KeyStoreConfiguration
setTrustStore
(X509Certificate certificate) private File
storeKeyStore
(KeyStore keyStore, char[] password) trustStorePassword
(String trustStorePassword) Set Trust Store Password used for protected generated Trust Store filetrustStoreType
(String trustStoreType) Set Trust Store Type used for storing Trust Store files
-
Field Details
-
KEY_PAIR_ALGORITHM
- See Also:
-
KEY_SIZE
private static final int KEY_SIZE- See Also:
-
RANDOM_BYTES_LENGTH
private static final int RANDOM_BYTES_LENGTH- See Also:
-
ENCODER
-
SIGNING_ALGORITHM
- See Also:
-
DISTINGUISHED_NAME_FORMAT
- See Also:
-
CERTIFICATE_VALID_DAYS
private static final int CERTIFICATE_VALID_DAYS- See Also:
-
KEYSTORE_TYPE
-
KEY_STORE_EXTENSION
- See Also:
-
KEY_STORE_PREFIX
- See Also:
-
DEFAULT_HOSTNAME
- See Also:
-
hostname
-
trustStorePassword
-
trustStoreType
-
-
Constructor Details
-
TemporaryKeyStoreBuilder
public TemporaryKeyStoreBuilder()
-
-
Method Details
-
hostname
Set Hostname used for Certificate Common Name and DNS Subject Alternative Names- Parameters:
hostname
- Hostname is required- Returns:
- Builder
-
trustStorePassword
Set Trust Store Password used for protected generated Trust Store file- Parameters:
trustStorePassword
- Trust Store Password is required- Returns:
- Builder
-
trustStoreType
Set Trust Store Type used for storing Trust Store files- Parameters:
trustStoreType
- Trust Store type must be a supported value for KeyStore.getInstance()- Returns:
- Builder
-
build
Build Temporary KeyStore and TrustStore with configured values and set files with File.deleteOnExit()- Returns:
- TLS Configuration with KeyStore and TrustStore properties
-
setKeyStore
-
setTrustStore
-
storeKeyStore
-
getNewKeyStore
-
generateCertificate
-
generateKeyPair
-
generateSecureRandomPassword
-