org.apache.derby.impl.services.jce
Class JCECipherProvider

java.lang.Object
  extended by org.apache.derby.impl.services.jce.JCECipherProvider
All Implemented Interfaces:
CipherProvider

 class JCECipherProvider
extends java.lang.Object
implements CipherProvider

This is a wrapper for a Cipher

See Also:
CipherFactory

Field Summary
private  javax.crypto.Cipher cipher
           
private  javax.crypto.SecretKey cryptixKey
           
private  int encryptionBlockSize
           
private  javax.crypto.spec.IvParameterSpec ivspec
           
private  boolean ivUsed
           
private  int mode
           
private  boolean sunjce
           
 
Constructor Summary
JCECipherProvider(int mode, javax.crypto.SecretKey secretKey, byte[] iv, java.lang.String algorithm, java.lang.String provider)
           
 
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
(package private)  boolean verifyIV(byte[] IV)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cipher

private javax.crypto.Cipher cipher

mode

private int mode

ivUsed

private boolean ivUsed

ivspec

private final javax.crypto.spec.IvParameterSpec ivspec

encryptionBlockSize

private final int encryptionBlockSize

sunjce

private boolean sunjce

cryptixKey

private javax.crypto.SecretKey cryptixKey
Constructor Detail

JCECipherProvider

JCECipherProvider(int mode,
                  javax.crypto.SecretKey secretKey,
                  byte[] iv,
                  java.lang.String algorithm,
                  java.lang.String provider)
            throws StandardException
Throws:
StandardException
Method Detail

encrypt

public int encrypt(byte[] cleartext,
                   int offset,
                   int length,
                   byte[] ciphertext,
                   int outputOffset)
            throws StandardException
Description copied from interface: CipherProvider
Encrypt data - use only with Cipher that has been initialized with CipherFactory.ENCRYPT.

Specified by:
encrypt in interface CipherProvider
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
See Also:
CipherProvider.encrypt(byte[], int, int, byte[], int)

decrypt

public int decrypt(byte[] ciphertext,
                   int offset,
                   int length,
                   byte[] cleartext,
                   int outputOffset)
            throws StandardException
Description copied from interface: CipherProvider
Decrypt data - use only with Cipher that has been initialized with CipherFactory.DECRYPT.

Specified by:
decrypt in interface CipherProvider
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
See Also:
CipherProvider.decrypt(byte[], int, int, byte[], int)

verifyIV

boolean verifyIV(byte[] IV)

getEncryptionBlockSize

public int getEncryptionBlockSize()
Description copied from interface: CipherProvider
Returns the encryption block size used during creation of the encrypted database

Specified by:
getEncryptionBlockSize in interface CipherProvider

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.