|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mozilla.jss.crypto.Cipher
Cipher
)
public abstract class Cipher
A context for performing symmetric encryption and decryption.
First, the context must be initialized. Then, it can be updated
with input through zero or more calls to update
. Finally,
doFinal
is called to finalize the operation. Note that
it is not necessary to call update
if all of the data is
available at once. In this case, all of the input can be processed with one
call to doFinal
.
Constructor Summary | |
---|---|
Cipher()
Deprecated. |
Method Summary | |
---|---|
abstract byte[] |
doFinal()
Deprecated. Completes an cipher operation. |
abstract byte[] |
doFinal(byte[] bytes)
Deprecated. Completes an cipher operation. |
abstract byte[] |
doFinal(byte[] bytes,
int offset,
int length)
Deprecated. Completes an cipher operation. |
abstract void |
initDecrypt(SymmetricKey key)
Deprecated. Initializes a decryption context with a symmetric key. |
abstract void |
initDecrypt(SymmetricKey key,
java.security.spec.AlgorithmParameterSpec parameters)
Deprecated. Initializes a decryption context with a symmetric key and algorithm parameters. |
abstract void |
initEncrypt(SymmetricKey key)
Deprecated. Initializes a encryption context with a symmetric key. |
abstract void |
initEncrypt(SymmetricKey key,
java.security.spec.AlgorithmParameterSpec parameters)
Deprecated. Initializes an encryption context with a symmetric key and algorithm parameters. |
static byte[] |
pad(byte[] toBePadded,
int blockSize)
Deprecated. Pads a byte array so that its length is a multiple of the given blocksize. |
static byte[] |
unPad(byte[] padded)
Deprecated. Un-pads a byte array that is padded with PKCS padding. |
static byte[] |
unPad(byte[] padded,
int blockSize)
Deprecated. Un-pads a byte array that is padded with PKCS padding. |
abstract byte[] |
update(byte[] bytes)
Deprecated. Updates the encryption context with additional input. |
abstract byte[] |
update(byte[] bytes,
int offset,
int length)
Deprecated. Updates the encryption context with additional plaintext. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Cipher()
Method Detail |
---|
public abstract void initEncrypt(SymmetricKey key) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException, TokenException
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
TokenException
public abstract void initDecrypt(SymmetricKey key) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException, TokenException
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
TokenException
public abstract void initEncrypt(SymmetricKey key, java.security.spec.AlgorithmParameterSpec parameters) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException, TokenException
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
TokenException
public abstract void initDecrypt(SymmetricKey key, java.security.spec.AlgorithmParameterSpec parameters) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException, TokenException
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
TokenException
public abstract byte[] update(byte[] bytes) throws java.lang.IllegalStateException, TokenException
bytes
- Bytes of plaintext (if encrypting) or ciphertext (if
decrypting).
java.lang.IllegalStateException
TokenException
public abstract byte[] update(byte[] bytes, int offset, int length) throws java.lang.IllegalStateException, TokenException
bytes
- Bytes of plaintext (if encrypting) or ciphertext (if
decrypting).offset
- The index in bytes
at which to begin reading.length
- The number of bytes from bytes
to read.
java.lang.IllegalStateException
TokenException
public abstract byte[] doFinal(byte[] bytes) throws java.lang.IllegalStateException, IllegalBlockSizeException, BadPaddingException, TokenException
update
may be called
any number of times before calling final
.
bytes
- Bytes of plaintext (if encrypting) or ciphertext (if
decrypting).
java.lang.IllegalStateException
IllegalBlockSizeException
BadPaddingException
TokenException
public abstract byte[] doFinal(byte[] bytes, int offset, int length) throws java.lang.IllegalStateException, IllegalBlockSizeException, BadPaddingException, TokenException
bytes
- Bytes of plaintext (if encrypting) or ciphertext (if
decrypting).offset
- The index in bytes
at which to begin reading.length
- The number of bytes from bytes
to read.
java.lang.IllegalStateException
IllegalBlockSizeException
BadPaddingException
TokenException
public abstract byte[] doFinal() throws java.lang.IllegalStateException, IllegalBlockSizeException, BadPaddingException, TokenException
java.lang.IllegalStateException
IllegalBlockSizeException
BadPaddingException
TokenException
public static byte[] pad(byte[] toBePadded, int blockSize)
blockSize
- The block size of the encryption algorithm.
Must be greater than zero.unPad(byte[], int)
public static byte[] unPad(byte[] padded, int blockSize) throws BadPaddingException
blockSize
- The block size of the encryption algorithm. This
is only used for error checking: if the pad size is not
between 1 and blockSize, a BadPaddingException is thrown.
BadPaddingException
pad(byte[], int)
public static byte[] unPad(byte[] padded) throws BadPaddingException
BadPaddingException
pad(byte[], int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |