public class XEEncryptedKey extends XEEncryptedObject implements KeyInfoData
XEEncryptionMethod, XEEncryptedObject, XEEncryptedData, XEKeyInfocreateEncryptionProperty| Constructor and Description | 
|---|
XEEncryptedKey(org.w3c.dom.Document doc)
Create a new  
XEEncryptedKey instance with the given XML Document context. | 
XEEncryptedKey(org.w3c.dom.Document doc, java.lang.String id)
Create a new  
XEEncryptedKey instance with the given XML Document context and the id. | 
XEEncryptedKey(org.w3c.dom.Element encKey)
Create a  
XEEncryptedKey instance from the given EncryptedKey element. | 
XEEncryptedKey(org.w3c.dom.Element encKey, java.lang.String systemId)
Create a  
XEEncryptedKey instance from the given EncryptedKey element. | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addReference(XEReference ref)
Add an XEReference instance for an EncryptedData or EncryptedKey element encrypted using the key being encrypted in this structure. 
 | 
byte[] | 
decrypt(XEEncryptionMethod ceEncMethod)
Decrypt the cipher value specified in the CipherData child element in this EncryptedKey element. 
 | 
byte[] | 
decrypt(XEEncryptionMethod ceEncMethod, java.security.Key keyDecKey)
Decrypt the cipher value specified in the CipherData child element in this EncryptedKey element, with the given decryption key. 
 | 
byte[] | 
encrypt(byte[] contentKeyBytes)
Encrypt the content encryption key bytes with the given key encryption key. 
 | 
byte[] | 
encrypt(byte[] contentKeyBytes, java.security.Key keyEncKey)
Encrypt the content encryption key bytes with the given key encryption key. 
 | 
byte[] | 
encrypt(javax.crypto.SecretKey contentKey)
Encrypt the content encryption key with the given key encryption key. 
 | 
byte[] | 
encrypt(javax.crypto.SecretKey contentKey, java.security.Key keyEncKey)
Encrypt the content encryption key with the given key encryption key. 
 | 
void | 
encryptKey(javax.crypto.SecretKey contentKey, java.security.Key keyEncKey, java.lang.String keyEncKeyName)
Encrypt the content encryption key with the given key encryption key, and store the encrypted key inside this EncryptedKey element. 
 | 
java.lang.String | 
getCarriedKeyName()
Return the key name identifying the key being encrypted. 
 | 
java.util.Vector | 
getDataReferences()
Get XEDataReference objects refer EncryptedData elements encrypted using the key being encrypted in this structure. 
 | 
javax.crypto.SecretKey | 
getKey(XEEncryptionMethod ceEncMethod)
Get the content encryption key being encrypted in this EncryptedKey element. 
 | 
javax.crypto.SecretKey | 
getKey(XEEncryptionMethod ceEncMethod, java.security.Key keyDecKey)
Get the content encryption key being encrypted in this EncryptedKey element. 
 | 
java.util.Vector | 
getKeyReferences()
Get the XEKeyReference objects for EncryptedKey elements that were encrypted using the key being encrypted in this structure. 
 | 
java.lang.String | 
getRecipient()
Returns the value of the Recipient attribute, which indicates the recipient of this encrypted key value. 
 | 
java.lang.String | 
getType()
Returns the type URI for an EncryptedKey element. 
 | 
static XEEncryptedKey | 
newInstance()
Creates a new XEEncryptedKey instance in a new owner document, and makes it the root element of the document. 
 | 
static XEEncryptedKey | 
newInstance(org.w3c.dom.Document doc)
Creates a new XEEncryptedKey instance in the given owner document, but does not append it to any element. 
 | 
static XEEncryptedKey | 
newInstance(org.w3c.dom.Document doc, java.lang.String id)
Creates a new XEEncryptedKey instance in the given owner document, but does not append it to any element. 
 | 
static XEEncryptedKey | 
newInstance(java.lang.String id)
Creates a new XEEncryptedKey instance in a new owner document, and makes it the root element of the document. 
 | 
void | 
setCarriedKeyName(java.lang.String keyName)
Set the CarriedKeyName child element for this EncryptedKey element. 
 | 
void | 
setRecipient(java.lang.String recipient)
Sets the Recipient attribute, which indicates the recipient of this encrypted key value. 
 | 
createCipherData, createCipherData, createCipherReference, createDataReference, createEncryptionMethod, createEncryptionProperties, createEncryptionProperties, createEncryptionProperty, createEncryptionProperty, createKeyInfo, createKeyInfo, createKeyReference, createOriginatorKeyInfo, createRecipientKeyInfo, getCipherData, getDataType, getDecryptionKey, getEncoding, getEncryptionKey, getEncryptionMethod, getEncryptionProperties, getId, getInstance, getInstance, getKeyInfo, getMimeType, setCipherData, setDataType, setEncoding, setEncryptionMethod, setEncryptionProperties, setId, setKeyInfo, setMimeTypeaddNSPrefixAttr, addNSPrefixAttr, addNSPrefixAttrDefault, addNSPrefixAttrDefault, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getChildElementsByTagName, getChildElementsByTagName, getChildElementsByTagNameNS, getChildElementsByTagNameNS, getDefaultNSPrefix, getElement, getElementsByTagName, getElementsByTagNameNS, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setDefaultNSPrefixappendChild, appendChild, appendTo, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNode, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getSystemId, hasAttributes, hasChildNodes, insertBefore, insertBefore, isSupported, normalize, removeChild, removeChild, replaceChild, replaceChild, setNodeValue, setPrefix, setSystemId, toBytesXML, toStringXMLpublic XEEncryptedKey(org.w3c.dom.Element encKey)
XEEncryptedKey instance from the given EncryptedKey element.encKey - An EncryptedKey element.
public XEEncryptedKey(org.w3c.dom.Element encKey,
                      java.lang.String systemId)
XEEncryptedKey instance from the given EncryptedKey element.encKey - An EncryptedKey element.systemId - The URI string system ID for the XEEncryptedKey.public XEEncryptedKey(org.w3c.dom.Document doc)
XEEncryptedKey instance with the given XML Document context.doc - An XML Document to be used as the owner document of this element.
public XEEncryptedKey(org.w3c.dom.Document doc,
                      java.lang.String id)
XEEncryptedKey instance with the given XML Document context and the id.doc - An XML Document to be used as the owner document of this element.id - An optional Id string for this EncryptedKey element.public static XEEncryptedKey newInstance() throws org.w3c.dom.DOMException
org.w3c.dom.DOMExceptionpublic static XEEncryptedKey newInstance(java.lang.String id) throws org.w3c.dom.DOMException
id - An optional Id string for this EncryptedKey element.org.w3c.dom.DOMExceptionpublic static XEEncryptedKey newInstance(org.w3c.dom.Document doc) throws org.w3c.dom.DOMException
doc - An XML Document to be used as the owner document of this EncryptedKey element.org.w3c.dom.DOMExceptionpublic static XEEncryptedKey newInstance(org.w3c.dom.Document doc, java.lang.String id) throws org.w3c.dom.DOMException
doc - An XML Document to be used as the owner document of this EncryptedKey element.id - An optional Id string for this EncryptedKey element.org.w3c.dom.DOMException
public void setCarriedKeyName(java.lang.String keyName)
                       throws org.w3c.dom.DOMException
keyName - The name identifying the key to be encrypted.org.w3c.dom.DOMExceptionpublic java.lang.String getCarriedKeyName()
null if not specified
public void setRecipient(java.lang.String recipient)
                  throws org.w3c.dom.DOMException
recipient - The string name of this encrypted key's recipient.org.w3c.dom.DOMExceptionpublic java.lang.String getRecipient()
null if the attribute is not set.public void addReference(XEReference ref) throws org.w3c.dom.DOMException
ref - An XEReference instance.org.w3c.dom.DOMExceptionpublic java.util.Vector getDataReferences()
Vector of XEDataReference objects.public java.util.Vector getKeyReferences()
Vector of XEKeyReference objects.public java.lang.String getType()
getType in interface KeyInfoDataXMLURI.obj_EncryptedKey.
public byte[] encrypt(byte[] contentKeyBytes,
                      java.security.Key keyEncKey)
               throws XESchemaException,
                      XECipherException
contentKeyBytes - The key bytes of the content encryption key to be encrypted.keyEncKey - The key to be used in encrypting the content encryption key bytes.XESchemaExceptionXECipherException
public byte[] encrypt(byte[] contentKeyBytes)
               throws XEException
The KeyInfo is used to locate the encryption key using the KeyRetriever facility. If no KeyInfo is present, or if the encryption key cannot be retrieved, a XECipherException is thrown. This method should NOT be used if the encryption key is identified by an EncryptedKey element.
contentKeyBytes - The key bytes of the content encryption key to be encrypted.XEException
public byte[] encrypt(javax.crypto.SecretKey contentKey,
                      java.security.Key keyEncKey)
               throws XESchemaException,
                      XECipherException
contentKey - The content encryption key to be encrypted.keyEncKey - The key to be used in encrypting the content encryption key.XESchemaExceptionXECipherException
public void encryptKey(javax.crypto.SecretKey contentKey,
                       java.security.Key keyEncKey,
                       java.lang.String keyEncKeyName)
                throws XESchemaException,
                       XECipherException
contentKey - The content encryption key to be encrypted.keyEncKey - The key to be used in encrypting the content encryption key.keyEncKeyName - If non null, a KeyInfo with a KeyName will be created for this elementXESchemaExceptionXECipherException
public byte[] encrypt(javax.crypto.SecretKey contentKey)
               throws XEException
The KeyInfo is used to locate the encryption key using the KeyRetriever facility. If no KeyInfo is present, or if the encryption key cannot be retrieved, a XECipherException is thrown. This method should NOT be used if the encryption key is identified by an EncryptedKey element.
contentKey - The content encryption key to be encrypted.XEExceptionpublic byte[] decrypt(XEEncryptionMethod ceEncMethod, java.security.Key keyDecKey) throws XESchemaException, XECipherException
ceEncMethod - An XEEncryptionMethod object identifying the content encryption algorithm for which the key encrypted in this structure is used.keyDecKey - The key decryption key.XESchemaExceptionXECipherExceptionpublic byte[] decrypt(XEEncryptionMethod ceEncMethod) throws XEException
KeyRetriever facility.ceEncMethod - The EncryptionMethod for the content. NOT the EncryptionMethod for the encryption key. This is required, because just by looking at the EncryptedKey it is possible to decrypt into a sequence of bytes, but not possible to determine the encryption algorithm that those bytes should be used for.XEExceptionpublic javax.crypto.SecretKey getKey(XEEncryptionMethod ceEncMethod, java.security.Key keyDecKey) throws org.w3c.dom.DOMException, XEException
ceEncMethod - The EncryptionMethod for the content. NOT the EncryptionMethod for the encryption key. This is required, because just by looking at the EncryptedKey it is possible to decrypt into a sequence of bytes, but not possible to determine the encryption algorithm that those bytes should be used for.keyDecKey - The key used to decrypt the encrypted content key.org.w3c.dom.DOMExceptionXEExceptionpublic javax.crypto.SecretKey getKey(XEEncryptionMethod ceEncMethod) throws org.w3c.dom.DOMException, XEException
KeyRetriever.ceEncMethod - An XEEncryptionMethod object identifying the content encryption algorithm for which the key encrypted in this structure is used.org.w3c.dom.DOMExceptionXEException