|
JSS 3.2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | 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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 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 Cipherjava.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
TokenException
public void initDecrypt(SymmetricKey key)
throws java.security.InvalidKeyException,
java.security.InvalidAlgorithmParameterException,
TokenException
Cipher
initDecrypt in class Cipherjava.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
TokenException
public void initEncrypt(SymmetricKey key,
java.security.spec.AlgorithmParameterSpec parameters)
throws java.security.InvalidKeyException,
java.security.InvalidAlgorithmParameterException,
TokenException
Cipher
initEncrypt in class Cipherjava.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
TokenException
public void initDecrypt(SymmetricKey key,
java.security.spec.AlgorithmParameterSpec parameters)
throws java.security.InvalidKeyException,
java.security.InvalidAlgorithmParameterException,
TokenException
Cipher
initDecrypt in class Cipherjava.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
TokenException
public byte[] update(byte[] bytes)
throws java.lang.IllegalStateException,
TokenException
Cipher
update in class Cipherbytes - Bytes of plaintext (if encrypting) or ciphertext (if
decrypting).
java.lang.IllegalStateException
TokenException
public byte[] update(byte[] bytes,
int offset,
int length)
throws java.lang.IllegalStateException,
TokenException
Cipher
update in class Cipherbytes - 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 byte[] doFinal(byte[] bytes)
throws java.lang.IllegalStateException,
IllegalBlockSizeException,
BadPaddingException,
TokenException
Cipherupdate may be called
any number of times before calling final.
doFinal in class Cipherbytes - Bytes of plaintext (if encrypting) or ciphertext (if
decrypting).
java.lang.IllegalStateException
IllegalBlockSizeException
BadPaddingException
TokenException
public byte[] doFinal(byte[] bytes,
int offset,
int length)
throws java.lang.IllegalStateException,
IllegalBlockSizeException,
BadPaddingException,
TokenException
Cipher
doFinal in class Cipherbytes - 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 byte[] doFinal()
throws java.lang.IllegalStateException,
IllegalBlockSizeException,
BadPaddingException,
TokenException
Cipher
doFinal in class Cipherjava.lang.IllegalStateException
IllegalBlockSizeException
BadPaddingException
TokenException
private static CipherContextProxy initContext(boolean encrypt,
SymmetricKey key,
EncryptionAlgorithm alg,
byte[] IV)
throws TokenException
TokenException
private static byte[] updateContext(CipherContextProxy context,
byte[] input,
int blocksize)
throws TokenException
TokenException
private static byte[] finalizeContext(CipherContextProxy context,
int blocksize,
boolean padded)
throws TokenException,
IllegalBlockSizeException,
BadPaddingException
TokenException
IllegalBlockSizeException
BadPaddingExceptionprivate void reset()
private void checkParams(java.security.spec.AlgorithmParameterSpec params)
throws java.security.InvalidAlgorithmParameterException
java.security.InvalidAlgorithmParameterException
private void checkKey(SymmetricKey key)
throws java.security.InvalidKeyException
java.security.InvalidKeyException
|
JSS 3.2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||