Class CypherAES256
- java.lang.Object
-
- net.wedjaa.ansible.vault.crypto.decoders.implementation.CypherAES256
-
- All Implemented Interfaces:
CypherInterface
public class CypherAES256 extends Object implements CypherInterface
-
-
Field Summary
Fields Modifier and Type Field Description static int
AES_KEYLEN
static String
CYPHER_ALGO
static String
CYPHER_ID
static String
CYPHER_KEY_ALGO
static int
ITERATIONS
static int
IVLEN
static String
KEYGEN_ALGO
static int
KEYLEN
-
Constructor Summary
Constructors Constructor Description CypherAES256()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
calculateHMAC(byte[] key, byte[] data)
byte[]
decrypt(byte[] encryptedData, String password)
void
decrypt(OutputStream decodedStream, byte[] encryptedData, String password)
byte[]
decryptAES(byte[] cypher, byte[] key, byte[] iv)
byte[]
encrypt(byte[] data, String password)
void
encrypt(OutputStream encodedStream, byte[] data, String password)
byte[]
encryptAES(byte[] cleartext, byte[] key, byte[] iv)
String
infoLine()
byte[]
pad(byte[] cleartext)
int
paddingLength(byte[] decrypted)
byte[]
unpad(byte[] decrypted)
boolean
verifyHMAC(byte[] hmac, byte[] key, byte[] data)
-
-
-
Field Detail
-
CYPHER_ID
public static final String CYPHER_ID
- See Also:
- Constant Field Values
-
AES_KEYLEN
public static final int AES_KEYLEN
- See Also:
- Constant Field Values
-
KEYGEN_ALGO
public static final String KEYGEN_ALGO
- See Also:
- Constant Field Values
-
CYPHER_KEY_ALGO
public static final String CYPHER_KEY_ALGO
- See Also:
- Constant Field Values
-
CYPHER_ALGO
public static final String CYPHER_ALGO
- See Also:
- Constant Field Values
-
KEYLEN
public static final int KEYLEN
- See Also:
- Constant Field Values
-
IVLEN
public static final int IVLEN
- See Also:
- Constant Field Values
-
ITERATIONS
public static final int ITERATIONS
- See Also:
- Constant Field Values
-
-
Method Detail
-
calculateHMAC
public byte[] calculateHMAC(byte[] key, byte[] data) throws IOException
- Throws:
IOException
-
verifyHMAC
public boolean verifyHMAC(byte[] hmac, byte[] key, byte[] data) throws IOException
- Throws:
IOException
-
paddingLength
public int paddingLength(byte[] decrypted)
-
unpad
public byte[] unpad(byte[] decrypted)
-
pad
public byte[] pad(byte[] cleartext) throws IOException
- Throws:
IOException
-
decryptAES
public byte[] decryptAES(byte[] cypher, byte[] key, byte[] iv) throws IOException
- Throws:
IOException
-
encryptAES
public byte[] encryptAES(byte[] cleartext, byte[] key, byte[] iv) throws IOException
- Throws:
IOException
-
decrypt
public byte[] decrypt(byte[] encryptedData, String password) throws IOException
- Specified by:
decrypt
in interfaceCypherInterface
- Throws:
IOException
-
decrypt
public void decrypt(OutputStream decodedStream, byte[] encryptedData, String password) throws IOException
- Specified by:
decrypt
in interfaceCypherInterface
- Throws:
IOException
-
encrypt
public void encrypt(OutputStream encodedStream, byte[] data, String password) throws IOException
- Specified by:
encrypt
in interfaceCypherInterface
- Throws:
IOException
-
infoLine
public String infoLine()
- Specified by:
infoLine
in interfaceCypherInterface
-
encrypt
public byte[] encrypt(byte[] data, String password) throws IOException
- Specified by:
encrypt
in interfaceCypherInterface
- Throws:
IOException
-
-