public class CTRCipherGenerator extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected static String |
AES_ALGORITHM |
static int |
CRYPTO_IV_BYTES_LEN |
static int |
CRYPTO_KEY_BYTES_LEN |
static String |
ENCRYPTED_ALGORITHM |
static String |
ENCRYPTED_ALGORITHM_META_NAME |
static String |
ENCRYPTED_SHA_256_META_NAME |
static String |
ENCRYPTED_START_META_NAME |
static String |
MASTER_KEY_INFO_META_NAME |
static String |
PLAINTEXT_CONTENT_LENGTH_META_NAME |
static String |
PLAINTEXT_SHA_256_META_NAME |
| 构造器和说明 |
|---|
CTRCipherGenerator(String masterKeyInfo,
byte[] cryptoKeyBytes,
boolean needSha256,
SecureRandom secureRandom) |
CTRCipherGenerator(String masterKeyInfo,
byte[] cryptoIvBytes,
byte[] cryptoKeyBytes,
boolean needSha256,
SecureRandom secureRandom) |
| 限定符和类型 | 方法和说明 |
|---|---|
com.obs.services.crypto.CTRCipherGenerator.SHA256Info |
computeSHA256HashAES(InputStream plainTextStream,
byte[] object_CryptoIvBytes,
byte[] object_CryptoKeyBytes,
boolean needPlainTextSha256) |
CipherInputStream |
getAES256DecryptedStream(InputStream ciphertextInput,
byte[] object_CryptoIvBytes,
byte[] object_CryptoKeyBytes) |
CipherInputStream |
getAES256EncryptedStream(InputStream plaintextInput,
byte[] object_CryptoIvBytes,
byte[] object_CryptoKeyBytes) |
static Cipher |
getAesCipher() |
static String |
getAesCipherProvider() |
static byte[] |
getAESEncryptedBytes(byte[] plainText,
int plainTextOffset,
int plainTextLength,
byte[] aesKeyBytes,
byte[] aesIvBytes) |
static String |
getBase64Info(byte[] cryptoInfo) |
static byte[] |
getBytesFromBase64(String cryptoInfo) |
byte[] |
getCryptoIvBytes() |
byte[] |
getCryptoKeyBytes() |
static byte[] |
getFileSha256Bytes(String filePath) |
String |
getMasterKeyInfo() |
byte[] |
getRandomBytes(int randomBytesLen) |
byte[] |
getRandomCryptoIvBytes() |
byte[] |
getRandomCryptoKeyBytes() |
SecureRandom |
getSecureRandom() |
static int |
getSha256BufferLen() |
boolean |
isNeedSha256() |
static void |
setAesCipherProvider(String aesCipherProvider) |
void |
setBase64AES256Iv(String cryptoIvBase64) |
void |
setBase64AES256Key(String cryptoKeyBase64) |
void |
setCryptoIvBytes(byte[] cryptoIvBytes) |
void |
setCryptoKeyBytes(byte[] cryptoKeyBytes) |
void |
setMasterKeyInfo(String masterKeyInfo) |
void |
setNeedSha256(boolean needSha256) |
void |
setSecureRandom(SecureRandom secureRandom) |
static void |
setSha256BufferLen(int sha256BufferLen) |
public static final int CRYPTO_KEY_BYTES_LEN
public static final int CRYPTO_IV_BYTES_LEN
public static final String PLAINTEXT_CONTENT_LENGTH_META_NAME
public CTRCipherGenerator(String masterKeyInfo, byte[] cryptoIvBytes, byte[] cryptoKeyBytes, boolean needSha256, SecureRandom secureRandom)
public CTRCipherGenerator(String masterKeyInfo, byte[] cryptoKeyBytes, boolean needSha256, SecureRandom secureRandom)
public static String getAesCipherProvider()
public static void setAesCipherProvider(String aesCipherProvider)
public SecureRandom getSecureRandom()
public void setSecureRandom(SecureRandom secureRandom)
public String getMasterKeyInfo()
public void setMasterKeyInfo(String masterKeyInfo)
public byte[] getCryptoIvBytes()
public byte[] getRandomCryptoIvBytes()
public void setCryptoIvBytes(byte[] cryptoIvBytes)
public byte[] getCryptoKeyBytes()
public byte[] getRandomCryptoKeyBytes()
public byte[] getRandomBytes(int randomBytesLen)
public void setCryptoKeyBytes(byte[] cryptoKeyBytes)
public boolean isNeedSha256()
public void setNeedSha256(boolean needSha256)
public CipherInputStream getAES256DecryptedStream(InputStream ciphertextInput, byte[] object_CryptoIvBytes, byte[] object_CryptoKeyBytes) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, NoSuchProviderException
public CipherInputStream getAES256EncryptedStream(InputStream plaintextInput, byte[] object_CryptoIvBytes, byte[] object_CryptoKeyBytes) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, NoSuchProviderException
public static String getBase64Info(byte[] cryptoInfo)
public static byte[] getBytesFromBase64(String cryptoInfo) throws UnsupportedEncodingException
public static byte[] getAESEncryptedBytes(byte[] plainText,
int plainTextOffset,
int plainTextLength,
byte[] aesKeyBytes,
byte[] aesIvBytes)
throws IllegalBlockSizeException,
BadPaddingException,
InvalidAlgorithmParameterException,
InvalidKeyException,
NoSuchPaddingException,
NoSuchAlgorithmException,
NoSuchProviderException
public void setBase64AES256Key(String cryptoKeyBase64) throws UnsupportedEncodingException, ObsException
public void setBase64AES256Iv(String cryptoIvBase64) throws UnsupportedEncodingException, ObsException
public static byte[] getFileSha256Bytes(String filePath) throws IOException, NoSuchAlgorithmException
public static Cipher getAesCipher() throws NoSuchPaddingException, NoSuchAlgorithmException, NoSuchProviderException
public com.obs.services.crypto.CTRCipherGenerator.SHA256Info computeSHA256HashAES(InputStream plainTextStream, byte[] object_CryptoIvBytes, byte[] object_CryptoKeyBytes, boolean needPlainTextSha256) throws NoSuchAlgorithmException, IOException, ObsException
public static int getSha256BufferLen()
public static void setSha256BufferLen(int sha256BufferLen)
Copyright © 2024. All rights reserved.