mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-12-05 16:22:31 -08:00
Merge branch 'master' into develop (Add fingerprint)
This commit is contained in:
commit
8e4b6ede35
41 files changed
+1666
-489
No files matched your search
@@ -19,9 +19,14 @@
|
||||
*/
|
||||
package com.keepassdroid.crypto.engine;
|
||||
|
||||
import com.keepassdroid.utils.Types;
|
||||
|
||||
import org.spongycastle.jce.provider.BouncyCastleProvider;
|
||||
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
@@ -29,6 +34,11 @@ import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
public class ChaCha20Engine extends CipherEngine {
|
||||
public static final UUID CIPHER_UUID = Types.bytestoUUID(
|
||||
new byte[]{(byte)0xD6, (byte)0x03, (byte)0x8A, (byte)0x2B, (byte)0x8B, (byte)0x6F,
|
||||
(byte)0x4C, (byte)0xB5, (byte)0xA5, (byte)0x24, (byte)0x33, (byte)0x9A, (byte)0x31,
|
||||
(byte)0xDB, (byte)0xB5, (byte)0x9A});
|
||||
|
||||
@Override
|
||||
public int ivLength() {
|
||||
return 12;
|
||||
@@ -36,8 +46,8 @@ public class ChaCha20Engine extends CipherEngine {
|
||||
|
||||
@Override
|
||||
public Cipher getCipher(int opmode, byte[] key, byte[] IV, boolean androidOverride) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException {
|
||||
Cipher cipher = Cipher.getInstance("Chacha");
|
||||
cipher.init(opmode, new SecretKeySpec(key, "ChaCha"), new IvParameterSpec(IV));
|
||||
Cipher cipher = Cipher.getInstance("Chacha7539", new BouncyCastleProvider());
|
||||
cipher.init(opmode, new SecretKeySpec(key, "ChaCha7539"), new IvParameterSpec(IV));
|
||||
return cipher;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user