public class EncryptionMethodImpl extends AlgorithmMethodImpl implements EncryptionMethod
EncryptionMethod element that supports
the DOM XML representation and processing mechanism.DOMStructure.NodeWrapper| Modifier and Type | Field and Description |
|---|---|
protected Cipher |
cipher_
The Cipher.
|
protected KeySizeImpl |
keySize_
The
KeySize. |
algorithm_, params_, spec_implMap_, state_, STATE_CREATED, STATE_MARSHALED, STATE_UNINITIALIZED, STATE_UNMARSHALEDAES128_CBC, AES192_CBC, AES256_CBC, KW_AES128, KW_AES192, KW_AES256, KW_TRIPLEDES, RSA_1_5, RSA_OEAP_MGF1P, TRIPLEDES_CBC| Constructor and Description |
|---|
EncryptionMethodImpl(DOMCryptoContext context,
Node node)
Creates a new instance of this
NewEncryptionMethodImpl with
the specified context and node to unmarshal from. |
EncryptionMethodImpl(String algorithm,
Integer keySize,
EncryptionMethodParameterSpec params)
Creates a new instance of this
NewEncryptionMethodImpl with
the specified algorithm URI, key size and encryption method parameters. |
| Modifier and Type | Method and Description |
|---|---|
InputStream |
decrypt(Key key,
InputStream cipherText)
Decrypts the given
cipherText using the represented encryption
method with the given key. |
InputStream |
encrypt(Key key,
InputStream plainText)
Encrypts the given
plainText using the represented encryption
method with the given key. |
OutputStream |
encrypt(Key key,
OutputStream cipherTexgt)
Encrypts the given
plainText using the represented encryption
method with the given key. |
protected void |
getAlgorithmInstanceUncaught(XSecProvider.Purpose purpose) |
protected List |
getChildStructures()
Returns the list of child structures of this
DOMStructure. |
Integer |
getKeySize()
Returns the size of the key to be used with this
EncryptionMethod. |
String |
getLocalName()
Returns the local name of the represented XML element.
|
String |
getNamespace()
Returns the namespace URI of the represented XML element.
|
protected Class |
getParameterSpecClass()
)
|
protected void |
putChildStructure(DOMStructure childStructure)
Put an unmarshalled child structure.
|
protected void |
unmarshalStructures(NodeList nodes,
DOMCryptoContext context)
Unmarshals
DOMStructures from the given nodes. |
Key |
unwrapKey(Key key,
byte[] wrappedKey,
String wrappedKeyAlgorithm,
int wrappedKeyType)
Unwraps a key from the given
wrappedKey bytes using the
represented encryption method with the given key. |
byte[] |
wrapKey(Key key,
Key tbeKey)
Wrap the given
tbeKey using the represented encryption method
using the given key. |
containsElements, getAlgorithm, getAlgorithmInstance, getParameterSpec, getParamInstanceUncaught, marshal, marshalAttributes, unmarshalAttributesaddBytesToElement, addBytesToElement, clearMarshalling, clearMarshalling, getBytesFromElement, getBytesFromElementStream, getChildStructureVersion, getHere, getImplClass, getInstance, getInstance, getNode, getParentStructure, getParentStructureOf, getQualifiedName, getQualifiedName, hasNSDeclAttrInScope, isFeatureSupported, isNSDeclInScope, marshalElement, marshalIDAttribute, newIDforLookUp, putImplClass, setBackToCompatibilityPrior1_14, setNode, setParentStructure, toString, unmarshal, unmarshalElement, unmarshalIDAttribute, wrapNodeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetParameterSpecgetAlgorithmisFeatureSupportedprotected Cipher cipher_
protected KeySizeImpl keySize_
KeySize.public EncryptionMethodImpl(String algorithm, Integer keySize, EncryptionMethodParameterSpec params) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException
NewEncryptionMethodImpl with
the specified algorithm URI, key size and encryption method parameters.algorithm - the algorithm URI. (must be RFC 2396 complaint)keySize - the key size (may be null)params - the encryption method parameters (may be null)NoSuchAlgorithmException - if no implementation of the given algorithm is foundInvalidAlgorithmParameterException - if the specified algorithm params are not appropriate
for the given algorithmpublic EncryptionMethodImpl(DOMCryptoContext context, Node node) throws MarshalException
NewEncryptionMethodImpl with
the specified context and node to unmarshal from.context - the contextnode - the node to unmarshal fromMarshalException - if an excpetion occurs during unmarshalingprotected void getAlgorithmInstanceUncaught(XSecProvider.Purpose purpose) throws NoSuchAlgorithmException
getAlgorithmInstanceUncaught in class AlgorithmMethodImplNoSuchAlgorithmExceptionpublic String getLocalName()
DOMStructuregetLocalName in class DOMStructureDOMStructure.getLocalName()public String getNamespace()
DOMStructuregetNamespace in class DOMStructureDOMStructure.getNamespace()public Integer getKeySize()
javax.xml.crypto.enc.EncryptionMethodEncryptionMethod.getKeySize in interface EncryptionMethodEncryptionMethod.getKeySize()protected void unmarshalStructures(NodeList nodes, DOMCryptoContext context) throws MarshalException
DOMStructureDOMStructures from the given nodes.
This method is called by DOMStructure.unmarshal(DOMCryptoContext).
This method calls DOMStructure.getInstance(Node, DOMCryptoContext) for every
Element in the list of nodes. If
DOMStructure.getInstance(Node, DOMCryptoContext) returns a
DOMStructure DOMStructure.putChildStructure(DOMStructure) is
called with the returned DOMStructure as parameter.
unmarshalStructures in class AlgorithmMethodImplnodes - the nodes to unmarshal fromcontext - the marshal contextMarshalException - if an exception occurs during marshalingDOMStructure.unmarshalStructures(org.w3c.dom.NodeList,
DOMCryptoContext)protected List getChildStructures()
DOMStructureDOMStructure.
This method is called by DOMStructure.marshal(DOMCryptoContext, Node, Node).
A subclass has to overwrite this method to return a list of
DOMStrucutres represented by this subclass.
getChildStructures in class DOMStructureDOMStructures (may be empty, but never
null)DOMStructure.getChildStructures()protected void putChildStructure(DOMStructure childStructure) throws MarshalException
DOMStructure
This method is called by
DOMStructure.unmarshalStructures(NodeList, DOMCryptoContext) for every
unmarshalled child structure.
A subclass has to overwrite this method to store the given child structure in its the corresponding field.
putChildStructure in class DOMStructurechildStructure - the unmarshalled child structureMarshalExceptionDOMStructure.putChildStructure(iaik.xml.crypto.dom.DOMStructure)public byte[] wrapKey(Key key, Key tbeKey) throws XMLEncryptionException
tbeKey using the represented encryption method
using the given key.key - the key used for wrappingtbeKey - the key to be wrappedXMLEncryptionException - if an unexpected exception occurs during encryptionpublic Key unwrapKey(Key key, byte[] wrappedKey, String wrappedKeyAlgorithm, int wrappedKeyType) throws XMLEncryptionException
wrappedKey bytes using the
represented encryption method with the given key.key - the key used for unwrappingwrappedKey - the raw wrapped keywrappedKeyAlgorithm - the algorithm of the wrapped keywrappedKeyType - the type of wrapped keyXMLEncryptionException - if an unexpected exception occurs during unwrappingpublic InputStream decrypt(Key key, InputStream cipherText) throws XMLEncryptionException
cipherText using the represented encryption
method with the given key.key - the key used for decryptioncipherText - the cipher bytesXMLEncryptionException - if an exception occurs during decryptionpublic InputStream encrypt(Key key, InputStream plainText) throws XMLEncryptionException
plainText using the represented encryption
method with the given key.key - the key used for encryptionplainText - the plain text bytesXMLEncryptionException - if an exception occurs during encryptionpublic OutputStream encrypt(Key key, OutputStream cipherTexgt) throws XMLEncryptionException
plainText using the represented encryption
method with the given key.key - the key used for encryptioncipherTexgt - the cipher text bytesXMLEncryptionException - if an exception occurs during encryptionprotected Class getParameterSpecClass()
getParameterSpecClass in class AlgorithmMethodImplClass of the concrete parameter spec to be returned by
AlgorithmMethodImpl.getParameterSpec().AlgorithmMethodImpl.getParameterSpecClass()© 2002-2005 IAIK, © 2004, 2006 - 2019 Stiftung SIC