XML Digital Signature and Encryption, 1.0

javax.xml.crypto.enc
Interface EncryptedType

All Superinterfaces:
XMLStructure
All Known Subinterfaces:
EncryptedData, EncryptedKey

public interface EncryptedType
extends XMLStructure

A representation of the XML EncryptedType element as defined in the W3C Recommendation for XML-Encryption Syntax and Processing. Its schema definition is as follows:

<complexType name='EncryptedType' abstract='true'> <sequence> <element name='EncryptionMethod' type='xenc:EncryptionMethodType' minOccurs='0'/> <element ref='ds:KeyInfo' minOccurs='0'/> <element ref='xenc:CipherData'/> <element ref='xenc:EncryptionProperties' minOccurs='0'/> </sequence> <attribute name='Id' type='ID' use='optional'/> <attribute name='Type' type='anyURI' use='optional'/> <attribute name='MimeType' type='string' use='optional'/> <attribute name='Encoding' type='anyURI' use='optional'/> </complexType>


Field Summary
static java.lang.String CONTENT
          The encrypted element content type URI.
static java.lang.String ELEMENT
          The encrypted element type URI.
static java.lang.String XMLNS
          The XML Encryption namespace URI
 
Method Summary
 java.io.InputStream decrypt(XMLDecryptContext context)
          Decrypts the CipherData in this EncryptedData.
 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.
 CipherData getCipherData()
          Returns the cipher data containing the encrypted data.
 java.io.InputStream getCipherText()
          Returns the encrypted data if the EncryptedType stores the encrypted data as CipherReference.
 java.lang.String getEncoding()
          Returns a URI identifying the transfer encoding of the data that has been encrypted.
 EncryptionMethod getEncryptionMethod()
          Returns the encryption method applied to the cipher data.
 EncryptionProperties getEncryptionProperties()
          Returns the encryption properties associated with this encrypted type.
 java.lang.String getId()
          Returns the optional ID.
 KeyInfo getKeyInfo()
          Returns the key info that carries information about the key used to encrypt the data.
 java.lang.String getMimeType()
          Returns the mime type of the data that has been encrypted.
 ToBeEncrypted getToBeEncrypted()
          Returns the data to be encrypted if there is any
 java.lang.String getType()
          Returns a URI identifying the type of the plaintext form of the encrypted content.
 
Methods inherited from interface javax.xml.crypto.XMLStructure
isFeatureSupported
 

Field Detail

XMLNS

static final java.lang.String XMLNS
The XML Encryption namespace URI

See Also:
Constant Field Values

CONTENT

static final java.lang.String CONTENT
The encrypted element content type URI.

See Also:
Constant Field Values

ELEMENT

static final java.lang.String ELEMENT
The encrypted element type URI.

See Also:
Constant Field Values
Method Detail

getEncryptionMethod

EncryptionMethod getEncryptionMethod()
Returns the encryption method applied to the cipher data.

Returns:
the encryption method, or null if not specified

getKeyInfo

KeyInfo getKeyInfo()
Returns the key info that carries information about the key used to encrypt the data.

Returns:
the key info, or null if not specified

getCipherData

CipherData getCipherData()
Returns the cipher data containing the encrypted data.

Returns:
the cipher data, or null if the data is a CipherValue and the data has not been encrypted yet

getEncryptionProperties

EncryptionProperties getEncryptionProperties()
Returns the encryption properties associated with this encrypted type.

Returns:
the encryption properties, or null if not specified

getId

java.lang.String getId()
Returns the optional ID.

Returns:
the ID, or null if not specified

getType

java.lang.String getType()
Returns a URI identifying the type of the plaintext form of the encrypted content.

Returns:
the type, or null if not specified

getMimeType

java.lang.String getMimeType()
Returns the mime type of the data that has been encrypted.

Returns:
the mime type, or null if not specified

getEncoding

java.lang.String getEncoding()
Returns a URI identifying the transfer encoding of the data that has been encrypted.

Returns:
the encoding, or null if not specified

encrypt

void encrypt(XMLEncryptContext context)
             throws XMLEncryptionException,
                    MarshalException
Encrypts the ToBeEncrypted passed to the construction of this EncryptedType and inserts it in the CipherValue or CipherReference of the CipherData of this EncryptedData.

The data is assumed to be serialized by the application before invoking this method.

Parameters:
context - the encryption context
Throws:
java.lang.NullPointerException - if context is null
MarshalException - if an error occurs while marshalling
XMLEncryptionException - if an error occurs while encrypting

decrypt

java.io.InputStream decrypt(XMLDecryptContext context)
                            throws XMLEncryptionException
Decrypts the CipherData in this EncryptedData.

Parameters:
context - the decryption context
Returns:
the decrypted CipherData as an InputStream.
Throws:
java.lang.NullPointerException - if context is null
XMLEncryptionException - if an error occurs while decrypting

getCipherText

java.io.InputStream getCipherText()
Returns the encrypted data if the EncryptedType stores the encrypted data as CipherReference.

Returns:
the encrypted data if EncryptedType has CipherReference as CipherData
Throws:
java.lang.IllegalStateException - if a CipherData is not a CipherReference; or this method is called on a unmarshalled EncryptedType.

getToBeEncrypted

ToBeEncrypted getToBeEncrypted()
Returns the data to be encrypted if there is any

Returns:
the data to be encrypted if there is any

XML Digital Signature and Encryption, 1.0

Copyright © 2003-2004, IBM Corporation and Sun Microsystems, Inc. All rights reserved.
Please send comments to: jsr-106-comments@jcp.org