javax.xml.crypto.enc

Interface EncryptedType

All Superinterfaces:
XMLStructure
All known subinterfaces:
EncryptedData, EncryptedKey

  1. public interface EncryptedType
  2. 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

Modifier and Type Field and Description
  1. static
  2. java.lang.String
CONTENT
The encrypted element content type URI.
  1. static
  2. java.lang.String
ELEMENT
The encrypted element type URI.
  1. static
  2. java.lang.String
XMLNS
The XML Encryption namespace URI

Method Summary

Modifier and Type Method and Description
  1. java.io.InputStream
decrypt(XMLDecryptContext context)
Decrypts the CipherData in this EncryptedData.
  1. 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.
  1. CipherData
getCipherData()
Returns the cipher data containing the encrypted data.
  1. java.io.InputStream
getCipherText()
Returns the encrypted data if the EncryptedType stores the encrypted data as CipherReference.
  1. java.lang.String
getEncoding()
Returns a URI identifying the transfer encoding of the data that has been encrypted.
  1. EncryptionMethod
getEncryptionMethod()
Returns the encryption method applied to the cipher data.
  1. EncryptionProperties
getEncryptionProperties()
Returns the encryption properties associated with this encrypted type.
  1. java.lang.String
getId()
Returns the optional ID.
  1. KeyInfo
getKeyInfo()
Returns the key info that carries information about the key used to encrypt the data.
  1. java.lang.String
getMimeType()
Returns the mime type of the data that has been encrypted.
  1. ToBeEncrypted
getToBeEncrypted()
Returns the data to be encrypted if there is any
  1. 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

  1. static final java.lang.String XMLNS
The XML Encryption namespace URI
See Also:

CONTENT

  1. static final java.lang.String CONTENT
The encrypted element content type URI.
See Also:

ELEMENT

  1. static final java.lang.String ELEMENT
The encrypted element type URI.
See Also:

Method Detail

getEncryptionMethod

  1. EncryptionMethod getEncryptionMethod( )
Returns the encryption method applied to the cipher data.
Returns:
the encryption method, or null if not specified

getKeyInfo

  1. 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

  1. 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

  1. EncryptionProperties getEncryptionProperties( )
Returns the encryption properties associated with this encrypted type.
Returns:
the encryption properties, or null if not specified

getId

  1. java.lang.String getId()
Returns the optional ID.
Returns:
the ID, or null if not specified

getType

  1. 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

  1. 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

  1. 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

  1. void encrypt(XMLEncryptContext context)
  2. throws XMLEncryptionException
  3. 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

  1. java.io.InputStream decrypt(XMLDecryptContext context)
  2. 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

  1. 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

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