public final class Decryptors extends Object
Modifier and Type | Method and Description |
---|---|
static Decryptor |
addChecksum(Decryptor delegate)
Wraps the delegate such that any change in the encrypted data is guaranteed to be detected and raised
as a
WrongKeyException . |
static char[] |
decrypt(Decryptor decryptor,
byte[] salt,
String subject)
BASE64-decodes the subject, decrypts the resulting bytes, (optionally) verifies and then strips the
salt prefix, and decodes the bytes as UTF-8.
|
static char[] |
decrypt(Decryptor decryptor,
String subject)
BASE64-decodes the subject, decrypts the resulting bytes, and decodes them as UTF-8.
|
static Decryptor |
fromKey(Key key)
Creates and returns an
Decryptor which uses the given keys for encryption and decryption. |
public static Decryptor fromKey(Key key)
Decryptor
which uses the given keys for encryption and decryption. When
this method returns, the two keys may safely be destroyed.public static Decryptor addChecksum(Decryptor delegate)
WrongKeyException
.public static char[] decrypt(Decryptor decryptor, String subject) throws WrongKeyException
Fills the subject with zeros.
WrongKeyException
- The key is wrongpublic static char[] decrypt(Decryptor decryptor, @Nullable byte[] salt, String subject) throws WrongKeyException, SaltException
WrongKeyException
- The key is wrongSaltException
- After decryption, the salt verification failedCopyright © 2018 Arno Unkrig. All rights reserved.