mirror of
https://github.com/RoastSlav/quickdrop.git
synced 2025-12-20 13:59:36 -06:00
updated message for encryption on upload page
This commit is contained in:
@@ -22,13 +22,14 @@ public class FileEncryptionService {
|
|||||||
private static final String ALGORITHM = "AES/CBC/PKCS5Padding";
|
private static final String ALGORITHM = "AES/CBC/PKCS5Padding";
|
||||||
private static final String KEY_DERIVATION_ALGORITHM = "PBKDF2WithHmacSHA256";
|
private static final String KEY_DERIVATION_ALGORITHM = "PBKDF2WithHmacSHA256";
|
||||||
private static final int ITERATION_COUNT = 65536;
|
private static final int ITERATION_COUNT = 65536;
|
||||||
private static final int KEY_LENGTH = 256;
|
private static final int KEY_LENGTH = 128;
|
||||||
|
|
||||||
public SecretKey generateKeyFromPassword(String password, byte[] salt)
|
public SecretKey generateKeyFromPassword(String password, byte[] salt)
|
||||||
throws NoSuchAlgorithmException, InvalidKeySpecException {
|
throws NoSuchAlgorithmException, InvalidKeySpecException {
|
||||||
PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, ITERATION_COUNT, KEY_LENGTH);
|
PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, ITERATION_COUNT, KEY_LENGTH);
|
||||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(KEY_DERIVATION_ALGORITHM);
|
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
|
||||||
return new SecretKeySpec(keyFactory.generateSecret(spec).getEncoded(), "AES");
|
byte[] keyBytes = keyFactory.generateSecret(spec).getEncoded();
|
||||||
|
return new SecretKeySpec(keyBytes, "AES");
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] generateRandomBytes() {
|
private byte[] generateRandomBytes() {
|
||||||
|
|||||||
Reference in New Issue
Block a user