Class BaseCryptCodecHandler
- java.lang.Object
-
- com.healthmarketscience.jackcess.crypt.impl.BaseCryptCodecHandler
-
- All Implemented Interfaces:
CodecHandler
- Direct Known Subclasses:
BaseJetCryptCodecHandler,OfficeCryptCodecHandler
public abstract class BaseCryptCodecHandler extends Object implements CodecHandler
Common CodecHandler support.- Author:
- Vladimir Berezniker
-
-
Field Summary
Fields Modifier and Type Field Description static booleanCIPHER_DECRYPT_MODEstatic booleanCIPHER_ENCRYPT_MODE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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)static byte[]hash(Digest digest, byte[] bytes)Hashes the given bytes using the given digest and returns the result.static byte[]hash(Digest digest, byte[] bytes1, byte[] bytes2)Hashes the given bytes1 and bytes2 using the given digest and returns the result.static byte[]hash(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(Digest digest, byte[] bytes, int resultLen)Hashes the given bytes using the given digest and returns the hash fixed to the given length.StringtoString()static ByteBufferwrap(byte[] bytes)-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.healthmarketscience.jackcess.impl.CodecHandler
canDecodeInline, canEncodePartialPage, decodePage, encodePage
-
-
-
-
Field Detail
-
CIPHER_DECRYPT_MODE
public static final boolean CIPHER_DECRYPT_MODE
- See Also:
- Constant Field Values
-
CIPHER_ENCRYPT_MODE
public static final boolean CIPHER_ENCRYPT_MODE
- See Also:
- Constant Field Values
-
-
Method Detail
-
applyPageNumber
public 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.
-
hash
public static byte[] hash(Digest digest, byte[] bytes)
Hashes the given bytes using the given digest and returns the result.
-
hash
public static byte[] hash(Digest digest, byte[] bytes1, byte[] bytes2)
Hashes the given bytes1 and bytes2 using the given digest and returns the result.
-
hash
public static byte[] hash(Digest digest, byte[] bytes, int resultLen)
Hashes the given bytes using the given digest and returns the hash fixed to the given length.
-
hash
public static byte[] hash(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.
-
fixToLength
public static byte[] fixToLength(byte[] bytes, int len)- Returns:
- a byte array of the given length, truncating or padding the given byte array as necessary.
-
fixToLength
public static byte[] fixToLength(byte[] bytes, int len, int padByte)- Returns:
- a byte array of the given length, truncating or padding the given byte array as necessary using the given padByte.
-
wrap
public static ByteBuffer wrap(byte[] bytes)
- Returns:
- a new ByteBuffer wrapping the given bytes with the appropriate byte order
-
fill
public static byte[] fill(byte[] bytes, int value)Fills the given array with the given value and returns it.
-
-