Package net.lingala.zip4j.crypto
Class AesCipherUtil
- java.lang.Object
-
- net.lingala.zip4j.crypto.AesCipherUtil
-
public class AesCipherUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description AesCipherUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
derivePasswordBasedKey(byte[] salt, char[] password, AesKeyStrength aesKeyStrength, boolean useUtf8ForPassword)
Derive Password-Based Key for AES according to AE-1 and AE-2 Specificationsstatic byte[]
derivePasswordVerifier(byte[] derivedKey, AesKeyStrength aesKeyStrength)
Derive Password Verifier using Derived Key and requested AES Key Strengthstatic AESEngine
getAESEngine(byte[] derivedKey, AesKeyStrength aesKeyStrength)
Get AES Engine using derived key and requested AES Key Strengthstatic MacBasedPRF
getMacBasedPRF(byte[] derivedKey, AesKeyStrength aesKeyStrength)
Get MAC-Based PRF using default HMAC Algorithm defined in AE-1 and AE-2 Specificationstatic void
prepareBuffAESIVBytes(byte[] buff, int nonce)
-
-
-
Method Detail
-
derivePasswordBasedKey
public static byte[] derivePasswordBasedKey(byte[] salt, char[] password, AesKeyStrength aesKeyStrength, boolean useUtf8ForPassword) throws ZipException
Derive Password-Based Key for AES according to AE-1 and AE-2 Specifications- Parameters:
salt
- Salt used for PBKDF2password
- Password used for PBKDF2 containing characters matching ISO-8859-1 character setaesKeyStrength
- Requested AES Key and MAC Strength- Returns:
- Derived Password-Based Key
- Throws:
ZipException
- Thrown when Derived Key is not valid
-
derivePasswordVerifier
public static byte[] derivePasswordVerifier(byte[] derivedKey, AesKeyStrength aesKeyStrength)
Derive Password Verifier using Derived Key and requested AES Key Strength- Parameters:
derivedKey
- Derived KeyaesKeyStrength
- AES Key Strength- Returns:
- Derived Password Verifier
-
getMacBasedPRF
public static MacBasedPRF getMacBasedPRF(byte[] derivedKey, AesKeyStrength aesKeyStrength)
Get MAC-Based PRF using default HMAC Algorithm defined in AE-1 and AE-2 Specification- Parameters:
derivedKey
- Derived KeyaesKeyStrength
- AES Key Strength- Returns:
- Initialized MAC-Based PRF
-
getAESEngine
public static AESEngine getAESEngine(byte[] derivedKey, AesKeyStrength aesKeyStrength) throws ZipException
Get AES Engine using derived key and requested AES Key Strength- Parameters:
derivedKey
- Derived KeyaesKeyStrength
- AES Key Strength- Returns:
- AES Engine configured with AES Key
- Throws:
ZipException
- Thrown on AESEngine initialization failures
-
prepareBuffAESIVBytes
public static void prepareBuffAESIVBytes(byte[] buff, int nonce)
-
-