public class Cryptor extends Object
| Constructor and Description |
|---|
Cryptor() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decrypt(byte[] input,
String encryptionKey,
String diversifier,
long iv)
Decrypts input bytes using AES CTR mode with zero initialization vector,this is used in testing
only
|
static byte[] |
encrypt(byte[] compressedChunkData,
String encryptionKey,
String diversifier,
long iv)
Encrypts input bytes using AES CTR mode with zero initialization vector.
|
static byte[] |
sha256Hash(byte[] input)
Hashes input bytes using SHA-256.
|
static byte[] |
sha256Hash(byte[] input,
int offset,
int len)
Hashes input bytes using SHA-256.
|
static String |
sha256HashBase64(byte[] input)
Hashes input bytes using SHA-256 and converts hash into a string using Base64 encoding.
|
public static byte[] sha256Hash(byte[] input,
int offset,
int len)
input - input bytesoffset - offset into the output buffer to begin storing the digestlen - number of bytes within buf allotted for the digestpublic static byte[] sha256Hash(byte[] input)
input - input bytespublic static String sha256HashBase64(byte[] input)
input - input bytespublic static byte[] encrypt(byte[] compressedChunkData,
String encryptionKey,
String diversifier,
long iv)
throws NoSuchPaddingException,
NoSuchAlgorithmException,
InvalidAlgorithmParameterException,
InvalidKeyException,
IllegalBlockSizeException,
BadPaddingException
compressedChunkData - bytes to encryptencryptionKey - symmetric encryption keydiversifier - diversifier for the encryption keyiv - IV to use for encryptionNoSuchPaddingExceptionNoSuchAlgorithmExceptionInvalidAlgorithmParameterExceptionInvalidKeyExceptionIllegalBlockSizeExceptionBadPaddingExceptionpublic static byte[] decrypt(byte[] input,
String encryptionKey,
String diversifier,
long iv)
throws NoSuchPaddingException,
NoSuchAlgorithmException,
InvalidAlgorithmParameterException,
InvalidKeyException,
IllegalBlockSizeException,
BadPaddingException
input - bytes to encryptencryptionKey - symmetric encryption keydiversifier - diversifier for the decryption keyiv - IV to use for decryptionNoSuchPaddingExceptionNoSuchAlgorithmExceptionInvalidAlgorithmParameterExceptionInvalidKeyExceptionIllegalBlockSizeExceptionBadPaddingExceptionCopyright © 2023. All rights reserved.