Package net.wedjaa.ansible.vault.crypto
Class VaultHandler
java.lang.Object
net.wedjaa.ansible.vault.crypto.VaultHandler
Created by mrwho on 03/06/15.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
static void
decrypt
(InputStream encryptedVault, OutputStream decryptedVault, String password) static byte[]
static byte[]
static void
encrypt
(InputStream clearText, OutputStream cipherText, String password) static void
encrypt
(InputStream clearText, OutputStream cipherText, String password, String cypher) static byte[]
toByteArray
(InputStream input) Gets the contents of anInputStream
as abyte[]
.
-
Field Details
-
DEFAULT_CYPHER
- See Also:
-
CHAR_ENCODING
- See Also:
-
EOF
public static final int EOFRepresents the end-of-file (or stream).- See Also:
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZEThe default buffer size (8192) to use in copy methods.- See Also:
-
-
Constructor Details
-
VaultHandler
public VaultHandler()
-
-
Method Details
-
encrypt
- Throws:
IOException
-
encrypt
- Throws:
IOException
-
encrypt
public static void encrypt(InputStream clearText, OutputStream cipherText, String password, String cypher) throws IOException - Throws:
IOException
-
encrypt
public static void encrypt(InputStream clearText, OutputStream cipherText, String password) throws IOException - Throws:
IOException
-
decrypt
public static void decrypt(InputStream encryptedVault, OutputStream decryptedVault, String password) throws IOException - Throws:
IOException
-
decrypt
- Throws:
IOException
-
toByteArray
Gets the contents of anInputStream
as abyte[]
.This method buffers the input internally, so there is no need to use a
BufferedInputStream
.- Parameters:
input
- theInputStream
to read from- Returns:
- the requested byte array
- Throws:
NullPointerException
- if the input is nullIOException
- if an I/O error occurs
-