Class KeyStoreCredentialStore.ExternalStorage
- java.lang.Object
-
- org.wildfly.security.credential.store.impl.KeyStoreCredentialStore.ExternalStorage
-
- Enclosing class:
- KeyStoreCredentialStore
private final class KeyStoreCredentialStore.ExternalStorage extends Object
-
-
Field Summary
Fields Modifier and Type Field Description private KeyStoredataKeyStoreprivate Cipherdecryptprivate static StringDEFAULT_CRYPTOGRAPHIC_ALGORITHMprivate Cipherencryptprivate intSECRET_KEY_ENTRY_TYPEprivate SecretKeystorageSecretKeyprivate KeyStorestorageSecretKeyStoreprivate intVERSION
-
Constructor Summary
Constructors Modifier Constructor Description privateExternalStorage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidfetchStorageSecretKey(String keyAlias, char[] keyPassword)(package private) voidinit(String cryptographicAlgorithm, String keyAlias, KeyStore keyStore, char[] keyPassword, KeyStore dataKeyStore)(package private) voidload(InputStream inputStream)LoaddataKeyStorewith data from the input stream.private voidloadSecretKey(ObjectInputStream ois)private byte[]pkcs7Pad(byte[] buffer, int blockSize)private byte[]pkcs7UnPad(byte[] buffer)private byte[]readBytes(ObjectInputStream ois)private voidsaveSecretKey(String ksAlias, ObjectOutputStream oos, KeyStore.SecretKeyEntry entry)(package private) voidstore(OutputStream outputStream)Store data fromdataKeyStoreto output stream.private intwriteBytes(byte[] data, ObjectOutputStream oos)
-
-
-
Field Detail
-
VERSION
private int VERSION
-
SECRET_KEY_ENTRY_TYPE
private int SECRET_KEY_ENTRY_TYPE
-
DEFAULT_CRYPTOGRAPHIC_ALGORITHM
private static final String DEFAULT_CRYPTOGRAPHIC_ALGORITHM
- See Also:
- Constant Field Values
-
encrypt
private Cipher encrypt
-
decrypt
private Cipher decrypt
-
dataKeyStore
private KeyStore dataKeyStore
-
storageSecretKeyStore
private KeyStore storageSecretKeyStore
-
storageSecretKey
private SecretKey storageSecretKey
-
-
Method Detail
-
init
void init(String cryptographicAlgorithm, String keyAlias, KeyStore keyStore, char[] keyPassword, KeyStore dataKeyStore) throws CredentialStoreException
- Throws:
CredentialStoreException
-
fetchStorageSecretKey
private void fetchStorageSecretKey(String keyAlias, char[] keyPassword) throws CertificateException, NoSuchAlgorithmException, IOException, CredentialStoreException, UnrecoverableEntryException, KeyStoreException
-
load
void load(InputStream inputStream) throws IOException, GeneralSecurityException
LoaddataKeyStorewith data from the input stream.- Parameters:
inputStream- to load data from- Throws:
IOException- if something goes wrongGeneralSecurityException
-
loadSecretKey
private void loadSecretKey(ObjectInputStream ois) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
readBytes
private byte[] readBytes(ObjectInputStream ois) throws IOException
- Throws:
IOException
-
writeBytes
private int writeBytes(byte[] data, ObjectOutputStream oos) throws IOException- Throws:
IOException
-
store
void store(OutputStream outputStream) throws IOException, GeneralSecurityException
Store data fromdataKeyStoreto output stream.- Parameters:
outputStream- to store data to- Throws:
IOException- if something goes wrongGeneralSecurityException
-
saveSecretKey
private void saveSecretKey(String ksAlias, ObjectOutputStream oos, KeyStore.SecretKeyEntry entry) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
pkcs7Pad
private byte[] pkcs7Pad(byte[] buffer, int blockSize)
-
pkcs7UnPad
private byte[] pkcs7UnPad(byte[] buffer) throws BadPaddingException- Throws:
BadPaddingException
-
-