|
XML Security, 1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface EncryptionEngine
This interface defines methods for encryption and decryption of data and key. The methods are called by our XML Encryption processor as follows: On data encryption or decryption, init() is called first, and then update() is called repeatedly as long as data to be processed exist, and finally doFinal() is called. On key encryption or decryption, init() is called first, and then wrap() or unwrap() is called, respectively.
Instances of this interface are obtained through an instance of the EngineFactory interface. See its documentation for more details.
EngineFactory.getEncryptionEngine(String)
,
EngineFactory.releaseEncryptionEngine(EncryptionEngine)
Field Summary | |
---|---|
static int |
DECRYPT_MODE
Operation mode for data decryption. |
static int |
ENCRYPT_MODE
Operation mode for data encryption. |
static int |
UNWRAP_MODE
Operation mode for key unwrapping. |
static int |
WRAP_MODE
Operation mode for key wrapping. |
Method Summary | |
---|---|
byte[] |
doFinal()
Finishes a multiple-part operation. |
byte[] |
doFinal(byte[] input)
Processes data in a single-part operation, or finishes a multiple-part operation. |
byte[] |
doFinal(byte[] input,
int off,
int len)
Processes data in a single-part operation, or finishes a multiple-part operation. |
java.lang.String |
getURI()
Returns the algorithm URI of this engine. |
void |
init(int opMode,
java.security.Key key,
java.security.spec.AlgorithmParameterSpec spec)
Initializes this engine with a key and a set of algorithm parameters. |
java.security.Key |
unwrap(byte[] wrappedKey,
java.lang.String uri,
java.lang.String type)
Unwraps a previously wrapped key. |
byte[] |
update(byte[] input)
Continues a multiple-part operation, processing another data part. |
byte[] |
update(byte[] input,
int off,
int len)
Continues a multiple-part operation, processing another data part. |
byte[] |
wrap(java.security.Key key)
Wraps a key. |
Field Detail |
---|
static final int ENCRYPT_MODE
static final int DECRYPT_MODE
static final int WRAP_MODE
static final int UNWRAP_MODE
Method Detail |
---|
java.lang.String getURI()
void init(int opMode, java.security.Key key, java.security.spec.AlgorithmParameterSpec spec) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidKeyException
opMode
- operation mode, which is one of ENCRYPT_MODE,
DECRYPT_MODE, WRAP_MODE, or UNWRAP_MODE.key
- key.spec
- algorithm parameters. It may be null
.
java.security.InvalidAlgorithmParameterException
java.security.InvalidKeyException
byte[] update(byte[] input)
input
- input buffer.
byte[] update(byte[] input, int off, int len)
input
- input buffer.off
- start offset in the input buffer.len
- number of bytes to input.
byte[] doFinal() throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
byte[] doFinal(byte[] input) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException
input
- input buffer.
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
byte[] doFinal(byte[] input, int off, int len) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException
input
- input buffer.off
- start offset in the input buffer.len
- number of bytes to input.
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
byte[] wrap(java.security.Key key) throws javax.crypto.IllegalBlockSizeException, java.security.InvalidKeyException
key
- key to be wrapped.
javax.crypto.IllegalBlockSizeException
java.security.InvalidKeyException
java.security.Key unwrap(byte[] wrappedKey, java.lang.String uri, java.lang.String type) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException
wrappedKey
- key to be unwrapped.uri
- algorithm URI associated with the wrapped key, which
is usually the value of the Algorithm attribute of the
EncryptionMethod element of the EncryptedData or EncryptedKey
element to which the wrapped key was applied.type
- type of the wrapped key, which is usually the value
of the Type attribute of the EncryptedKey element containing
the wrapped key.
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
|
XML Security, 1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |