Add javadocs.

This commit is contained in:
akwizgran
2020-01-09 14:17:55 +00:00
parent 4d3c1b4fd2
commit d7b05dcba0
5 changed files with 28 additions and 3 deletions

View File

@@ -132,6 +132,9 @@ public interface CryptoComponent {
* storage. The encryption and authentication keys are derived from the
* given password. The ciphertext will be decryptable using the same
* password after the app restarts.
*
* @param keyStoreConfig Configures the use of a stored key to strengthen
* the password-based key. If null, no stored key will be used
*/
byte[] encryptWithPassword(byte[] plaintext, String password,
@Nullable KeyStoreConfig keyStoreConfig);
@@ -141,6 +144,10 @@ public interface CryptoComponent {
* storage. The encryption and authentication keys are derived from the
* given password. Returns null if the ciphertext cannot be decrypted and
* authenticated (for example, if the password is wrong).
*
* @param keyStoreConfig Configures the use of a stored key to strengthen
* the password-based key. If null, or if no stored key was used when
* encrypting the ciphertext, then no stored key will be used
*/
@Nullable
byte[] decryptWithPassword(byte[] ciphertext, String password,

View File

@@ -4,12 +4,20 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import java.security.spec.AlgorithmParameterSpec;
/**
* Configures the use of a stored key to strengthen password-based encryption.
* The key may be stored in a hardware security module, but this is not
* guaranteed. See
* {@link CryptoComponent#encryptWithPassword(byte[], String, KeyStoreConfig)}
* and
* {@link CryptoComponent#decryptWithPassword(byte[], String, KeyStoreConfig)}.
*/
@NotNullByDefault
public interface KeyStoreConfig {
String getKeyStoreType();
String getAlias();
String getKeyAlias();
String getProviderName();

View File

@@ -10,10 +10,20 @@ import javax.annotation.Nullable;
@NotNullByDefault
public interface DatabaseConfig {
/**
* Returns the directory where the database stores its data.
*/
File getDatabaseDirectory();
/**
* Returns the directory where the encrypted database key is stored.
*/
File getDatabaseKeyDirectory();
/**
* Returns a {@link KeyStoreConfig} for strengthening the encryption of the
* database key, or null if no keystore should be used.
*/
@Nullable
KeyStoreConfig getKeyStoreConfig();
}