Oracle Security Developer Tools XML Security Java API Reference
10g (10.1.4.0.1)

B28178-01


oracle.security.xmlsec.enc
Class XEncUtils

java.lang.Object
  extended byoracle.security.xmlsec.enc.XEncUtils


public class XEncUtils
extends java.lang.Object

Simple API for encrypting and decrypting XML Key, Element or Element Content.

Since:
1.1

Method Summary
static org.w3c.dom.Element decryptElement(org.w3c.dom.Element encryptedData, oracle.security.crypto.core.Key key)
          Decrypt the given EncryptedData element of data type XML Element or XML Content, and replaces the EncryptedData element with the result.
static XEEncryptedData encryptElement(org.w3c.dom.Element inputElement, boolean contentOnly, java.lang.String dataEncAlg, java.lang.String keyEncAlg, oracle.security.crypto.core.Key keyEncKey, java.lang.String keyEncKeyName, oracle.security.crypto.core.RandomBitsSource rbs)
          Encrypt XML data of type XML Element or XML Element Content with the given algorithm.
static XEEncryptedData encryptElement(org.w3c.dom.Element inputElement, boolean contentOnly, java.lang.String dataEncAlg, oracle.security.crypto.core.SymmetricKey dataEncKey, java.lang.String dataEncKeyName)
          Encrypt XML data of type XML Element or XML Element Content with the given algorithm and key, where the key is identified by a key name.
static XEEncryptedData encryptElement(org.w3c.dom.Element inputElement, boolean contentOnly, java.lang.String dataEncAlg, oracle.security.crypto.core.SymmetricKey dataEncKey, java.lang.String keyEncAlg, oracle.security.crypto.core.Key keyEncKey, java.lang.String keyEncKeyName)
          Encrypt XML data of type XML Element or XML Element Content with the given algorithm and key, where the data encryption key is encrypted with the given key encryption key.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

encryptElement

public static XEEncryptedData encryptElement(org.w3c.dom.Element inputElement,
                                             boolean contentOnly,
                                             java.lang.String dataEncAlg,
                                             oracle.security.crypto.core.SymmetricKey dataEncKey,
                                             java.lang.String dataEncKeyName)
                                      throws XEException
Encrypt XML data of type XML Element or XML Element Content with the given algorithm and key, where the key is identified by a key name.

The supported data encrytion algorithms are:

Parameters:
inputElement - The input XML element to be encrypted.
contentOnly - If true, only encrypt the content of the input element; else encrypt the whole element.
dataEncAlg - The URI identifying the data encryption algorithm.
dataEncKey - The data encryption key.
dataEncKeyName - The name identifying the data encryption key, optional.
Returns:
A new XEEncryptedData which replaces the inputElement or its content in its owner document.
Throws:
XEException - If an error occurs in encrypting the data.

encryptElement

public static XEEncryptedData encryptElement(org.w3c.dom.Element inputElement,
                                             boolean contentOnly,
                                             java.lang.String dataEncAlg,
                                             oracle.security.crypto.core.SymmetricKey dataEncKey,
                                             java.lang.String keyEncAlg,
                                             oracle.security.crypto.core.Key keyEncKey,
                                             java.lang.String keyEncKeyName)
                                      throws XEException
Encrypt XML data of type XML Element or XML Element Content with the given algorithm and key, where the data encryption key is encrypted with the given key encryption key.

The supported data encrytion algorithms are:

The supported key encrytion algorithms are:

For RSA-OAEP, the following parameters are used:

Parameters:
inputElement - The input XML elemen to be encrypted.
contentOnly - If true, only encrypt the content of the input element; else encrypt the whole element.
dataEncAlg - The URI identifying the data encryption algorithm.
dataEncKey - The data encryption key.
keyEncAlg - The URI identifying the key encryption algorithm.
keyEncKey - The key encryption key.
keyEncKeyName - The name identifying the key encryption key, optional.
Returns:
A new XEEncryptedData which replaces the inputElement or its content in its owner document.
Throws:
XEException - If an error occurs in encrypting the data.

encryptElement

public static XEEncryptedData encryptElement(org.w3c.dom.Element inputElement,
                                             boolean contentOnly,
                                             java.lang.String dataEncAlg,
                                             java.lang.String keyEncAlg,
                                             oracle.security.crypto.core.Key keyEncKey,
                                             java.lang.String keyEncKeyName,
                                             oracle.security.crypto.core.RandomBitsSource rbs)
                                      throws XEException
Encrypt XML data of type XML Element or XML Element Content with the given algorithm. A random data encryption key is generated for the given algorithm, and is itself encrypted using the given key encryption key.

The supported data encrytion algorithms are:

The supported key encrytion algorithms are:

For RSA-OAEP, the following parameters are used:

Parameters:
inputElement - The input XML elemen to be encrypted.
contentOnly - If true, only encrypt the content of the input element; else encrypt the whole element.
dataEncAlg - The URI identifying the data encryption algorithm.
keyEncAlg - The URI identifying the key encryption algorithm.
keyEncKey - The key encryption key.
keyEncKeyName - The name identifying the key encryption key, optional.
rbs - A PRNG to use for generating the data encryption key, optional. If rbs is null, the default PRNG will be used.
Returns:
A new XEEncryptedData which replaces the inputElement or its content in its owner document.
Throws:
XEException - If an error occurs in encrypting the data.
Since:
2.0

decryptElement

public static org.w3c.dom.Element decryptElement(org.w3c.dom.Element encryptedData,
                                                 oracle.security.crypto.core.Key key)
                                          throws XEException
Decrypt the given EncryptedData element of data type XML Element or XML Content, and replaces the EncryptedData element with the result.

If the data encryption key is encrypted, the key decryption key will be obtained from the EncryptedData's KeyInfo element. This may be a recursive step, as the key-encryption key may itself be encrypted. The decryption key for the bottom EncryptedKey element (or the EncryptedData element itself if the data encryption key is not encrypted) is either provided by the user, or can be derived by the Diffe-Hellman key agreement method. In the latter case the Diffie-Hellamn private key must be provided by the user.

Parameters:
encryptedData - The EncryptedData element to be decrypted.
key - Data- or key-decryption key, or a Diffie-Hellman private key.
Returns:
The decrypted XML Element.
Throws:
XEException

Oracle Security Developer Tools XML Security Java API Reference
10g (10.1.4.0.1)

B28178-01


Copyright © 2005 ,2006 , Oracle. All rights reserved.