Added PBKDF2 to crypto component.

This commit is contained in:
akwizgran
2013-04-16 12:04:23 +01:00
parent 0dcc1a6d54
commit e343c9f4bb
4 changed files with 175 additions and 16 deletions

View File

@@ -96,15 +96,33 @@ public interface CryptoComponent {
long connection);
/**
* Encrypts the given plaintext so it can be written to temporary storage.
* The ciphertext will not be decryptable after the app restarts.
* Encrypts and authenticates the given plaintext so it can be written to
* temporary storage. The ciphertext will not be decryptable after the app
* restarts.
*/
byte[] encryptTemporaryStorage(byte[] plaintext);
/**
* Decrypts the given ciphertext that has been read from temporary storage.
* Returns null if the ciphertext is not decryptable (for example, if it
* was written before the app restarted).
* Decrypts and authenticates the given ciphertext that has been read from
* temporary storage. Returns null if the ciphertext cannot be decrypted
* and authenticated (for example, if it was written before the app
* restarted).
*/
byte[] decryptTemporaryStorage(byte[] ciphertext);
/**
* Encrypts and authenticates the given plaintext so it can be written to
* 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.
*/
byte[] encryptWithPassword(byte[] plaintext, char[] password);
/**
* Decrypts and authenticates the given ciphertext that has been read from
* 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).
*/
byte[] decryptWithPassword(byte[] ciphertext, char[] password);
}