XML Security, 1.6

com.ibm.xml.enc.dom
Class DOMXMLEncryptionFactory

java.lang.Object
  extended by javax.xml.crypto.enc.XMLEncryptionFactory
      extended by com.ibm.xml.enc.dom.DOMXMLEncryptionFactory

public final class DOMXMLEncryptionFactory
extends XMLEncryptionFactory

DOM-based implementation of XMLEncryptionFactory


Constructor Summary
DOMXMLEncryptionFactory()
          Initializes a new instance of this class.
 
Method Summary
 boolean isFeatureSupported(java.lang.String feature)
          Indicates whether a specified feature is supported.
 AgreementMethod newAgreementMethod(java.lang.String algorithm, byte[] kaNonce, KeyInfo originatorKeyInfo, KeyInfo recipientKeyInfo, AgreementMethodParameterSpec spec)
          This version of the RI does not support Key Agreement
 CanonicalizationMethod newCanonicalizationMethod(java.lang.String algorithm, C14NMethodParameterSpec params)
          Returns an instance of the specified CanonicalizationMethod
 CipherReference newCipherReference(java.lang.String uri, java.util.List transforms)
          Returns an instance of CipherReference
 DataReference newDataReference(java.lang.String uri, java.util.List content)
          Returns an instance of DataReference
 DHKeyValue newDHKeyValue(java.security.PublicKey publicKey)
          Creates a DHKeyValue from the specified key
 EncryptedData newEncryptedData(ToBeEncrypted toBeEncrypted, EncryptionMethod encMethod, KeyInfo keyInfo, EncryptionProperties properties, java.lang.String id)
          Returns an instance of EncryptedData
 EncryptedData newEncryptedData(ToBeEncrypted toBeEncrypted, EncryptionMethod encMethod, KeyInfo keyInfo, EncryptionProperties properties, java.lang.String id, CipherReference cipherRef)
          Returns an instance of EncryptedData with CipherReference
 EncryptedKey newEncryptedKey(ToBeEncryptedKey key, EncryptionMethod encMethod, KeyInfo keyInfo, EncryptionProperties properties, java.util.List references, java.lang.String carriedKeyName, java.lang.String recipient, java.lang.String id)
          Returns an instance of EncryptedKey
 EncryptedKey newEncryptedKey(ToBeEncryptedKey key, EncryptionMethod encMethod, KeyInfo keyInfo, EncryptionProperties properties, java.util.List references, java.lang.String carriedKeyName, java.lang.String recipient, java.lang.String id, CipherReference cipherRef)
          Returns an instance of EncryptedKey with CipherReference
 EncryptionMethod newEncryptionMethod(java.lang.String algorithm, java.lang.Integer keySize, EncryptionMethodParameterSpec params)
          Returns an instance of EncryptionMethod
 EncryptionProperties newEncryptionProperties(java.util.List properties, java.lang.String id)
          Returns an instance of EncryptionProperties
 EncryptionProperty newEncryptionProperty(java.util.List content, java.lang.String target, java.lang.String id, java.util.Map attributes)
          Returns an instance of EncryptionProperty
 KeyReference newKeyReference(java.lang.String uri, java.util.List content)
          Returns an instance of KeyReference
 KeyInfo newOriginatorKeyInfo(java.util.List content, java.lang.String id)
          Creates an originator KeyInfo containing the specified list of key information.
 KeyInfo newRecipientKeyInfo(java.util.List content, java.lang.String id)
          Creates a recipient KeyInfo containing the specified list of key information.
 EncryptedType unmarshalEncryptedType(XMLDecryptContext context)
          Unmarshals the EncryptedType
 
Methods inherited from class javax.xml.crypto.enc.XMLEncryptionFactory
getInstance, getInstance, getInstance, getInstance, getMechanismType, getProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMXMLEncryptionFactory

public DOMXMLEncryptionFactory()
Initializes a new instance of this class.

Method Detail

isFeatureSupported

public boolean isFeatureSupported(java.lang.String feature)
Description copied from class: XMLEncryptionFactory
Indicates whether a specified feature is supported.

Specified by:
isFeatureSupported in class XMLEncryptionFactory
Parameters:
feature - the feature name (as an absolute URI)
Returns:
true if the specified feature is supported, false otherwise

newAgreementMethod

public AgreementMethod newAgreementMethod(java.lang.String algorithm,
                                          byte[] kaNonce,
                                          KeyInfo originatorKeyInfo,
                                          KeyInfo recipientKeyInfo,
                                          AgreementMethodParameterSpec spec)
                                   throws java.security.NoSuchAlgorithmException,
                                          java.security.InvalidAlgorithmParameterException
This version of the RI does not support Key Agreement

Specified by:
newAgreementMethod in class XMLEncryptionFactory
Parameters:
algorithm - the URI identifying the key agreement algorithm
kaNonce - the KA-Nonce (may be null). The value of kaNonce is cloned to protect against subsequent modification
originatorKeyInfo - the originator's key info (may be null)
recipientKeyInfo - the recipient's key info (may be null)
spec - algorithm-specific agreement method parameters (may be null)
Returns:
the AgreementMethod
Throws:
java.security.NoSuchAlgorithmException - if an implementation of the specified algorithm cannot be found
java.security.InvalidAlgorithmParameterException - if the specified parameters are inappropriate for the requested algorithm

newCanonicalizationMethod

public CanonicalizationMethod newCanonicalizationMethod(java.lang.String algorithm,
                                                        C14NMethodParameterSpec params)
                                                 throws java.security.NoSuchAlgorithmException,
                                                        java.security.InvalidAlgorithmParameterException
Returns an instance of the specified CanonicalizationMethod

Specified by:
newCanonicalizationMethod in class XMLEncryptionFactory
Parameters:
algorithm - the URI identifying the canonicalization algorithm
params - algorithm-specific canonicalization parameters (may be null)
Returns:
the CanonicalizationMethod
Throws:
java.security.NoSuchAlgorithmException - if an implementation of the specified algorithm cannot be found
java.security.InvalidAlgorithmParameterException - if the specified parameters are inappropriate for the requested algorithm

newCipherReference

public CipherReference newCipherReference(java.lang.String uri,
                                          java.util.List transforms)
Returns an instance of CipherReference

Specified by:
newCipherReference in class XMLEncryptionFactory
Parameters:
uri - the URI that identifies the encrypted octet sequence
transforms - a list of Transforms. The list is defensively copied to protect against subsequent modification. May be null or empty.
Returns:
a CipherReference

newDataReference

public DataReference newDataReference(java.lang.String uri,
                                      java.util.List content)
Returns an instance of DataReference

Specified by:
newDataReference in class XMLEncryptionFactory
Parameters:
uri - the uri that refers to an EncryptedData element
content - a list of XMLStructures (may be null or empty). The list is defensively copied to protect against subsequent modification.
Returns:
a DataReference

newEncryptedData

public EncryptedData newEncryptedData(ToBeEncrypted toBeEncrypted,
                                      EncryptionMethod encMethod,
                                      KeyInfo keyInfo,
                                      EncryptionProperties properties,
                                      java.lang.String id)
Returns an instance of EncryptedData

Specified by:
newEncryptedData in class XMLEncryptionFactory
Parameters:
toBeEncrypted - the data to be encrypted in this EncryptedData
encMethod - the encryption method (may be null)
keyInfo - the key info (may be null)
properties - the encryption properties (may be null)
id - the ID (may be null)
Returns:
an EncryptedData

newEncryptedData

public EncryptedData newEncryptedData(ToBeEncrypted toBeEncrypted,
                                      EncryptionMethod encMethod,
                                      KeyInfo keyInfo,
                                      EncryptionProperties properties,
                                      java.lang.String id,
                                      CipherReference cipherRef)
Returns an instance of EncryptedData with CipherReference

Specified by:
newEncryptedData in class XMLEncryptionFactory
Parameters:
toBeEncrypted - the data to be encrypted in this EncryptedData
encMethod - the encryption method (may be null)
keyInfo - the key info (may be null)
properties - the encryption properties (may be null)
id - the ID (may be null)
cipherRef - the CiphereReference this EncryptedData will contain
Returns:
an EncryptedData

newEncryptedKey

public EncryptedKey newEncryptedKey(ToBeEncryptedKey key,
                                    EncryptionMethod encMethod,
                                    KeyInfo keyInfo,
                                    EncryptionProperties properties,
                                    java.util.List references,
                                    java.lang.String carriedKeyName,
                                    java.lang.String recipient,
                                    java.lang.String id)
Returns an instance of EncryptedKey

Specified by:
newEncryptedKey in class XMLEncryptionFactory
Parameters:
key - the key to be encrypted
encMethod - the encryption method (may be null)
keyInfo - the key info (may be null)
properties - the encryption properties (may be null)
references - a list of DataReferences or KeyReferences (may be null or empty)
carriedKeyName - the ID of the EncryptedKeyElement (may be null)
recipient - the carried key name (may be null)
id - the recipient (may be null)
Returns:
an EncryptedKey

newEncryptedKey

public EncryptedKey newEncryptedKey(ToBeEncryptedKey key,
                                    EncryptionMethod encMethod,
                                    KeyInfo keyInfo,
                                    EncryptionProperties properties,
                                    java.util.List references,
                                    java.lang.String carriedKeyName,
                                    java.lang.String recipient,
                                    java.lang.String id,
                                    CipherReference cipherRef)
Returns an instance of EncryptedKey with CipherReference

Specified by:
newEncryptedKey in class XMLEncryptionFactory
Parameters:
key - the key to be encrypted
encMethod - the encryption method (may be null)
keyInfo - the key info (may be null)
properties - the encryption properties (may be null)
references - a list of DataReferences or KeyReferences (may be null or empty)
carriedKeyName - the ID of the EncryptedKey element (may be null)
recipient - the carried key name (may be null)
id - the recipient (may be null)
cipherRef - the CiphereReference this EncryptedData will contain
Returns:
an EncryptedKey

newEncryptionMethod

public EncryptionMethod newEncryptionMethod(java.lang.String algorithm,
                                            java.lang.Integer keySize,
                                            EncryptionMethodParameterSpec params)
                                     throws java.security.NoSuchAlgorithmException,
                                            java.security.InvalidAlgorithmParameterException
Returns an instance of EncryptionMethod

Specified by:
newEncryptionMethod in class XMLEncryptionFactory
Parameters:
algorithm - the URI identifying the encryption algorithm. Supported algorithms are defined in EncryptionMethod interface.
keySize - the size of the key to be used (or null if not applicable)
params - algorithm-specific encryption parameters (may be null)
Returns:
the EncryptionMethod
Throws:
java.security.NoSuchAlgorithmException - if an implementation of the specified algorithm cannot be found
java.security.InvalidAlgorithmParameterException - if the specified parameters are inappropriate for the requested algorithm

newEncryptionProperties

public EncryptionProperties newEncryptionProperties(java.util.List properties,
                                                    java.lang.String id)
Returns an instance of EncryptionProperties

Specified by:
newEncryptionProperties in class XMLEncryptionFactory
Parameters:
properties - a list of one or more EncryptionPropertys. The list is defensively copied to protect against subsequent modification.
id - the id (may be null)
Returns:
a EncryptionProperties

newEncryptionProperty

public EncryptionProperty newEncryptionProperty(java.util.List content,
                                                java.lang.String target,
                                                java.lang.String id,
                                                java.util.Map attributes)
Returns an instance of EncryptionProperty

Specified by:
newEncryptionProperty in class XMLEncryptionFactory
Parameters:
content - a list of one or more XMLStructures. The list is defensively copied to protect against subsequent modification.
target - the target URI of the EncryptedType that this property applies to (may be null)
id - the id (may be null)
attributes - a map of attributes from the XML namespace (may be empty or null). The map is defensively copied to protect against subsequent modification.
Returns:
an EncryptionProperty

newKeyReference

public KeyReference newKeyReference(java.lang.String uri,
                                    java.util.List content)
Returns an instance of KeyReference

Specified by:
newKeyReference in class XMLEncryptionFactory
Parameters:
uri - the uri that refers to an EncryptedKey element
content - a list of XMLStructures (may be null or empty). The list is defensively copied to protect against subsequent modification.
Returns:
a KeyReference

unmarshalEncryptedType

public EncryptedType unmarshalEncryptedType(XMLDecryptContext context)
                                     throws MarshalException
Unmarshals the EncryptedType

Specified by:
unmarshalEncryptedType in class XMLEncryptionFactory
Parameters:
context - the mechanism-specific decryption context
Returns:
the EncryptedType
Throws:
MarshalException - if an unrecoverable exception occurs during unmarshalling

newOriginatorKeyInfo

public KeyInfo newOriginatorKeyInfo(java.util.List content,
                                    java.lang.String id)
                             throws java.lang.IllegalArgumentException
Description copied from class: XMLEncryptionFactory
Creates an originator KeyInfo containing the specified list of key information.

Specified by:
newOriginatorKeyInfo in class XMLEncryptionFactory
Parameters:
content - a list of one or more XMLStructures representing key information types. The list is defensively copied to protect against subsequent modification.
id - the value of an XML ID (may be null)
Returns:
an originator KeyInfo
Throws:
java.lang.IllegalArgumentException - if content is empty

newRecipientKeyInfo

public KeyInfo newRecipientKeyInfo(java.util.List content,
                                   java.lang.String id)
                            throws java.lang.IllegalArgumentException
Description copied from class: XMLEncryptionFactory
Creates a recipient KeyInfo containing the specified list of key information.

Specified by:
newRecipientKeyInfo in class XMLEncryptionFactory
Parameters:
content - a list of one or more XMLStructures representing key information types. The list is defensively copied to protect against subsequent modification.
Returns:
a recipient KeyInfo
Throws:
java.lang.IllegalArgumentException - if content is empty

newDHKeyValue

public DHKeyValue newDHKeyValue(java.security.PublicKey publicKey)
                         throws java.security.KeyException
Description copied from class: XMLEncryptionFactory
Creates a DHKeyValue from the specified key

Specified by:
newDHKeyValue in class XMLEncryptionFactory
Parameters:
publicKey - the public key for DH algorithm
Throws:
java.security.KeyException - if the key can not be used to create the DHKeyValue

XML Security, 1.6

Portions Copyright 2003, 2012 IBM Corporation.
Portions Copyright 2003, 2012 Oracle and/or its affiliates.