org.apache.derby.iapi.services.crypto
Interface CipherProvider

All Known Implementing Classes:
JCECipherProvider

public interface CipherProvider

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
 int decrypt(byte[] ciphertext, int offset, int length, byte[] cleartext, int outputOffset)
          Decrypt data - use only with Cipher that has been initialized with CipherFactory.DECRYPT.
 int encrypt(byte[] cleartext, int offset, int length, byte[] ciphertext, int outputOffset)
          Encrypt data - use only with Cipher that has been initialized with CipherFactory.ENCRYPT.
 int getEncryptionBlockSize()
          Returns the encryption block size used during creation of the encrypted database
 

Method Detail

encrypt

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 - the byte array containing the cleartext
offset - encrypt from this byte offset in the cleartext
length - encrypt this many bytes starting from offset
ciphertext - the byte array to store the ciphertext
outputOffset - 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:
The number of bytes stored in ciphertext.
Throws:
StandardException - Standard Derby Error Policy

decrypt

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 - the byte array containing the ciphertext
offset - decrypt from this byte offset in the ciphertext
length - decrypt this many bytes starting from offset
cleartext - the byte array to store the cleartext
outputOffset - 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:
The number of bytes stored in cleartext.
Throws:
StandardException - Standard Derby Error Policy

getEncryptionBlockSize

int getEncryptionBlockSize()
Returns the encryption block size used during creation of the encrypted database


Built on Thu 2012-03-29 21:53:33+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.