Modifier and Type | Method and Description |
---|---|
static SecretKey |
adHocSecretKey(File keyStoreFile,
char[] keyStorePassword,
String keyAlias,
char[] keyProtectionPassword)
If the keyStoreFile does not exist, then this method generates a new
SecretKey and stores it
in the keyStoreFile). |
static SecretKey |
adHocSecretKey(File keyStoreFile,
char[] keyStorePassword,
String keyAlias,
String dialogTitle,
String messageCreateKey,
String messageUseExistingKey)
If the keyStoreFile does not exist, then this method asks the user interactively to (optionally)
choose a "key protection password", generates a new
SecretKey and stores it in the
keyStoreFile). |
public static SecretKey adHocSecretKey(File keyStoreFile, @Nullable char[] keyStorePassword, String keyAlias, char[] keyProtectionPassword) throws GeneralSecurityException, IOException
SecretKey
and stores it
in the keyStoreFile).
Otherwise, if the keyStoreFile does exist, then this method loads the SecretKey
from the
keyStoreFile.
keyStorePassword
- See KeyStore.load(InputStream, char[])
keyProtectionPassword
- See KeyStore.getKey(String, char[])
; null
to prompt the userGeneralSecurityException
IOException
adHocSecretKey(File, char[], String, String, String, String)
@Nullable public static SecretKey adHocSecretKey(File keyStoreFile, @Nullable char[] keyStorePassword, String keyAlias, String dialogTitle, String messageCreateKey, String messageUseExistingKey) throws GeneralSecurityException, IOException
SecretKey
and stores it in the
keyStoreFile).
Otherwise, if the keyStoreFile does exist, then this method asks the user interactively for the
"key protection password" (if one was given when the key was previously generated), and loads the SecretKey
from the keyStoreFile.
keyStorePassword
- See KeyStore.load(InputStream, char[])
dialogTitle
- E.g. "Authentication store"
messageCreateKey
- E.g. "Do you want to create an authentication store for user names and
passwords?"
messageUseExistingKey
- E.g. "Do you want to use the existing authentication store for user names
and passwords?"
null
indicates that the user cancelled the operationGeneralSecurityException
IOException
adHocSecretKey(File, char[], String, char[])
Copyright © 2018 Arno Unkrig. All rights reserved.