|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.webdocwf.util.smime.crypto.SymmetricEncryption
SymmetricEncryption class is used for symmetric encryption large amounts
of data. Algorithm names and corresponding key lengths are:
DES - 56
DES_EDE3_CBC - 128, 192
RC2_CBC - 40, 64, 128
Constructor Summary | |
SymmetricEncryption(java.lang.String algorithmName0,
int keyLength0)
Construction with the given algorithm name and key size in bits. |
Method Summary | |
void |
decryption(byte[] forDecrypt)
Decription of the byte array with the symmetric key and IV previously generated by the process of encryption in the same session with the same object. |
void |
decryption(byte[] forDecrypt,
byte[] simKey0,
byte[] iv0)
Decription of the byte array with the given symmetric key and initialization vector (IV) |
void |
encryption(byte[] forEncrypt0)
Encryption of the byte array with random generated key |
void |
encryption(byte[] forEncrypt0,
byte[] simKey0)
Encryption of the byte array with the given symmetric key |
java.lang.String |
getAlgorithmName()
Returns the algorithm name used for symmetric encryption. |
byte[] |
getDecryptedValue()
Returns the decrypted content |
byte[] |
getEncryptedValue()
Returns the encrypted content. |
byte[] |
getIV()
Returns the initialization vector (IV) used for Symmetric Cipher and the chosen algorithm. |
int |
getKeyLength()
Returns the key size in bits used for chosen algorithm name. |
byte[] |
getSymmetricKey()
Returns the generated symmetric key in bytes. |
void |
reset()
Resets (sets to null) all private attributes in generated instance of the class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SymmetricEncryption(java.lang.String algorithmName0, int keyLength0) throws SMIMEException
algorithmName0
- is name of algorithm: "DES", "DES_EDE3_CBC" or "RC2_CBC".keyLength
- is key size in bits.SMIMEException
- thrown in case of invalid algorithm names, or in
case of wrong key sizes in bits.Method Detail |
public void encryption(byte[] forEncrypt0) throws SMIMEException
forEncrypt0
- is byte array for encryptionSMIMEException
- caused by non SMIMEException which can be one of
the following: NoSuchPaddingException, NoSuchProviderException,
NoSuchAlgorithmException, InvalidKeyException, BadPaddingException,
IllegalBlockSizeException.public void encryption(byte[] forEncrypt0, byte[] simKey0) throws SMIMEException
forEncrypt0
- is byte array for encryptionsimKey0
- symmetric keySMIMEException
- if number of bytes in imported symmetric Key is
incorect. Also, can be caused by non SMIMEException which can be one of the following:
NoSuchPaddingException, NoSuchProviderException, NoSuchAlgorithmException,
InvalidKeyException, BadPaddingException, IllegalBlockSizeException.public java.lang.String getAlgorithmName()
public int getKeyLength()
public byte[] getIV()
public byte[] getSymmetricKey()
public byte[] getEncryptedValue()
public void decryption(byte[] forDecrypt) throws SMIMEException
forDecrypt
- previosly encrypted byte arraySMIMEException
- caused by non SMIMEException which can be one of the following:
NoSuchPaddingException, NoSuchProviderException, NoSuchAlgorithmException,
InvalidKeyException, BadPaddingException, IllegalBlockSizeException.public void decryption(byte[] forDecrypt, byte[] simKey0, byte[] iv0) throws SMIMEException
forDecrypt
- byte array for encryptionsimKey0
- imported symetric keyiv0
- imported initialization vectorSMIMEException
- if number of bytes in imported symmetric key is
incorect, or if number of bytes in imported IV isn't 8. Also, can be caused
by non SMIMEException which can be one of the following:
NoSuchPaddingException, NoSuchProviderException, NoSuchAlgorithmException,
InvalidKeyException, BadPaddingException, IllegalBlockSizeException.public byte[] getDecryptedValue()
public void reset()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |