|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.owasp.esapi.crypto.CipherSpec
public final class CipherSpec
Specifies all the relevant configuration data needed in constructing and
using a Cipher
except for the encryption key.
The "setters" all return a reference to this
so that they can be
strung together.
Note: While this is a useful class in it's own right, it should primarily be regarded as an implementation class to use with ESAPI encryption, especially the reference implementation. It is not intended to be used directly by application developers, but rather only by those either extending ESAPI or in the ESAPI reference implementation. Use directly by application code is not recommended or supported.
Constructor Summary | |
---|---|
CipherSpec()
Default CTOR. |
|
CipherSpec(byte[] iv)
|
|
CipherSpec(javax.crypto.Cipher cipher)
CTOR that sets everything except for the cipher key size and possibly the IV. |
|
CipherSpec(javax.crypto.Cipher cipher,
int keySize)
CTOR that sets everything. |
|
CipherSpec(java.lang.String cipherXform,
int keySize)
CTOR that sets everything but block size and IV. |
|
CipherSpec(java.lang.String cipherXform,
int keySize,
byte[] iv)
CTOR that sets everything except block size. |
|
CipherSpec(java.lang.String cipherXform,
int keySize,
int blockSize)
CTOR that sets everything but IV. |
|
CipherSpec(java.lang.String cipherXform,
int keySize,
int blockSize,
byte[] iv)
CTOR that explicitly sets everything. |
Method Summary | |
---|---|
protected boolean |
canEqual(java.lang.Object other)
Needed for correct definition of equals for general classes. |
boolean |
equals(java.lang.Object other)
|
int |
getBlockSize()
Retrieve the block size, in bytes. |
java.lang.String |
getCipherAlgorithm()
Retrieve the cipher algorithm. |
java.lang.String |
getCipherMode()
Retrieve the cipher mode. |
java.lang.String |
getCipherTransformation()
Get the cipher transformation. |
byte[] |
getIV()
Retrieve the initialization vector (IV). |
int |
getKeySize()
Retrieve the key size, in bits. |
java.lang.String |
getPaddingScheme()
Retrieve the cipher padding scheme. |
int |
hashCode()
|
boolean |
requiresIV()
Return true if the cipher mode requires an IV. |
CipherSpec |
setBlockSize(int blockSize)
Set the block size for this CipherSpec . |
CipherSpec |
setCipherTransformation(java.lang.String cipherXform)
Set the cipher transformation for this CipherSpec . |
CipherSpec |
setIV(byte[] iv)
Set the initialization vector (IV). |
CipherSpec |
setKeySize(int keySize)
Set the key size for this CipherSpec . |
java.lang.String |
toString()
Override Object.toString() to provide something more useful. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CipherSpec(java.lang.String cipherXform, int keySize, int blockSize, byte[] iv)
cipherXform
- The cipher transformationkeySize
- The key size (in bits).blockSize
- The block size (in bytes).iv
- The initialization vector. Null if not applicable.public CipherSpec(java.lang.String cipherXform, int keySize, int blockSize)
cipherXform
- The cipher transformationkeySize
- The key size (in bits).blockSize
- The block size (in bytes).public CipherSpec(java.lang.String cipherXform, int keySize)
public CipherSpec(java.lang.String cipherXform, int keySize, byte[] iv)
public CipherSpec(javax.crypto.Cipher cipher)
public CipherSpec(javax.crypto.Cipher cipher, int keySize)
public CipherSpec(byte[] iv)
public CipherSpec()
null
IV.
Method Detail |
---|
public CipherSpec setCipherTransformation(java.lang.String cipherXform)
CipherSpec
.
cipherXform
- The cipher transformation string; e.g., "DESede/CBC/PKCS5Padding".
CipherSpec
object.public java.lang.String getCipherTransformation()
String
.public CipherSpec setKeySize(int keySize)
CipherSpec
.
keySize
- The key size, in bits. Must be positive integer.
CipherSpec
object.public int getKeySize()
public CipherSpec setBlockSize(int blockSize)
CipherSpec
.
blockSize
- The block size, in bytes. Must be positive integer.
CipherSpec
object.public int getBlockSize()
public java.lang.String getCipherAlgorithm()
public java.lang.String getCipherMode()
public java.lang.String getPaddingScheme()
public byte[] getIV()
public CipherSpec setIV(byte[] iv)
iv
- The byte array to set as the IV. A copy of the IV is saved.
This parameter is ignored if the cipher mode does not
require an IV.
CipherSpec
object.public boolean requiresIV()
public java.lang.String toString()
Object.toString()
to provide something more useful.
toString
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
protected boolean canEqual(java.lang.Object other)
See http://www.artima.com/lejava/articles/equality.html
for full explanation.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |