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 KeyStore
dataKeyStore
private Cipher
decrypt
private static String
DEFAULT_CRYPTOGRAPHIC_ALGORITHM
private Cipher
encrypt
private int
SECRET_KEY_ENTRY_TYPE
private SecretKey
storageSecretKey
private KeyStore
storageSecretKeyStore
private int
VERSION
-
Constructor Summary
Constructors Modifier Constructor Description private
ExternalStorage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
fetchStorageSecretKey(String keyAlias, char[] keyPassword)
(package private) void
init(String cryptographicAlgorithm, String keyAlias, KeyStore keyStore, char[] keyPassword, KeyStore dataKeyStore)
(package private) void
load(InputStream inputStream)
LoaddataKeyStore
with data from the input stream.private void
loadSecretKey(ObjectInputStream ois)
private byte[]
pkcs7Pad(byte[] buffer, int blockSize)
private byte[]
pkcs7UnPad(byte[] buffer)
private byte[]
readBytes(ObjectInputStream ois)
private void
saveSecretKey(String ksAlias, ObjectOutputStream oos, KeyStore.SecretKeyEntry entry)
(package private) void
store(OutputStream outputStream)
Store data fromdataKeyStore
to output stream.private int
writeBytes(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
LoaddataKeyStore
with 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:
IOException
GeneralSecurityException
-
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 fromdataKeyStore
to 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:
IOException
GeneralSecurityException
-
pkcs7Pad
private byte[] pkcs7Pad(byte[] buffer, int blockSize)
-
pkcs7UnPad
private byte[] pkcs7UnPad(byte[] buffer) throws BadPaddingException
- Throws:
BadPaddingException
-
-