|
XML Security, 1.6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ibm.xml.enc.dom.DOMStructure
com.ibm.xml.enc.dom.DOMEncryptionMethod
abstract class DOMEncryptionMethod
DOM-based abstract implementation of EncryptionMethod.
| Field Summary |
|---|
| Fields inherited from interface javax.xml.crypto.enc.EncryptionMethod |
|---|
AES128_CBC, AES192_CBC, AES256_CBC, KW_AES128, KW_AES192, KW_AES256, KW_TRIPLEDES, RSA_1_5, RSA_OAEP_MGF1P, TRIPLEDES_CBC |
| Constructor Summary | |
|---|---|
(package private) |
DOMEncryptionMethod()
|
protected |
DOMEncryptionMethod(org.w3c.dom.Element emElem)
Creates a DOMEncryptionMethod from an element. |
protected |
DOMEncryptionMethod(java.lang.String algorithm,
java.lang.Integer keySize,
java.security.spec.AlgorithmParameterSpec params)
Creates a DOMEncryptionMethod. |
| Method Summary | |
|---|---|
protected abstract void |
checkParams(java.lang.Integer keySize,
EncryptionMethodParameterSpec params)
Checks if the specified parameters are valid for this algorithm. |
abstract byte[] |
decrypt(java.security.Key key,
byte[] encrypted)
decrypt the specified bytes with the specified key, using the underlying encryption algorithm. |
abstract java.security.Key |
decryptKey(java.security.Key key,
byte[] encrypted,
AlgorithmMethod algo)
|
abstract byte[] |
encrypt(java.security.Key key,
byte[] data,
EncryptedType type)
encrypt the passed-in data with the specified key, using the underlying encryption algorithm and parameters. |
boolean |
equals(java.lang.Object o)
|
protected java.security.Key |
genKey(byte[] keybytes,
java.lang.String alg)
|
java.lang.String |
getAlgorithm()
Returns the algorithm URI of this AlgorithmMethod. |
java.lang.Integer |
getKeySize()
Returns the size of the key to be used with this EncryptionMethod. |
java.security.spec.AlgorithmParameterSpec |
getParameterSpec()
Returns algorithm-specific parameters for this EncryptionMethod. |
protected void |
init(java.lang.String algorithm,
java.lang.Integer keySize,
java.security.spec.AlgorithmParameterSpec params)
|
void |
marshal(org.w3c.dom.Node parent,
java.lang.String encPrefix,
DOMCryptoContext context)
This method invokes the abstract marshalParams
method to marshal any algorithm-specific parameters. |
protected abstract void |
marshalParams(org.w3c.dom.Element parent,
java.lang.String paramsPrefix)
Marshals the algorithm-specific parameters to an Element and appends it to the specified parent element. |
protected abstract boolean |
paramsEqual(java.security.spec.AlgorithmParameterSpec spec)
Returns true if parameters are equal; false otherwise. |
java.lang.String |
parseAlg(AlgorithmMethod algo)
|
(package private) static EncryptionMethod |
unmarshal(org.w3c.dom.Element emElem)
|
protected abstract EncryptionMethodParameterSpec |
unmarshalParams(org.w3c.dom.Element paramsElem)
Unmarshals EncryptionMethodParameterSpec from the specified
Element. |
abstract byte[] |
unwrap(java.security.Key key,
byte[] encrypted)
unwraps a previously wrapped key using the underlying encryption algorithm. |
abstract java.security.Key |
unwrap(java.security.Key key,
byte[] encrypted,
AlgorithmMethod algo)
unwraps a previously wrapped key using the underlying encryption algorithm. |
abstract byte[] |
wrap(java.security.Key key,
java.security.Key toBeWrapped)
encrypt the passed-in key with the specified key, using the underlying encryption algorithm and parameters. |
| Methods inherited from class com.ibm.xml.enc.dom.DOMStructure |
|---|
isFeatureSupported |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.xml.crypto.XMLStructure |
|---|
isFeatureSupported |
| Constructor Detail |
|---|
DOMEncryptionMethod()
protected DOMEncryptionMethod(java.lang.String algorithm,
java.lang.Integer keySize,
java.security.spec.AlgorithmParameterSpec params)
throws java.security.InvalidAlgorithmParameterException
DOMEncryptionMethod.
algorithm - the URI identifying the encryption algorithmkeySize - the optional keySizeparams - the algorithm-specific params (may be null)
java.lang.NullPointerException - if algorithm is
null
java.security.InvalidAlgorithmParameterException - if the parameters are not
appropriate for this encryption method
protected DOMEncryptionMethod(org.w3c.dom.Element emElem)
throws MarshalException
DOMEncryptionMethod from an element. This ctor
invokes the abstract unmarshalParams method to
unmarshal any algorithm-specific input parameters.
It extracts the KeySize information if available. The ctor then
invokes the abstract checkParams method to
validate the compliance of the parameters
emElem - a EncryptionMethod element
MarshalException| Method Detail |
|---|
protected void init(java.lang.String algorithm,
java.lang.Integer keySize,
java.security.spec.AlgorithmParameterSpec params)
throws java.security.InvalidAlgorithmParameterException
java.security.InvalidAlgorithmParameterException
protected abstract EncryptionMethodParameterSpec unmarshalParams(org.w3c.dom.Element paramsElem)
throws MarshalException
EncryptionMethodParameterSpec from the specified
Element. Subclasses should implement this to unmarshal
the algorithm-specific parameters.
paramsElem - the Element holding the input params
EncryptionMethodParameterSpec
MarshalException - if the parameters cannot be unmarshalled
static EncryptionMethod unmarshal(org.w3c.dom.Element emElem)
throws MarshalException
MarshalException
protected abstract void checkParams(java.lang.Integer keySize,
EncryptionMethodParameterSpec params)
throws java.security.InvalidAlgorithmParameterException
params - the algorithm-specific params (may be null)
java.security.InvalidAlgorithmParameterException - if the parameters are not
appropriate for this encryption methodpublic final java.security.spec.AlgorithmParameterSpec getParameterSpec()
EncryptionMethodEncryptionMethod.
The returned parameters can be typecast to a
EncryptionMethodParameterSpec object.
getParameterSpec in interface AlgorithmMethodgetParameterSpec in interface EncryptionMethodEncryptionMethod. (may be null
if not specified)public final java.lang.String getAlgorithm()
AlgorithmMethodAlgorithmMethod.
getAlgorithm in interface AlgorithmMethodAlgorithmMethodpublic final java.lang.Integer getKeySize()
EncryptionMethodEncryptionMethod.
getKeySize in interface EncryptionMethodnull if not specified
public void marshal(org.w3c.dom.Node parent,
java.lang.String encPrefix,
DOMCryptoContext context)
throws MarshalException
marshalParams
method to marshal any algorithm-specific parameters.
marshal in class DOMStructureMarshalException
public abstract byte[] encrypt(java.security.Key key,
byte[] data,
EncryptedType type)
throws java.security.InvalidKeyException,
javax.crypto.IllegalBlockSizeException
key - the encryption keydata - the data bytes to be encrytped
java.lang.NullPointerException - if key or
data are null
java.security.InvalidKeyException - if the key is improperly encoded, of
the wrong type, or parameters are missing, etc
javax.crypto.IllegalBlockSizeException - if this cipher is a block cipher,
no padding has been requested (only in encryption mode), and the
total input length of the data processed by this cipher is not a
multiple of block size
public abstract byte[] decrypt(java.security.Key key,
byte[] encrypted)
throws java.security.InvalidKeyException,
javax.crypto.BadPaddingException,
javax.crypto.IllegalBlockSizeException
key - the decryption keyencrypted - the bytes to be decrypted
java.lang.NullPointerException - if key or
data are null
java.security.InvalidKeyException - if the key is improperly encoded, of
the wrong type, or parameters are missing, etc
javax.crypto.BadPaddingException - if unpadding has been requested, but the
decrypted data is not bounded by the appropriate padding bytes
javax.crypto.IllegalBlockSizeException - if this cipher is a block cipher,
no padding has been requested (only in encryption mode), and the
total input length of the data processed by this cipher is not a
multiple of block size
public abstract java.security.Key decryptKey(java.security.Key key,
byte[] encrypted,
AlgorithmMethod algo)
throws java.security.InvalidKeyException,
javax.crypto.BadPaddingException,
javax.crypto.IllegalBlockSizeException,
java.security.NoSuchAlgorithmException
java.security.InvalidKeyException
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
java.security.NoSuchAlgorithmException
public abstract byte[] wrap(java.security.Key key,
java.security.Key toBeWrapped)
throws java.security.InvalidKeyException,
javax.crypto.IllegalBlockSizeException
key - the encryption keytoBeWrapped - the key to be encrypted
java.lang.NullPointerException - if key or
data are null
java.security.InvalidKeyException - if the key is improperly encoded, of
the wrong type, or parameters are missing, etc
javax.crypto.IllegalBlockSizeException - if this cipher is a block cipher,
no padding has been requested (only in encryption mode), and the
total input length of the data processed by this cipher is not a
multiple of block size
public abstract byte[] unwrap(java.security.Key key,
byte[] encrypted)
throws java.security.InvalidKeyException,
javax.crypto.BadPaddingException,
javax.crypto.IllegalBlockSizeException
key - the decryption keyencrypted - the wrapped key to be unwrapped
java.lang.NullPointerException - if key or
data are null
java.security.InvalidKeyException - if the key is improperly encoded, of
the wrong type, or parameters are missing, etc
javax.crypto.BadPaddingException - if unpadding has been requested, but the
decrypted data is not bounded by the appropriate padding bytes
javax.crypto.IllegalBlockSizeException - if this cipher is a block cipher,
no padding has been requested (only in encryption mode), and the
total input length of the data processed by this cipher is not a
multiple of block size
public abstract java.security.Key unwrap(java.security.Key key,
byte[] encrypted,
AlgorithmMethod algo)
throws java.security.InvalidKeyException,
javax.crypto.BadPaddingException,
javax.crypto.IllegalBlockSizeException,
java.security.NoSuchAlgorithmException
key - the decryption keyencrypted - the wrapped key to be unwrappedalgo - the algorithm of the decrypted key
java.lang.NullPointerException - if key or
data are null
java.security.InvalidKeyException - if the key is improperly encoded, of
the wrong type, or parameters are missing, etc
javax.crypto.BadPaddingException - if unpadding has been requested, but the
decrypted data is not bounded by the appropriate padding bytes
javax.crypto.IllegalBlockSizeException - if this cipher is a block cipher,
no padding has been requested (only in encryption mode), and the
total input length of the data processed by this cipher is not a
multiple of block size
java.security.NoSuchAlgorithmException
protected abstract void marshalParams(org.w3c.dom.Element parent,
java.lang.String paramsPrefix)
throws MarshalException
parent - the parent element to append the parameters toparamsPrefix - the algorithm parameters prefix to use
MarshalException - if the parameters cannot be marshalledprotected abstract boolean paramsEqual(java.security.spec.AlgorithmParameterSpec spec)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String parseAlg(AlgorithmMethod algo)
protected java.security.Key genKey(byte[] keybytes,
java.lang.String alg)
throws java.security.InvalidKeyException
java.security.InvalidKeyException
|
XML Security, 1.6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||