public class EncryptedKeyImpl extends EncryptedTypeImpl implements EncryptedKey
EncryptedKey that supports the DOM XML
representation and processing mechanism.DOMStructure.NodeWrapper| Modifier and Type | Field and Description |
|---|---|
protected CarriedKeyNameImpl |
carriedKeyName_
The
CarriedKeyName. |
protected String |
keyAlgorithm_
The algorithm of the encrypted key.
|
protected String |
recipient_
The
Recipient-attribute value. |
protected ReferenceListImpl |
referenceList_
The
ReferenceList. |
cipherData_, encoding_, encryptionMethod_, encryptionProperties_, id_, keyInfo_, keySelectorResult_, mimeType_, provider_, tbe_, type_implMap_, state_, STATE_CREATED, STATE_MARSHALED, STATE_UNINITIALIZED, STATE_UNMARSHALEDTYPECONTENT, ELEMENT, XMLNS| Constructor and Description |
|---|
EncryptedKeyImpl(DOMCryptoContext context,
Node node)
Creates a new instance of this
EncryptedKeyImpl with the
specified context and node to unmarshal from. |
EncryptedKeyImpl(ToBeEncryptedKey key,
EncryptionMethodImpl encMethod,
KeyInfoImpl keyInfo,
EncryptionProperties properties,
List references,
String id,
String carriedKeyName,
String recipient,
CipherReferenceImpl cipherRef)
Creates a new instance of this
EncryptedKeyImpl with the
specified to-be-encrypted key, encryption method, KeyInfo, encryption
properties, list of DataReferenceImpls and KeyReferenceImpl
s, Id-attribute value, carried key name, recipient and
CipherReference. |
| Modifier and Type | Method and Description |
|---|---|
Key |
decryptKey(XMLDecryptContext context,
AlgorithmMethod alg)
Decrypts the
CipherData in this EncryptedKey and
returns the decrypted key as a Key object. |
void |
encrypt(XMLEncryptContext context)
Encrypts the
ToBeEncrypted passed to the construction of this
EncryptedType and inserts it in the CipherValue
or CipherReference of the CipherData of this
EncryptedData. |
String |
getCarriedKeyName()
Returns the carried key name of this
EncryptedKey. |
protected List |
getChildStructures()
Returns the list of child structures of this
DOMStructure. |
String |
getLocalName()
Returns the local name of the represented XML element.
|
String |
getRecipient()
Returns a hint as to which recipient this
EncryptedKey is
intended for. |
List |
getReferenceList()
Returns an unmodifiable list of
ReferenceTypes containing
pointers to data and keys encrypted using this key. |
protected void |
marshalAttributes(DOMCryptoContext context,
Element parent)
Marshals the XML representation of all
Attributes
represented by this DOMStrucuture. |
protected void |
putChildStructure(DOMStructure childStructure)
Put an unmarshalled child structure.
|
protected void |
unmarshalAttributes(NamedNodeMap attributes,
DOMCryptoContext context)
Unmarshal the given
attributes. |
decrypt, getCipherData, getCipherText, getEncoding, getEncryptionMethod, getEncryptionProperties, getId, getKeyInfo, getMimeType, getToBeEncrypted, getType, marshalIDAttribute, selectKeygetNamespace, initaddBytesToElement, addBytesToElement, clearMarshalling, clearMarshalling, getBytesFromElement, getBytesFromElementStream, getChildStructureVersion, getHere, getImplClass, getInstance, getInstance, getNode, getParentStructure, getParentStructureOf, getQualifiedName, getQualifiedName, hasNSDeclAttrInScope, isFeatureSupported, isNSDeclInScope, marshal, marshalElement, newIDforLookUp, putImplClass, setBackToCompatibilityPrior1_14, setNode, setParentStructure, toString, unmarshal, unmarshalElement, unmarshalIDAttribute, unmarshalStructures, wrapNodeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdecryptgetCipherData, getCipherText, getEncoding, getEncryptionMethod, getEncryptionProperties, getId, getKeyInfo, getMimeType, getToBeEncrypted, getTypeisFeatureSupportedprotected ReferenceListImpl referenceList_
ReferenceList.protected CarriedKeyNameImpl carriedKeyName_
CarriedKeyName.protected String recipient_
Recipient-attribute value.protected String keyAlgorithm_
public EncryptedKeyImpl(DOMCryptoContext context, Node node) throws MarshalException
EncryptedKeyImpl with the
specified context and node to unmarshal from.context - the contextnode - the node to unmarshal fromMarshalException - if an exception occurs during unmarshalingpublic EncryptedKeyImpl(ToBeEncryptedKey key, EncryptionMethodImpl encMethod, KeyInfoImpl keyInfo, EncryptionProperties properties, List references, String id, String carriedKeyName, String recipient, CipherReferenceImpl cipherRef)
EncryptedKeyImpl with the
specified to-be-encrypted key, encryption method, KeyInfo, encryption
properties, list of DataReferenceImpls and KeyReferenceImpl
s, Id-attribute value, carried key name, recipient and
CipherReference.key - the key to be encryptedencMethod - the encryption method (may be null)keyInfo - the key info (may be null)properties - the encryption properties (may be null)references - a list of DataReferenceImpls and KeyReferenceImpls
(may be null or empty)id - the Id-attribute value (may be null)carriedKeyName - the carried key name (may be null)recipient - the recipient (may be null)cipherRef - the CipherReference (may be null)NullPointerException - if key is nullClassCastException - if any of the references is not of type
DataReferenceImpl or KeyReferenceImplpublic String getLocalName()
DOMStructuregetLocalName in class DOMStructureDOMStructure.getLocalName()public List getReferenceList()
javax.xml.crypto.enc.keyinfo.EncryptedKeyReferenceTypes containing
pointers to data and keys encrypted using this key.getReferenceList in interface EncryptedKeyReferenceTypes (may be empty
but never null)EncryptedKey.getReferenceList()public String getCarriedKeyName()
javax.xml.crypto.enc.keyinfo.EncryptedKeyEncryptedKey.getCarriedKeyName in interface EncryptedKeynull if not specifiedEncryptedKey.getCarriedKeyName()public String getRecipient()
javax.xml.crypto.enc.keyinfo.EncryptedKeyEncryptedKey is
intended for.getRecipient in interface EncryptedKeynull if not specifiedEncryptedKey.getRecipient()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 EncryptedTypeImplDOMStructures (may be empty, but never
null)DOMStructure.getChildStructures()protected void marshalAttributes(DOMCryptoContext context, Element parent) throws MarshalException
DOMStructureAttributes
represented by this DOMStrucuture.
This method is called by DOMStructure.marshal(DOMCryptoContext, Node, Node).
If no namespace prefix is set in the context for the namespace
of the Element represented by this DOMStructure an
namespace declaration is marshaled and returned. Otherwise, an empty list
is returned.
A subclass has to overwrite this method in order to marshal any additional attributes.
marshalAttributes in class EncryptedTypeImplcontext - the marshal contextparent - the element is the parent of the attribute node created however, an
the attribute node is not a child of it's parent element. see XPath.MarshalException - if an exception occurs during marshalingDOMStructure.marshalAttributes(DOMCryptoContext,
Element)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 EncryptedTypeImplchildStructure - the unmarshalled child structureMarshalExceptionDOMStructure.putChildStructure(iaik.xml.crypto.dom.DOMStructure)protected void unmarshalAttributes(NamedNodeMap attributes, DOMCryptoContext context) throws MarshalException
DOMStructureattributes.
This method is called by DOMStructure.unmarshal(DOMCryptoContext).
A subclass has to overwrite this method to perform any special unmarshaling required.
unmarshalAttributes in class EncryptedTypeImplattributes - the Attributes to unmarshalcontext - the marshal contextMarshalException - if an exception occurs during unmarshalingDOMStructure.unmarshalAttributes(org.w3c.dom.NamedNodeMap,
DOMCryptoContext)public Key decryptKey(XMLDecryptContext context, AlgorithmMethod alg) throws XMLEncryptionException
javax.xml.crypto.enc.keyinfo.EncryptedKeyCipherData in this EncryptedKey and
returns the decrypted key as a Key object.decryptKey in interface EncryptedKeyXMLEncryptionExceptionEncryptedKey.decryptKey(javax.xml.crypto.enc.XMLDecryptContext,
javax.xml.crypto.AlgorithmMethod)public void encrypt(XMLEncryptContext context) throws XMLEncryptionException, MarshalException
javax.xml.crypto.enc.EncryptedTypeToBeEncrypted passed to the construction of this
EncryptedType and inserts it in the CipherValue
or CipherReference of the CipherData of this
EncryptedData.encrypt in interface EncryptedTypecontext - The encryption context.XMLEncryptionException - if an error occurs while encrypting.MarshalException - if an error occurs while marshalling.EncryptedType.encrypt(javax.xml.crypto.enc.XMLEncryptContext)© 2002-2005 IAIK, © 2004, 2006 - 2019 Stiftung SIC