|
JSS 3.1.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mozilla.jss.crypto.Cipher | +--org.mozilla.jss.pkcs11.PK11Cipher
Field Summary | |
private EncryptionAlgorithm |
algorithm
|
private CipherContextProxy |
contextProxy
|
private static int |
DECRYPT
|
private static int |
ENCRYPT
|
private byte[] |
IV
|
private SymmetricKey |
key
|
private java.security.spec.AlgorithmParameterSpec |
parameters
|
private int |
state
|
private PK11Token |
token
|
private static int |
UNINITIALIZED
|
Constructor Summary | |
private |
PK11Cipher()
|
(package private) |
PK11Cipher(PK11Token token,
EncryptionAlgorithm algorithm)
|
Method Summary | |
private void |
checkKey(SymmetricKey key)
Checks for null, makes sure the key lives on the correct token, makes sure it is a PKCS #11 key, makes sure it's the right type for this algorithm. |
private void |
checkParams(java.security.spec.AlgorithmParameterSpec params)
Matches the params against those expected by the algorithm. |
byte[] |
doFinal()
Completes an cipher operation. |
byte[] |
doFinal(byte[] bytes)
Completes an cipher operation. |
byte[] |
doFinal(byte[] bytes,
int offset,
int length)
Completes an cipher operation. |
private static byte[] |
finalizeContext(CipherContextProxy context,
int blocksize,
boolean padded)
|
private static CipherContextProxy |
initContext(boolean encrypt,
SymmetricKey key,
EncryptionAlgorithm alg,
byte[] IV)
|
void |
initDecrypt(SymmetricKey key)
Initializes a decryption context with a symmetric key. |
void |
initDecrypt(SymmetricKey key,
java.security.spec.AlgorithmParameterSpec parameters)
Initializes a decryption context with a symmetric key and algorithm parameters. |
void |
initEncrypt(SymmetricKey key)
Initializes a encryption context with a symmetric key. |
void |
initEncrypt(SymmetricKey key,
java.security.spec.AlgorithmParameterSpec parameters)
Initializes an encryption context with a symmetric key and algorithm parameters. |
private void |
reset()
|
byte[] |
update(byte[] bytes)
Updates the encryption context with additional input. |
byte[] |
update(byte[] bytes,
int offset,
int length)
Updates the encryption context with additional plaintext. |
private static byte[] |
updateContext(CipherContextProxy context,
byte[] input,
int blocksize)
|
Methods inherited from class org.mozilla.jss.crypto.Cipher |
pad, unPad, unPad |
Methods inherited from class java.lang.Object |
|
Field Detail |
private PK11Token token
private EncryptionAlgorithm algorithm
private java.security.spec.AlgorithmParameterSpec parameters
private SymmetricKey key
private byte[] IV
private CipherContextProxy contextProxy
private int state
private static final int UNINITIALIZED
private static final int ENCRYPT
private static final int DECRYPT
Constructor Detail |
private PK11Cipher()
PK11Cipher(PK11Token token, EncryptionAlgorithm algorithm)
Method Detail |
public void initEncrypt(SymmetricKey key) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException, TokenException
Cipher
initEncrypt
in class Cipher
public void initDecrypt(SymmetricKey key) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException, TokenException
Cipher
initDecrypt
in class Cipher
public void initEncrypt(SymmetricKey key, java.security.spec.AlgorithmParameterSpec parameters) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException, TokenException
Cipher
initEncrypt
in class Cipher
public void initDecrypt(SymmetricKey key, java.security.spec.AlgorithmParameterSpec parameters) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException, TokenException
Cipher
initDecrypt
in class Cipher
public byte[] update(byte[] bytes) throws java.lang.IllegalStateException, TokenException
Cipher
update
in class Cipher
org.mozilla.jss.crypto.Cipher
bytes
- Bytes of plaintext (if encrypting) or ciphertext (if
decrypting).public byte[] update(byte[] bytes, int offset, int length) throws java.lang.IllegalStateException, TokenException
Cipher
update
in class Cipher
org.mozilla.jss.crypto.Cipher
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.public byte[] doFinal(byte[] bytes) throws java.lang.IllegalStateException, IllegalBlockSizeException, BadPaddingException, TokenException
Cipher
update
may be called
any number of times before calling final
.doFinal
in class Cipher
org.mozilla.jss.crypto.Cipher
bytes
- Bytes of plaintext (if encrypting) or ciphertext (if
decrypting).public byte[] doFinal(byte[] bytes, int offset, int length) throws java.lang.IllegalStateException, IllegalBlockSizeException, BadPaddingException, TokenException
Cipher
doFinal
in class Cipher
org.mozilla.jss.crypto.Cipher
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.public byte[] doFinal() throws java.lang.IllegalStateException, IllegalBlockSizeException, BadPaddingException, TokenException
Cipher
doFinal
in class Cipher
org.mozilla.jss.crypto.Cipher
private static CipherContextProxy initContext(boolean encrypt, SymmetricKey key, EncryptionAlgorithm alg, byte[] IV) throws TokenException
private static byte[] updateContext(CipherContextProxy context, byte[] input, int blocksize) throws TokenException
private static byte[] finalizeContext(CipherContextProxy context, int blocksize, boolean padded) throws TokenException, IllegalBlockSizeException, BadPaddingException
private void reset()
private void checkParams(java.security.spec.AlgorithmParameterSpec params) throws java.security.InvalidAlgorithmParameterException
private void checkKey(SymmetricKey key) throws java.security.InvalidKeyException
|
JSS 3.1.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |