Package net.lingala.zip4j.crypto
Class AesCipherUtil
java.lang.Object
net.lingala.zip4j.crypto.AesCipherUtil
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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)
-
Field Details
-
START_INDEX
private static final int START_INDEX- See Also:
-
-
Constructor Details
-
AesCipherUtil
public AesCipherUtil()
-
-
Method Details
-
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
Derive Password Verifier using Derived Key and requested AES Key Strength- Parameters:
derivedKey
- Derived KeyaesKeyStrength
- AES Key Strength- Returns:
- Derived Password Verifier
-
getMacBasedPRF
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)
-