|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.keyczar.Encrypter
public class Encrypter
Encrypters are used strictly to encrypt data. Typically, Encrypters will read
sets of public keys, although may also be instantiated with sets of symmetric
keys.
Crypter
objects should be used with symmetric or private key sets to
decrypt data.
Constructor Summary | |
---|---|
Encrypter(KeyczarReader reader)
Initialize a new Encrypter with a KeyczarReader. |
|
Encrypter(java.lang.String fileLocation)
Initialize a new Encrypter with a key set location. |
Method Summary | |
---|---|
int |
ciphertextSize(int inputLength)
Returns the size of the ciphertext output that would result from encrypting an input of the given length. |
byte[] |
encrypt(byte[] input)
Encrypt the given input byte array. |
void |
encrypt(java.nio.ByteBuffer input,
java.nio.ByteBuffer output)
Encrypt the given input ByteBuffer. |
java.lang.String |
encrypt(java.lang.String input)
Encrypt a String and return a web-safe Base64 encoded ciphertext. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Encrypter(KeyczarReader reader) throws KeyczarException
KeyPurpose.ENCRYPT
or
KeyPurpose.DECRYPT_AND_ENCRYPT
.
reader
- A reader to read keys from
KeyczarException
- In the event of an IO error reading keys or if the
key set does not have the appropriate purpose.public Encrypter(java.lang.String fileLocation) throws KeyczarException
KeyPurpose.ENCRYPT
or
KeyPurpose.DECRYPT_AND_ENCRYPT
fileLocation
- Directory containing a key set
KeyczarException
- In the event of an IO error reading keys or if the
key set does not have the appropriate purpose.Method Detail |
---|
public int ciphertextSize(int inputLength) throws KeyczarException
inputLength
- The length of the input.
KeyczarException
- If the key set contains no primary encrypting key.public byte[] encrypt(byte[] input) throws KeyczarException
input
- The input to encrypt
KeyczarException
- If there is a JCE exception or the key set does
not contain a primary encrypting key.public void encrypt(java.nio.ByteBuffer input, java.nio.ByteBuffer output) throws KeyczarException
input
- The input buffer to encrypt. Will not be modifiedoutput
- The buffer to write the output ciphertext to.
KeyczarException
- If there is a JCE exception, the key set does
not contain a primary encrypting key, or the output buffer is too small.public java.lang.String encrypt(java.lang.String input) throws KeyczarException
input
- An String to encrypt.
KeyczarException
- If there is a JCE exception or the key set does
not contain a primary encrypting key.public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |