|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.xml.security.encryption.XMLCipher
XMLCipher
encrypts and decrypts the contents of
Document
s, Element
s and Element
contents. It was designed to resemble javax.crypto.Cipher
in
order to facilitate understanding of its functioning.
Field Summary | |
static java.lang.String |
AES_128
|
static java.lang.String |
AES_128_KeyWrap
|
static java.lang.String |
AES_192
|
static java.lang.String |
AES_192_KeyWrap
|
static java.lang.String |
AES_256
|
static java.lang.String |
AES_256_KeyWrap
|
static java.lang.String |
BASE64_ENCODING
|
static int |
DECRYPT_MODE
|
static java.lang.String |
DIFFIE_HELLMAN
|
static int |
ENCRYPT_MODE
|
static java.lang.String |
EXCL_XML_N14C
|
static java.lang.String |
EXCL_XML_N14C_WITH_COMMENTS
|
static java.lang.String |
N14C_XML
|
static java.lang.String |
N14C_XML_WITH_COMMENTS
|
static java.lang.String |
RIPEMD_160
|
static java.lang.String |
RSA_OAEP
|
static java.lang.String |
RSA_v1dot5
|
static java.lang.String |
SHA1
|
static java.lang.String |
SHA256
|
static java.lang.String |
SHA512
|
static java.lang.String |
TRIPLEDES
|
static java.lang.String |
TRIPLEDES_KeyWrap
|
static int |
UNWRAP_MODE
|
static int |
WRAP_MODE
|
static java.lang.String |
XML_DSIG
|
Method Summary | |
org.w3c.dom.Document |
doFinal(org.w3c.dom.Document context,
org.w3c.dom.Document source)
Process a DOM Document node. |
org.w3c.dom.Document |
doFinal(org.w3c.dom.Document context,
org.w3c.dom.Element element)
Process a DOM Element node. |
org.w3c.dom.Document |
doFinal(org.w3c.dom.Document context,
org.w3c.dom.Element element,
boolean content)
Process the contents of a DOM Element node. |
EncryptedData |
encryptData(org.w3c.dom.Document context,
org.w3c.dom.Element element)
Returns an EncryptedData interface. |
EncryptedKey |
encryptKey(org.w3c.dom.Document context,
org.w3c.dom.Element element)
Decrypts an EncryptedKey object. |
static XMLCipher |
getInstance(java.lang.String transformation)
Returns an XMLCipher that implements the specified
transformation and operates on the specified context document. |
static XMLCipher |
getInstance(java.lang.String transformation,
java.lang.String provider)
Returns an XMLCipher that implements the specified
transformation and operates on the specified context document. |
void |
init(int opmode,
java.security.Key key)
Initializes this cipher with a key. |
EncryptedData |
loadEncryptedData(org.w3c.dom.Document context,
org.w3c.dom.Element element)
Returns an EncryptedData interface. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String TRIPLEDES
public static final java.lang.String AES_128
public static final java.lang.String AES_256
public static final java.lang.String AES_192
public static final java.lang.String RSA_v1dot5
public static final java.lang.String RSA_OAEP
public static final java.lang.String DIFFIE_HELLMAN
public static final java.lang.String TRIPLEDES_KeyWrap
public static final java.lang.String AES_128_KeyWrap
public static final java.lang.String AES_256_KeyWrap
public static final java.lang.String AES_192_KeyWrap
public static final java.lang.String SHA1
public static final java.lang.String SHA256
public static final java.lang.String SHA512
public static final java.lang.String RIPEMD_160
public static final java.lang.String XML_DSIG
public static final java.lang.String N14C_XML
public static final java.lang.String N14C_XML_WITH_COMMENTS
public static final java.lang.String EXCL_XML_N14C
public static final java.lang.String EXCL_XML_N14C_WITH_COMMENTS
public static final java.lang.String BASE64_ENCODING
public static final int ENCRYPT_MODE
public static final int DECRYPT_MODE
public static final int UNWRAP_MODE
public static final int WRAP_MODE
Method Detail |
public static XMLCipher getInstance(java.lang.String transformation) throws XMLEncryptionException
XMLCipher
that implements the specified
transformation and operates on the specified context document.
If the default provider package supplies an implementation of the requested transformation, an instance of Cipher containing that implementation is returned. If the transformation is not available in the default provider package, other provider packages are searched.
NOTE1: The transformation name does not follow the same pattern as that oulined in the Java Cryptography Extension Reference Guide but rather that specified by the XML Encryption Syntax and Processing document. The rational behind this is to make it easier for a novice at writing Java Encryption software to use the library.
NOTE2: getInstance()
does not follow the
same pattern regarding exceptional conditions as that used in
javax.crypto.Cipher
. Instead, it only throws an
XMLEncryptionException
which wraps an underlying exception.
The stack trace from the exception should be self explanitory.
transformation
- the name of the transformation, e.g.,
XMLCipher.TRIPLEDES
which is shorthand for
"http://www.w3.org/2001/04/xmlenc#tripledes-cbc"
XMLEncryptionException
.
XMLEncryptionException
Cipher.getInstance(java.lang.String)
public static XMLCipher getInstance(java.lang.String transformation, java.lang.String provider) throws XMLEncryptionException
XMLCipher
that implements the specified
transformation and operates on the specified context document.
transformation
- the name of the transformation, e.g.,
XMLCipher.TRIPLEDES
which is shorthand for
"http://www.w3.org/2001/04/xmlenc#tripledes-cbc"provider
- the JCE provider that supplies the transformation
XMLEncryptionException
.
XMLEncryptionException
public void init(int opmode, java.security.Key key) throws XMLEncryptionException
The cipher is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.
opmode
- the operation mode of this cipher (this is one of the
following: ENCRYPT_MODE, DECRYPT_MODE, WRAP_MODE or UNWRAP_MODE)key
-
XMLEncryptionException
Cipher.init(int, java.security.Key)
public org.w3c.dom.Document doFinal(org.w3c.dom.Document context, org.w3c.dom.Document source) throws XMLEncryptionException
Document
node. The processing depends on the
initialization parameters of init()
.
context
- the context Document
.source
- the Document
to be encrypted or decrypted.
Document
.
XMLEnccryptionException
- to indicate any exceptional conditions.
XMLEncryptionException
public org.w3c.dom.Document doFinal(org.w3c.dom.Document context, org.w3c.dom.Element element) throws XMLEncryptionException
Element
node. The processing depends on the
initialization parameters of init()
.
context
- the context Document
.element
- the Element
to be encrypted.
Document
.
XMLEnccryptionException
- to indicate any exceptional conditions.
XMLEncryptionException
public org.w3c.dom.Document doFinal(org.w3c.dom.Document context, org.w3c.dom.Element element, boolean content) throws XMLEncryptionException
Element
node. The processing
depends on the initialization parameters of
init()
.
context
- the context Document
.element
- the Element
which contents is to be
encrypted.
Document
.
XMLEnccryptionException
- to indicate any exceptional conditions.
XMLEncryptionException
public EncryptedData encryptData(org.w3c.dom.Document context, org.w3c.dom.Element element) throws XMLEncryptionException
EncryptedData
interface. Use this operation if
you want to have full control over the contents of the
EncryptedData
structure.
context
- the context Document
.element
- the Element
that will be encrypted.
XMLEncryptionException.
XMLEncryptionException
public EncryptedData loadEncryptedData(org.w3c.dom.Document context, org.w3c.dom.Element element) throws XMLEncryptionException
EncryptedData
interface. Use this operation if
you want to load an EncryptedData
structure from a DOM
structure and manipulate the contents
context
- the context Document
.element
- the Element
that will be loaded
XMLEncryptionException.
XMLEncryptionException
public EncryptedKey encryptKey(org.w3c.dom.Document context, org.w3c.dom.Element element) throws XMLEncryptionException
EncryptedKey
object.
XMLEncryptionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |