javax.xml.crypto.enc.keyinfo

Interface EncryptedKey

  • All Superinterfaces:
    EncryptedType, XMLStructure


    public interface EncryptedKey
    extends EncryptedType
    Represents the EncryptedKey element. Its schema definition is as follows: <element name='EncryptedKey' type='xenc:EncryptedKeyType'/> <complexType name='EncryptedKeyType'> <complexContent> <extension base='xenc:EncryptedType'> <sequence> <element ref='xenc:ReferenceList' minOccurs='0'/> <element name='CarriedKeyName' type='string' minOccurs='0'/> </sequence> <attribute name='Recipient' type='string' use='optional'/> </extension> </complexContent> </complexType>
    • Field Detail

      • TYPE

        static final java.lang.String TYPE
        URI identifying the EncryptedKey KeyInfo type: http://www.w3.org/2001/04/xmlenc#EncryptedKey. This can be specified as the value of the type parameter of the RetrievalMethod class to identify the referent's type.
        See Also:
        Constant Field Values
    • Method Detail

      • getReferenceList

        java.util.List getReferenceList()
        Returns an unmodifiable list of ReferenceTypes containing pointers to data and keys encrypted using this key.
        Returns:
        an unmodifiable list of ReferenceTypes (may be empty but never null)
      • getCarriedKeyName

        java.lang.String getCarriedKeyName()
        Returns the carried key name of this EncryptedKey.
        Returns:
        the carried key name or null if not specified
      • getRecipient

        java.lang.String getRecipient()
        Returns a hint as to which recipient this EncryptedKey is intended for.
        Returns:
        the recipient or null if not specified
      • decrypt

        java.io.InputStream decrypt(XMLDecryptContext context)
                             throws XMLEncryptionException
        Decrypts the CipherData in this EncryptedKey.
        Specified by:
        decrypt in interface EncryptedType
        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
      • decryptKey

        java.security.Key decryptKey(XMLDecryptContext context,
                                     AlgorithmMethod alg)
                              throws XMLEncryptionException
        Decrypts the CipherData in this EncryptedKey and returns the decrypted key as a Key object.
        Parameters:
        context - the decryption context
        alg - the algorithm of the decrypted key
        Returns:
        the decrypted CipherData as a key
        Throws:
        java.lang.NullPointerException - if context is null or alg is null.
        XMLEncryptionException - if an error occurs while decrypting
XML Security (JSR 105/106), 1.8

Copyright © 2015 IBM Corporation. All Rights Reserved.