javax.xml.crypto.enc
Interface EncryptedType
-
- All Superinterfaces:
- XMLStructure
- All Known Subinterfaces:
- EncryptedData, EncryptedKey
public interface EncryptedType extends XMLStructure
A representation of the XMLEncryptedTypeelement as defined in the W3C Recommendation for XML-Encryption Syntax and Processing. Its schema definition is as follows:
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringCONTENTThe encrypted element content type URI.static java.lang.StringELEMENTThe encrypted element type URI.static java.lang.StringXMLNSThe XML Encryption namespace URI
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description java.io.InputStreamdecrypt(XMLDecryptContext context)Decrypts theCipherDatain thisEncryptedData.voidencrypt(XMLEncryptContext context)Encrypts the ToBeEncrypted passed to the construction of this EncryptedType and inserts it in theCipherValueorCipherReferenceof theCipherDataof thisEncryptedData.CipherDatagetCipherData()Returns the cipher data containing the encrypted data.java.io.InputStreamgetCipherText()Returns the encrypted data if the EncryptedType stores the encrypted data as CipherReference.java.lang.StringgetEncoding()Returns a URI identifying the transfer encoding of the data that has been encrypted.EncryptionMethodgetEncryptionMethod()Returns the encryption method applied to the cipher data.EncryptionPropertiesgetEncryptionProperties()Returns the encryption properties associated with this encrypted type.java.lang.StringgetId()Returns the optionalID.KeyInfogetKeyInfo()Returns the key info that carries information about the key used to encrypt the data.java.lang.StringgetMimeType()Returns the mime type of the data that has been encrypted.ToBeEncryptedgetToBeEncrypted()Returns the data to be encrypted if there is anyjava.lang.StringgetType()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
nullif 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
nullif not specified
-
getCipherData
CipherData getCipherData()
Returns the cipher data containing the encrypted data.- Returns:
- the cipher data, or
nullif the data is aCipherValueand the data has not been encrypted yet
-
getEncryptionProperties
EncryptionProperties getEncryptionProperties()
Returns the encryption properties associated with this encrypted type.- Returns:
- the encryption properties, or
nullif not specified
-
getId
java.lang.String getId()
Returns the optionalID.- Returns:
- the
ID, ornullif 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
nullif not specified
-
getMimeType
java.lang.String getMimeType()
Returns the mime type of the data that has been encrypted.- Returns:
- the mime type, or
nullif 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
nullif not specified
-
encrypt
void encrypt(XMLEncryptContext context) throws XMLEncryptionException, MarshalException
Encrypts the ToBeEncrypted passed to the construction of this EncryptedType and inserts it in theCipherValueorCipherReferenceof theCipherDataof thisEncryptedData.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 isnullMarshalException- if an error occurs while marshallingXMLEncryptionException- if an error occurs while encrypting
-
decrypt
java.io.InputStream decrypt(XMLDecryptContext context) throws XMLEncryptionException
Decrypts theCipherDatain thisEncryptedData.- Parameters:
context- the decryption context- Returns:
- the decrypted
CipherDataas an InputStream. - Throws:
java.lang.NullPointerException- if context isnullXMLEncryptionException- 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
-
-