|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
The IEncryptor interface provides a set of methods for performing common encryption, random number, and hashing operations. Implementations should rely on a strong cryptographic implementation, such as JCE or BouncyCastle. Implementors should take care to ensure that they initialize their implementation with a strong "master key", and that they protect this secret as much as possible.
Possible future enhancements (depending on feedback) might include:
| Method Summary | |
java.lang.String |
decrypt(java.lang.String ciphertext)
Decrypts the provided ciphertext string (encrypted with the encrypt method) and returns a plaintext string. |
java.lang.String |
encrypt(java.lang.String plaintext)
Encrypts the provided plaintext and returns a ciphertext string. |
long |
getRelativeTimeStamp(long offset)
Gets a timestamp representing an offset from the current time to be used by other functions in the library. |
long |
getTimeStamp()
Gets a timestamp representing the current date and time to be used by other functions in the library. |
java.lang.String |
hash(java.lang.String plaintext,
java.lang.String salt)
Returns a string representation of the hash of the provided plaintext and salt. |
java.lang.String |
seal(java.lang.String data,
long timestamp)
Creates a seal that binds a set of data and an expiration timestamp. |
java.lang.String |
sign(java.lang.String data)
Create a digital signature for the provided data and return it in a string. |
java.lang.String |
unseal(java.lang.String seal)
Unseals data (created with the seal method) and throws an exception describing any of the various problems that could exist with a seal, such as an invalid seal format, expired timestamp, or decryption error. |
boolean |
verifySeal(java.lang.String seal)
Verifies a seal (created with the seal method) and throws an exception describing any of the various problems that could exist with a seal, such as an invalid seal format, expired timestamp, or data mismatch. |
boolean |
verifySignature(java.lang.String signature,
java.lang.String data)
Verifies a digital signature (created with the sign method) and returns the boolean result. |
| Method Detail |
public java.lang.String hash(java.lang.String plaintext,
java.lang.String salt)
throws EncryptionException
plaintext - the plaintextsalt - the salt
EncryptionException - the encryption exception
public java.lang.String encrypt(java.lang.String plaintext)
throws EncryptionException
plaintext - the plaintext
EncryptionException - the encryption exception
public java.lang.String decrypt(java.lang.String ciphertext)
throws EncryptionException
ciphertext - the ciphertext
EncryptionException - the encryption exception
public java.lang.String sign(java.lang.String data)
throws EncryptionException
data - the data
EncryptionException - the encryption exception
public boolean verifySignature(java.lang.String signature,
java.lang.String data)
signature - the signaturedata - the data
EncryptionException - the encryption exception
public java.lang.String seal(java.lang.String data,
long timestamp)
throws IntegrityException
data - the datatimestamp - the timestamp of the expiration date of the data.
EncryptionException - the encryption exception
IntegrityException
public java.lang.String unseal(java.lang.String seal)
throws EncryptionException
seal - the seal
EncryptionExceptionpublic boolean verifySeal(java.lang.String seal)
seal - the sealpublic long getRelativeTimeStamp(long offset)
public long getTimeStamp()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||