org.apache.xml.security.algorithms.encryption
Class EncryptionMethod

java.lang.Object
  |
  +--org.apache.xml.security.utils.ElementProxy
        |
        +--org.apache.xml.security.algorithms.Algorithm
              |
              +--org.apache.xml.security.algorithms.encryption.EncryptionMethod

public class EncryptionMethod
extends Algorithm

This is the representation of an xenc:EncryptionMethod element. It's additionally the factory for encryption/wrap/transport algorithms.

Author:
$Author: vdkoogh $

Field Summary
 
Fields inherited from class org.apache.xml.security.utils.ElementProxy
_baseURI, _constructionElement, _doc, _state, MODE_CREATE, MODE_DECRYPT, MODE_ENCRYPT, MODE_PROCESS, MODE_SIGN, MODE_UNKNOWN, MODE_VERIFY
 
Constructor Summary
EncryptionMethod(org.w3c.dom.Document doc, java.lang.String algorithmURI)
          Constructor EncryptionMethod
EncryptionMethod(org.w3c.dom.Document doc, java.lang.String algorithmURI, EncryptionMethodParams params)
          Constructor EncryptionMethod
EncryptionMethod(org.w3c.dom.Element element, java.lang.String BaseURI)
          Constructor EncryptionMethod
 
Method Summary
 java.security.Key createSecretKeyFromBytes(byte[] encodedKey)
          Method createSecretKeyFromBytes
 byte[] decrypt(byte[] ciphertextBytes, java.security.Key contentKey)
          Method decrypt
 byte[] decryptB64(java.lang.String ciphertext, java.security.Key contentKey)
           
 byte[] encrypt(byte[] plaintextBytes, java.security.Key contentKey)
          Method encrypt
 byte[] encrypt(byte[] plaintextBytes, java.security.Key contentKey, byte[] IV)
          Method encrypt
 java.lang.String encryptB64(byte[] plaintextBytes, java.security.Key contentKey)
           
 java.lang.String encryptB64(byte[] plaintextBytes, java.security.Key contentKey, byte[] IV)
           
 java.lang.String getBaseLocalName()
          Method getBaseLocalName
 java.lang.String getBaseNamespace()
          Method getBaseNamespace
 int getBlockSize()
          Method getBlockSize
 int getIvLength()
          Method getIvLength
 EncryptionMethodParams getParams()
          Method getParams
 boolean getUsableInEncryptedData()
          Method getUsableInEncryptedData
 boolean getUsableInEncryptedKey()
          Method getUsableInEncryptedKey
static void providerInit()
          Method providerInit
static boolean register(java.lang.String algorithmURI, java.lang.String implementingClass)
          Method register
 java.security.Key unwrap(byte[] wrappedKey, java.security.Key wrapKey, java.lang.String wrappedKeyAlgoURI)
          Method unwrap
 java.security.Key unwrapB64(java.lang.String wrappedKey, java.security.Key wrapKey, java.lang.String wrappedKeyAlgoURI)
           
 byte[] wrap(java.security.Key contentKey, java.security.Key wrapKey)
          Method wrap
 byte[] wrap(java.security.Key contentKey, java.security.Key wrapKey, byte[] IV)
          Method wrap
 java.lang.String wrapB64(java.security.Key contentKey, java.security.Key wrapKey)
           
 java.lang.String wrapB64(java.security.Key contentKey, java.security.Key wrapKey, byte[] IV)
           
 
Methods inherited from class org.apache.xml.security.algorithms.Algorithm
getAlgorithmURI, setAlgorithmURI
 
Methods inherited from class org.apache.xml.security.utils.ElementProxy
addBase64Element, addBase64Text, addBigIntegerElement, addText, addTextElement, createElementForFamily, getBaseURI, getBigIntegerFromChildElement, getBytesFromChildElement, getBytesFromTextChild, getChildElementLocalName, getDefaultPrefix, getDocument, getElement, getElementPlusReturns, getTextFromChildElement, getTextFromTextChild, guaranteeThatElementInCorrectSpace, length, setDefaultPrefix, setElement, setXPathNamespaceContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncryptionMethod

public EncryptionMethod(org.w3c.dom.Document doc,
                        java.lang.String algorithmURI)
                 throws XMLSecurityException
Constructor EncryptionMethod

Parameters:
doc -
algorithmURI -
Throws:
XMLSecurityException

EncryptionMethod

public EncryptionMethod(org.w3c.dom.Document doc,
                        java.lang.String algorithmURI,
                        EncryptionMethodParams params)
                 throws XMLSecurityException
Constructor EncryptionMethod

Parameters:
doc -
algorithmURI -
params -
Throws:
XMLSecurityException

EncryptionMethod

public EncryptionMethod(org.w3c.dom.Element element,
                        java.lang.String BaseURI)
                 throws XMLSecurityException
Constructor EncryptionMethod

Parameters:
element -
BaseURI -
Throws:
XMLSecurityException
Method Detail

getBaseNamespace

public java.lang.String getBaseNamespace()
Method getBaseNamespace

Specified by:
getBaseNamespace in class ElementProxy
Returns:
the namespace of the Elements of the sub-class.

getBaseLocalName

public java.lang.String getBaseLocalName()
Method getBaseLocalName

Specified by:
getBaseLocalName in class ElementProxy
Returns:
the localname of the Elements of the sub-class.

getUsableInEncryptedData

public boolean getUsableInEncryptedData()
Method getUsableInEncryptedData


getUsableInEncryptedKey

public boolean getUsableInEncryptedKey()
Method getUsableInEncryptedKey


wrap

public byte[] wrap(java.security.Key contentKey,
                   java.security.Key wrapKey)
            throws XMLSecurityException
Method wrap

Parameters:
contentKey -
wrapKey -
Throws:
XMLSecurityException

wrap

public byte[] wrap(java.security.Key contentKey,
                   java.security.Key wrapKey,
                   byte[] IV)
            throws XMLSecurityException
Method wrap

Parameters:
contentKey -
wrapKey -
IV -
Throws:
XMLSecurityException

unwrap

public java.security.Key unwrap(byte[] wrappedKey,
                                java.security.Key wrapKey,
                                java.lang.String wrappedKeyAlgoURI)
                         throws XMLSecurityException
Method unwrap

Parameters:
wrappedKey -
wrapKey -
wrappedKeyAlgoURI -
Throws:
XMLSecurityException

encrypt

public byte[] encrypt(byte[] plaintextBytes,
                      java.security.Key contentKey)
               throws XMLSecurityException
Method encrypt

Parameters:
plaintextBytes -
contentKey -
Throws:
XMLSecurityException

encrypt

public byte[] encrypt(byte[] plaintextBytes,
                      java.security.Key contentKey,
                      byte[] IV)
               throws XMLSecurityException
Method encrypt

Parameters:
plaintextBytes -
contentKey -
IV -
Throws:
XMLSecurityException

decrypt

public byte[] decrypt(byte[] ciphertextBytes,
                      java.security.Key contentKey)
               throws XMLSecurityException
Method decrypt

Parameters:
ciphertextBytes -
contentKey -
Throws:
XMLSecurityException

getParams

public EncryptionMethodParams getParams()
Method getParams


getIvLength

public int getIvLength()
Method getIvLength


getBlockSize

public int getBlockSize()
Method getBlockSize


createSecretKeyFromBytes

public java.security.Key createSecretKeyFromBytes(byte[] encodedKey)
                                           throws XMLSecurityException
Method createSecretKeyFromBytes

Parameters:
encodedKey -
Throws:
XMLSecurityException

providerInit

public static void providerInit()
Method providerInit


register

public static boolean register(java.lang.String algorithmURI,
                               java.lang.String implementingClass)
Method register

Parameters:
algorithmURI -
implementingClass -

encryptB64

public java.lang.String encryptB64(byte[] plaintextBytes,
                                   java.security.Key contentKey,
                                   byte[] IV)
                            throws XMLSecurityException
XMLSecurityException

encryptB64

public java.lang.String encryptB64(byte[] plaintextBytes,
                                   java.security.Key contentKey)
                            throws XMLSecurityException
XMLSecurityException

decryptB64

public byte[] decryptB64(java.lang.String ciphertext,
                         java.security.Key contentKey)
                  throws XMLSecurityException
XMLSecurityException

wrapB64

public java.lang.String wrapB64(java.security.Key contentKey,
                                java.security.Key wrapKey)
                         throws XMLSecurityException
XMLSecurityException

wrapB64

public java.lang.String wrapB64(java.security.Key contentKey,
                                java.security.Key wrapKey,
                                byte[] IV)
                         throws XMLSecurityException
XMLSecurityException

unwrapB64

public java.security.Key unwrapB64(java.lang.String wrappedKey,
                                   java.security.Key wrapKey,
                                   java.lang.String wrappedKeyAlgoURI)
                            throws XMLSecurityException
XMLSecurityException