public class CkiSymmetricCipher
extends oracle.security.crypto.core.BlockCipher
| Constructor and Description |
|---|
CkiSymmetricCipher()
Empty constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
algName()
Returns the name of the algorithm used by this Symmetric Cipher object.
|
byte[] |
decrypt(byte[] bytes) |
byte[] |
decrypt(byte[] bytes, int offset, int length, boolean unpad)
Decrypts a sequence of bytes of specified length and, if specified, removes padding.
|
void |
decrypt(byte[] in, int inOff, int inLen, byte[] out, int outOff)
Decrypt an array of bytes.
|
void |
decryptBlock(byte[] in, int inOff, byte[] out, int outOff) |
void |
decryptOp(byte[] in, int inOff, byte[] out, int outOff)
Deprecated.
|
byte[] |
encrypt(byte[] bytes) |
byte[] |
encrypt(byte[] bytes, int offset, int length, boolean pad)
Encrypts a sequence of bytes of specified length and, if specified, performs padding.
|
void |
encrypt(byte[] in, int inOff, int inLen, byte[] out, int outOff)
Encrypt an array of bytes.
|
void |
encryptBlock(byte[] in, int inOff, byte[] out, int outOff) |
void |
encryptOp(byte[] in, int inOff, byte[] out, int outOff)
Deprecated.
|
void |
erase()
Erases the keys and the sensitive data of this
CkiSymmetricCipher object. |
protected void |
finalize() |
oracle.security.crypto.core.AlgorithmIdentifier |
getAlgID()
Returns the AlgorithmIdentifier used by this object.
|
static long |
getBlockSize(oracle.security.crypto.core.AlgorithmIdentifier algID)
Returns the blocksize of a symmetric cipher given the algID
|
static long |
getCkiMechanismID(oracle.security.crypto.core.AlgorithmIdentifier algID)
Returns the Cryptoki mechanism type given the algID parameter.
|
static long |
getCkiObjectID(oracle.security.crypto.core.AlgorithmIdentifier algID)
Returns the Cryptoki key type given the algID parameter.
|
int |
getEffectiveKeyLength()
Returns the effective key length.
|
void |
initialize(oracle.security.crypto.core.AlgorithmIdentifier algID, oracle.security.crypto.core.Key key)
This method verifies the AlgorithmIdentifier's Object ID and configures the CkiSymmetricCipher instance appropriately with the params of the AlgorithmIdentifier in addition to the Key.
|
void |
initialize(oracle.security.crypto.core.AlgorithmIdentifier algID, oracle.security.crypto.core.SymmetricKey key, oracle.security.crypto.core.Padding.ID paddingID)
This method may be used to initialize the CkiSymmetricCipher instance for use.
|
void |
setAlgID(oracle.security.crypto.core.AlgorithmIdentifier algID)
Deprecated.
|
void |
setDecryptionKey(oracle.security.crypto.core.Key key)
Deprecated.
|
void |
setEffectiveKeyLength(int len)
Sets the effective key length.
|
void |
setEncryptionKey(oracle.security.crypto.core.Key key)
Deprecated.
|
void |
setIV(byte[] iv)
Deprecated.
|
void |
setKey(oracle.security.crypto.core.SymmetricKey userKey)
Deprecated.
|
void |
setSession(CkiMgtSession session)
Sets the CkiMgtSession to use.
|
a, a, b, getBlockSize, getIV, getPaddingID, initialize, unwrapPrivateKey, unwrapSymmetricKey, wrapKey, wrapKeypublic CkiSymmetricCipher()
public void initialize(oracle.security.crypto.core.AlgorithmIdentifier algID,
oracle.security.crypto.core.Key key)
throws oracle.security.crypto.core.AlgorithmIdentifierException,
oracle.security.crypto.core.InvalidKeyException,
oracle.security.crypto.core.CipherException
initialize in class oracle.security.crypto.core.CipheralgID - is the AlgorithmIdentifier whose params will be used to configure the cipher.key - is the Key instance that will be cloned and used by the cipher internally. This instance will be erased when the Cipher.erase() is called.oracle.security.crypto.core.AlgorithmIdentifierException - is thrown if the algID's OID isn't valid for the Cipher instance being initialized or if the params are not valid for the algID's OID.oracle.security.crypto.core.InvalidKeyException - is thrown if there is a problem with the Key instance the Cipher is being initialized with.oracle.security.crypto.core.CipherException - is thrown if the op argument is null.
public void initialize(oracle.security.crypto.core.AlgorithmIdentifier algID,
oracle.security.crypto.core.SymmetricKey key,
oracle.security.crypto.core.Padding.ID paddingID)
throws oracle.security.crypto.core.AlgorithmIdentifierException,
oracle.security.crypto.core.InvalidKeyException,
oracle.security.crypto.core.CipherException
initialize in class oracle.security.crypto.core.CipheralgID - is the AlgorithmIdentifier whose params will be used to configure the cipher.key - is the Key instance that will be cloned and used by the cipher internally. This instance will be erased when the Cipher.erase() is called.paddingID - is used to indicate the type of padding that the Cipher should use. Options are Padding.NONE or Padding.PKCS5. A Cipher must be re-initialized before being used with the other Padding type.oracle.security.crypto.core.AlgorithmIdentifierException - is thrown if the algID's OID isn't valid for the Cipher instance being initialized or if the params are not valid for the algID's OID.oracle.security.crypto.core.InvalidKeyException - is thrown if there is a problem with the Key instance the Cipher is being initialized with.oracle.security.crypto.core.CipherException - is thrown if there is a problem initializing the Cipher.public void setSession(CkiMgtSession session)
public void setAlgID(oracle.security.crypto.core.AlgorithmIdentifier algID)
throws oracle.security.crypto.core.AlgorithmIdentifierException
oracle.security.crypto.core.AlgorithmIdentifierExceptionpublic oracle.security.crypto.core.AlgorithmIdentifier getAlgID()
getAlgID in class oracle.security.crypto.core.Cipherpublic java.lang.String algName()
algName in class oracle.security.crypto.core.Coder
public byte[] encrypt(byte[] bytes)
throws oracle.security.crypto.core.CipherException
encrypt in class oracle.security.crypto.core.Cipheroracle.security.crypto.core.CipherException
public byte[] encrypt(byte[] bytes,
int offset,
int length,
boolean pad)
throws oracle.security.crypto.core.CipherException
encrypt in class oracle.security.crypto.core.BlockCipherbytes - Buffer in which data to be encrypted is stored.offset - Offset within buffer of the start of the data.length - The length of the data.pad - True if padding is to be used, false otherwise.oracle.security.crypto.core.CipherException - if cipher not initialized, data is not a multiple of the block size and no padding is specified, etc.
public void encrypt(byte[] in,
int inOff,
int inLen,
byte[] out,
int outOff)
throws oracle.security.crypto.core.CipherException
encrypt in class oracle.security.crypto.core.BlockCipherin - array of bytes to be encryptedinOff - offset of the start of datainLen - the length of the dataout - array to place the encrypted bytesoutOff - offset of the start of the encrypted bytesoracle.security.crypto.core.CipherException - thrown if cipher not initialized, block size incorrect, etc.
public void encryptBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
throws oracle.security.crypto.core.CipherException
oracle.security.crypto.core.CipherException
public void encryptOp(byte[] in,
int inOff,
byte[] out,
int outOff)
throws oracle.security.crypto.core.CipherException
in - buffer in which data to be encrypted is storedinOff - offset within input buffer of the start of dataout - buffer to place the encrypted bytes inoutOff - offset within output buffer where the encrypted bytes will be storedoracle.security.crypto.core.CipherException - if cipher not initialized, length of data is not equal to the block size, etc.
public byte[] decrypt(byte[] bytes)
throws oracle.security.crypto.core.CipherException
decrypt in class oracle.security.crypto.core.Cipheroracle.security.crypto.core.CipherException
public byte[] decrypt(byte[] bytes,
int offset,
int length,
boolean unpad)
throws oracle.security.crypto.core.CipherException
decrypt in class oracle.security.crypto.core.BlockCipherbytes - Buffer in which data to be decrypted is stored.offset - Offset within buffer of the start of data.length - The length of the dataunpad - True if padding is to be removed, false otherwiseoracle.security.crypto.core.CipherException - if cipher not initialized, data is not a multiple of the block size and no padding is specified, etc.
public void decrypt(byte[] in,
int inOff,
int inLen,
byte[] out,
int outOff)
throws oracle.security.crypto.core.CipherException
decrypt in class oracle.security.crypto.core.BlockCipherin - array of bytes to be decryptedinOff - offset of the start of datainLen - the length of the dataout - array to place the decrypted bytesoutOff - offset of the start of the decrypted bytesoracle.security.crypto.core.CipherException - thrown if cipher not initialized, block size incorrect, etc.
public void decryptBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
throws oracle.security.crypto.core.CipherException
oracle.security.crypto.core.CipherException
public void decryptOp(byte[] in,
int inOff,
byte[] out,
int outOff)
throws oracle.security.crypto.core.CipherException
in - Buffer in which data to be decrypted is stored.inOff - Offset within input buffer of the start of data.out - Buffer to place the decrypted bytes inoutOff - Offset within output buffer where the encrypted bytes will be stored.oracle.security.crypto.core.CipherException - thrown if cipher not initialized, length of data is not equal to the block size, etc.
public void setIV(byte[] iv)
throws oracle.security.crypto.core.CipherException
iv - the IVoracle.security.crypto.core.CipherException
public void setEffectiveKeyLength(int len)
throws oracle.security.crypto.core.CipherException
setKey, otherwise the default value will be used.len - the effective key length in bits.oracle.security.crypto.core.CipherExceptionpublic int getEffectiveKeyLength()
public void setKey(oracle.security.crypto.core.SymmetricKey userKey)
throws oracle.security.crypto.core.InvalidKeyException
The algorithm-specified key expansion is performed at this time.
oracle.security.crypto.core.InvalidKeyException
public void setEncryptionKey(oracle.security.crypto.core.Key key)
throws oracle.security.crypto.core.InvalidKeyException
oracle.security.crypto.core.InvalidKeyException
public void setDecryptionKey(oracle.security.crypto.core.Key key)
throws oracle.security.crypto.core.InvalidKeyException
oracle.security.crypto.core.InvalidKeyExceptionpublic static long getCkiObjectID(oracle.security.crypto.core.AlgorithmIdentifier algID)
algID - The algorithm identifier of the symmetric key.public static long getCkiMechanismID(oracle.security.crypto.core.AlgorithmIdentifier algID)
algID - The algorithm identifier of the symmetric cipher.public static long getBlockSize(oracle.security.crypto.core.AlgorithmIdentifier algID)
public void erase()
CkiSymmetricCipher object.erase in class oracle.security.crypto.core.BlockCipherprotected void finalize()
finalize in class oracle.security.crypto.core.Cipher