|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.healthmarketscience.jackcess.impl.BaseCryptCodecHandler
public abstract class BaseCryptCodecHandler
Common CodecHandler support.
| Field Summary | |
|---|---|
static boolean |
CIPHER_DECRYPT_MODE
|
static boolean |
CIPHER_ENCRYPT_MODE
|
| Constructor Summary | |
|---|---|
protected |
BaseCryptCodecHandler(com.healthmarketscience.jackcess.impl.PageChannel channel,
byte[] encodingKey)
|
| Method Summary | |
|---|---|
static byte[] |
applyPageNumber(byte[] key,
int offset,
int pageNumber)
Returns a copy of the given key with the bytes of the given pageNumber applied at the given offset using XOR. |
protected void |
blockDecrypt(ByteBuffer inPage,
ByteBuffer outPage,
int pageNumber)
Decrypts the given buffer using a block cipher. |
protected byte[] |
blockDecryptBytes(byte[] keyBytes,
byte[] iv,
byte[] encBytes)
Decrypts the given bytes using a block cipher configured with the given key and IV into a new byte[]. |
protected ByteBuffer |
blockEncrypt(ByteBuffer buffer,
int pageNumber)
Encrypts the given buffer using a block cipher and returns the encrypted buffer. |
protected abstract org.bouncycastle.crypto.CipherParameters |
computeCipherParams(int pageNumber)
Generates the cipher parameters for the given page number. |
protected static byte[] |
decryptBytes(org.bouncycastle.crypto.BufferedBlockCipher cipher,
byte[] encBytes)
Decrypts the given bytes using a block cipher into a new byte[]. |
protected static byte[] |
decryptBytes(StreamCipherCompat cipher,
byte[] encBytes)
Decrypts the given bytes using a stream cipher into a new byte[]. |
protected static org.bouncycastle.crypto.BufferedBlockCipher |
decryptInit(org.bouncycastle.crypto.BufferedBlockCipher cipher,
org.bouncycastle.crypto.CipherParameters params)
Inits the given cipher for decryption with the given params. |
protected static StreamCipherCompat |
decryptInit(StreamCipherCompat cipher,
org.bouncycastle.crypto.CipherParameters params)
Inits the given cipher for decryption with the given params. |
protected static org.bouncycastle.crypto.BufferedBlockCipher |
encryptInit(org.bouncycastle.crypto.BufferedBlockCipher cipher,
org.bouncycastle.crypto.CipherParameters params)
Inits the given cipher for encryption with the given params. |
protected static StreamCipherCompat |
encryptInit(StreamCipherCompat cipher,
org.bouncycastle.crypto.CipherParameters params)
Inits the given cipher for encryption with the given params. |
static byte[] |
fill(byte[] bytes,
int value)
Fills the given array with the given value and returns it. |
static byte[] |
fixToLength(byte[] bytes,
int len)
|
static byte[] |
fixToLength(byte[] bytes,
int len,
int padByte)
|
protected org.bouncycastle.crypto.BufferedBlockCipher |
getBlockCipher()
|
protected org.bouncycastle.crypto.CipherParameters |
getCipherParams(int pageNumber)
|
protected byte[] |
getEncodingKey()
|
protected byte[] |
getEncodingKey(int pageNumber)
Gets the encoding key combined with the given page number. |
protected StreamCipherCompat |
getStreamCipher()
|
protected ByteBuffer |
getTempBuffer()
|
static byte[] |
hash(org.bouncycastle.crypto.Digest digest,
byte[] bytes)
Hashes the given bytes using the given digest and returns the result. |
static byte[] |
hash(org.bouncycastle.crypto.Digest digest,
byte[] bytes1,
byte[] bytes2)
Hashes the given bytes1 and bytes2 using the given digest and returns the result. |
static byte[] |
hash(org.bouncycastle.crypto.Digest digest,
byte[] bytes1,
byte[] bytes2,
int resultLen)
Hashes the given bytes1 and bytes2 using the given digest and returns the hash fixed to the given length. |
static byte[] |
hash(org.bouncycastle.crypto.Digest digest,
byte[] bytes,
int resultLen)
Hashes the given bytes using the given digest and returns the hash fixed to the given length. |
protected static boolean |
isBlankKey(byte[] key)
|
protected static byte[] |
processBytesFully(org.bouncycastle.crypto.BufferedBlockCipher cipher,
byte[] inArray,
byte[] outArray,
int inLen)
Processes all the bytes for the given block cipher. |
protected static ByteBuffer |
readHeaderPage(com.healthmarketscience.jackcess.impl.PageChannel pageChannel)
Reads and returns the header page (page 0) from the given pageChannel. |
protected void |
streamDecrypt(ByteBuffer buffer,
int pageNumber)
Decrypts the given buffer using a stream cipher. |
protected ByteBuffer |
streamEncrypt(ByteBuffer buffer,
int pageNumber,
int pageOffset)
Encrypts the given buffer using a stream cipher and returns the encrypted buffer. |
String |
toString()
|
static ByteBuffer |
wrap(byte[] bytes)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.healthmarketscience.jackcess.impl.CodecHandler |
|---|
canDecodeInline, canEncodePartialPage, decodePage, encodePage |
| Field Detail |
|---|
public static final boolean CIPHER_DECRYPT_MODE
public static final boolean CIPHER_ENCRYPT_MODE
| Constructor Detail |
|---|
protected BaseCryptCodecHandler(com.healthmarketscience.jackcess.impl.PageChannel channel,
byte[] encodingKey)
| Method Detail |
|---|
protected org.bouncycastle.crypto.CipherParameters getCipherParams(int pageNumber)
protected byte[] getEncodingKey()
protected StreamCipherCompat getStreamCipher()
protected org.bouncycastle.crypto.BufferedBlockCipher getBlockCipher()
protected ByteBuffer getTempBuffer()
protected void streamDecrypt(ByteBuffer buffer,
int pageNumber)
protected ByteBuffer streamEncrypt(ByteBuffer buffer,
int pageNumber,
int pageOffset)
protected void blockDecrypt(ByteBuffer inPage,
ByteBuffer outPage,
int pageNumber)
protected ByteBuffer blockEncrypt(ByteBuffer buffer,
int pageNumber)
public String toString()
toString in class Object
protected static StreamCipherCompat decryptInit(StreamCipherCompat cipher,
org.bouncycastle.crypto.CipherParameters params)
protected static StreamCipherCompat encryptInit(StreamCipherCompat cipher,
org.bouncycastle.crypto.CipherParameters params)
protected static org.bouncycastle.crypto.BufferedBlockCipher decryptInit(org.bouncycastle.crypto.BufferedBlockCipher cipher,
org.bouncycastle.crypto.CipherParameters params)
protected static org.bouncycastle.crypto.BufferedBlockCipher encryptInit(org.bouncycastle.crypto.BufferedBlockCipher cipher,
org.bouncycastle.crypto.CipherParameters params)
protected static byte[] decryptBytes(StreamCipherCompat cipher,
byte[] encBytes)
protected byte[] blockDecryptBytes(byte[] keyBytes,
byte[] iv,
byte[] encBytes)
protected static byte[] decryptBytes(org.bouncycastle.crypto.BufferedBlockCipher cipher,
byte[] encBytes)
protected byte[] getEncodingKey(int pageNumber)
protected static ByteBuffer readHeaderPage(com.healthmarketscience.jackcess.impl.PageChannel pageChannel)
throws IOException
IOException
public static byte[] applyPageNumber(byte[] key,
int offset,
int pageNumber)
public static byte[] hash(org.bouncycastle.crypto.Digest digest,
byte[] bytes)
public static byte[] hash(org.bouncycastle.crypto.Digest digest,
byte[] bytes1,
byte[] bytes2)
public static byte[] hash(org.bouncycastle.crypto.Digest digest,
byte[] bytes,
int resultLen)
public static byte[] hash(org.bouncycastle.crypto.Digest digest,
byte[] bytes1,
byte[] bytes2,
int resultLen)
public static byte[] fixToLength(byte[] bytes,
int len)
public static byte[] fixToLength(byte[] bytes,
int len,
int padByte)
public static ByteBuffer wrap(byte[] bytes)
public static byte[] fill(byte[] bytes,
int value)
protected static byte[] processBytesFully(org.bouncycastle.crypto.BufferedBlockCipher cipher,
byte[] inArray,
byte[] outArray,
int inLen)
throws org.bouncycastle.crypto.InvalidCipherTextException
org.bouncycastle.crypto.InvalidCipherTextExceptionprotected static boolean isBlankKey(byte[] key)
true if the given bytes are all 0, false
otherwiseprotected abstract org.bouncycastle.crypto.CipherParameters computeCipherParams(int pageNumber)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||