mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Use Android keystore for encrypting DB key.
Only for new accounts on API 23+.
This commit is contained in:
@@ -133,7 +133,8 @@ public interface CryptoComponent {
|
||||
* given password. The ciphertext will be decryptable using the same
|
||||
* password after the app restarts.
|
||||
*/
|
||||
byte[] encryptWithPassword(byte[] plaintext, String password);
|
||||
byte[] encryptWithPassword(byte[] plaintext, String password,
|
||||
@Nullable KeyStoreConfig keyStoreConfig);
|
||||
|
||||
/**
|
||||
* Decrypts and authenticates the given ciphertext that has been read from
|
||||
@@ -142,7 +143,8 @@ public interface CryptoComponent {
|
||||
* authenticated (for example, if the password is wrong).
|
||||
*/
|
||||
@Nullable
|
||||
byte[] decryptWithPassword(byte[] ciphertext, String password);
|
||||
byte[] decryptWithPassword(byte[] ciphertext, String password,
|
||||
@Nullable KeyStoreConfig keyStoreConfig);
|
||||
|
||||
/**
|
||||
* Encrypts the given plaintext to the given public key.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.briarproject.bramble.api.crypto;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
|
||||
@NotNullByDefault
|
||||
public interface KeyStoreConfig {
|
||||
|
||||
String getKeyStoreType();
|
||||
|
||||
String getAlias();
|
||||
|
||||
String getProviderName();
|
||||
|
||||
String getMacAlgorithmName();
|
||||
|
||||
AlgorithmParameterSpec getParameterSpec();
|
||||
}
|
||||
@@ -1,13 +1,19 @@
|
||||
package org.briarproject.bramble.api.db;
|
||||
|
||||
import org.briarproject.bramble.api.crypto.KeyStoreConfig;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@NotNullByDefault
|
||||
public interface DatabaseConfig {
|
||||
|
||||
File getDatabaseDirectory();
|
||||
|
||||
File getDatabaseKeyDirectory();
|
||||
|
||||
@Nullable
|
||||
KeyStoreConfig getKeyStoreConfig();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user