public class Security extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
bytesAreEqual(byte[] one,
int oneOffset,
int oneLength,
byte[] two,
int twoOffset,
int twoLength) |
static void |
decryptAndDesalt(byte[] src,
int offset,
int length,
EncryptionKey key,
ByteArray dest) |
static void |
getRandom(byte[] dest,
int offset,
int length) |
static IBlockInput |
makeSecureBlockInput(IBlockInput inp,
ISecureChannel ch) |
static IBlockOutput |
makeSecureBlockOutput(IBlockOutput out,
ISecureChannel ch) |
static void |
saltAndEncrypt(byte[] src,
int offset,
int length,
EncryptionKey key,
int saltLength,
ByteArray dest,
int maxChunksize)
Encrypt a salted version of the source data, and break up the data if it is too big for the EncryptionKey.
|
public static void getRandom(byte[] dest, int offset, int length)
public static boolean bytesAreEqual(byte[] one, int oneOffset, int oneLength, byte[] two, int twoOffset, int twoLength)
public static void saltAndEncrypt(byte[] src, int offset, int length, EncryptionKey key, int saltLength, ByteArray dest, int maxChunksize) throws IOException
src
- the data to encrypt.offset
- the start of the data.length
- the number of bytes of data.key
- the EncryptionKeysaltLength
- the number of bytes to salt with. If this is a negative value then a random
value between 0 and -saltLength is chosen.dest
- the destination ByteArray to place the encrytped data.IOException
public static void decryptAndDesalt(byte[] src, int offset, int length, EncryptionKey key, ByteArray dest) throws IOException
IOException
public static IBlockOutput makeSecureBlockOutput(IBlockOutput out, ISecureChannel ch)
public static IBlockInput makeSecureBlockInput(IBlockInput inp, ISecureChannel ch)