|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface JNCryptor
A JNCryptor
encrypts and decrypts data in a proprietary format
originally devised by Rob Napier.
See https://github.com/rnapier/ RNCryptor for details on the original implementation in objective-c
Method Summary | |
---|---|
byte[] |
decryptData(byte[] ciphertext,
char[] password)
Decrypts data with the supplied password. |
byte[] |
decryptData(byte[] ciphertext,
SecretKey decryptionKey,
SecretKey hmacKey)
Decrypts data with the supplied keys. |
byte[] |
encryptData(byte[] plaintext,
char[] password)
Encrypts data with the supplied password. |
byte[] |
encryptData(byte[] plaintext,
char[] password,
byte[] encryptionSalt,
byte[] hmacSalt,
byte[] iv)
Encrypts data with the supplied password, salt values and IV. |
byte[] |
encryptData(byte[] plaintext,
PasswordKey encryptionKey,
PasswordKey hmacKey)
Encrypts data using pre-computed keys, producing data in the password output format (i.e. |
byte[] |
encryptData(byte[] plaintext,
SecretKey encryptionKey,
SecretKey hmacKey)
Encrypts data with the supplied keys. |
PasswordKey |
getPasswordKey(char[] password)
Generates a key from a password and a random salt. |
int |
getPBKDFIterations()
Gets the number of iterations used by this JNCryptor . |
int |
getVersionNumber()
Returns the version number of the data format produced by this JNCryptor . |
SecretKey |
keyForPassword(char[] password,
byte[] salt)
Generates a key given a password and salt using a PBKDF. |
void |
setPBKDFIterations(int iterations)
Changes the number of iterations used by this JNCryptor . |
Method Detail |
---|
SecretKey keyForPassword(char[] password, byte[] salt) throws CryptorException
password
- password to use for PBKDF. Cannot be empty or null
.salt
- salt for password, cannot be null
CryptorException
PasswordKey getPasswordKey(char[] password) throws CryptorException
password
- password to use for PBKDF. Cannot be empty or null
.
CryptorException
byte[] encryptData(byte[] plaintext, PasswordKey encryptionKey, PasswordKey hmacKey) throws CryptorException
plaintext
- the plaintext to encryptencryptionKey
- the pre-computed encryption keyhmacKey
- the pre-computer HMAC key
CryptorException
byte[] encryptData(byte[] plaintext, char[] password, byte[] encryptionSalt, byte[] hmacSalt, byte[] iv) throws CryptorException
plaintext
- the plaintextpassword
- the password (cannot be null
or empty)encryptionSalt
- eight bytes of random salt valuehmacSalt
- eight bytes of random salt valueiv
- sixteen byte AES IV
CryptorException
- if an error occurredbyte[] decryptData(byte[] ciphertext, char[] password) throws CryptorException, InvalidHMACException
ciphertext
- data to decrypt. Must be in the format described at https://github.com/RNCryptor/RNCryptor-Spec/blob/master/RNCryptor
-Spec-v3.mdpassword
- password to use for the decryption. Cannot be empty or
null
.
InvalidHMACException
CryptorException
byte[] decryptData(byte[] ciphertext, SecretKey decryptionKey, SecretKey hmacKey) throws CryptorException, InvalidHMACException
ciphertext
- data to decrypt. Must be in the format described at https://github.com/RNCryptor/RNCryptor-Spec/blob/master/RNCryptor
-Spec-v3.mddecryptionKey
- the key to decrypt withhmacKey
- the key to verify the HMAC with
InvalidHMACException
CryptorException
byte[] encryptData(byte[] plaintext, char[] password) throws CryptorException
plaintext
- the data to encryptpassword
- password to use for the encryption. Cannot be empty or
null
.
CryptorException
byte[] encryptData(byte[] plaintext, SecretKey encryptionKey, SecretKey hmacKey) throws CryptorException
plaintext
- the data to encryptencryptionKey
- key to use for encryptionhmacKey
- key to use for computing the HMAC
CryptorException
int getVersionNumber()
JNCryptor
.
void setPBKDFIterations(int iterations)
JNCryptor
.
iterations
- int getPBKDFIterations()
JNCryptor
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |