Top Description Methods
org.apache.derby.iapi.services.crypto

public Interface CipherProvider

Known Direct Implementers
org.apache.derby.impl.services.jce.JCECipherProvider
Imports
java.security.Key, org.apache.derby.shared.common.error.StandardException

A CipherProvider is a wrapper for a Cipher class in JCE. This service is only available when run on JDK1.2 or beyond. To use this service, either the SunJCE or an alternative clean room implementation of the JCE must be installed. To use a CipherProvider to encrypt or decrypt, it needs 3 things: 1) A CipherProvider that is initialized to ENCRYPT or DECRYPT 2) A secret Key for the encryption/decryption 3) An Initialization Vector (IvParameterSpec) that is used to create some randomness in the encryption See $WS/docs/funcspec/mulan/configurableEncryption.html See http://java.sun.com/products/JDK/1.1/docs/guide/security/CryptoSpec.html See http://java.sun.com/products/JDK/1.2/docs/guide/security/CryptoSpec.html See http://java.sun.com/products/jdk/1.2/jce/index.html

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The number of bytes stored in cleartext.
decrypt
(byte[]
the byte array containing the ciphertext
ciphertext
,
int
decrypt from this byte offset in the ciphertext
offset
,
int
decrypt this many bytes starting from offset
length
,
byte[]
the byte array to store the cleartext
cleartext
,
int
the offset into the cleartext array the output should go If cleartext and ciphertext are the same array, caller must be careful to not overwrite the ciphertext before it is un-scrambled.
outputOffset
)

Decrypt data - use only with Cipher that has been initialized with CipherFactory.DECRYPT.

public int

Returns:

The number of bytes stored in ciphertext.
encrypt
(byte[]
the byte array containing the cleartext
cleartext
,
int
encrypt from this byte offset in the cleartext
offset
,
int
encrypt this many bytes starting from offset
length
,
byte[]
the byte array to store the ciphertext
ciphertext
,
int
the offset into the ciphertext array the output should go If cleartext and ciphertext are the same array, caller must be careful to not overwrite the cleartext before it is scrambled.
outputOffset
)

Encrypt data - use only with Cipher that has been initialized with CipherFactory.ENCRYPT.

public int

Returns:

the encryption block size
getEncryptionBlockSize
()

Returns the encryption block size used during creation of the encrypted database

Method Detail

decryptback to summary
public int decrypt(byte[] ciphertext, int offset, int length, byte[] cleartext, int outputOffset) throws StandardException

Decrypt data - use only with Cipher that has been initialized with CipherFactory.DECRYPT.

Parameters
ciphertext:byte[]

the byte array containing the ciphertext

offset:int

decrypt from this byte offset in the ciphertext

length:int

decrypt this many bytes starting from offset

cleartext:byte[]

the byte array to store the cleartext

outputOffset:int

the offset into the cleartext array the output should go If cleartext and ciphertext are the same array, caller must be careful to not overwrite the ciphertext before it is un-scrambled.

Returns:int

The number of bytes stored in cleartext.

Exceptions
StandardException:
Standard Derby Error Policy
encryptback to summary
public int encrypt(byte[] cleartext, int offset, int length, byte[] ciphertext, int outputOffset) throws StandardException

Encrypt data - use only with Cipher that has been initialized with CipherFactory.ENCRYPT.

Parameters
cleartext:byte[]

the byte array containing the cleartext

offset:int

encrypt from this byte offset in the cleartext

length:int

encrypt this many bytes starting from offset

ciphertext:byte[]

the byte array to store the ciphertext

outputOffset:int

the offset into the ciphertext array the output should go If cleartext and ciphertext are the same array, caller must be careful to not overwrite the cleartext before it is scrambled.

Returns:int

The number of bytes stored in ciphertext.

Exceptions
StandardException:
Standard Derby Error Policy
getEncryptionBlockSizeback to summary
public int getEncryptionBlockSize()

Returns the encryption block size used during creation of the encrypted database

Returns:int

the encryption block size