From e7887ae160219aeeffa2c001f839734d96243de3 Mon Sep 17 00:00:00 2001 From: aldoli Date: Fri, 24 Sep 2021 17:51:17 +0800 Subject: [PATCH] make aes ctr encryption can set iv --- CHANGELOG.md | 3 +++ pom.xml | 2 +- src/main/java/com/qcloud/cos/internal/crypto/AesCtr.java | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf33b456..e94509c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [5.6.58] +- make aes ctr encryption mode can set iv + ## [5.6.57] - update AudioAuditing api - add VideoAuditing new params diff --git a/pom.xml b/pom.xml index 8a456e9b..f657f3e5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.qcloud cos_api - 5.6.57 + 5.6.58 jar cos-java-sdk java sdk for qcloud cos diff --git a/src/main/java/com/qcloud/cos/internal/crypto/AesCtr.java b/src/main/java/com/qcloud/cos/internal/crypto/AesCtr.java index 10d806a1..6a4bf7e3 100644 --- a/src/main/java/com/qcloud/cos/internal/crypto/AesCtr.java +++ b/src/main/java/com/qcloud/cos/internal/crypto/AesCtr.java @@ -20,14 +20,16 @@ class AesCtr extends ContentCryptoScheme { + private byte[] iv = null; + @Override String getKeyGeneratorAlgorithm() { return AES_GCM.getKeyGeneratorAlgorithm(); } @Override String getCipherAlgorithm() { return "AES/CTR/NoPadding"; } @Override int getKeyLengthInBits() { return AES_GCM.getKeyLengthInBits(); } @Override int getBlockSizeInBytes() { return AES_GCM.getBlockSizeInBytes(); } @Override int getIVLengthInBytes() { return 16; } @Override long getMaxPlaintextSize() { return MAX_CTR_BYTES; } - @Override byte[] getIV() { return null; } - @Override void setIV(byte[] iv) {} + @Override byte[] getIV() { return this.iv; } + @Override void setIV(byte[] iv) { this.iv = iv; } @Override byte[] adjustIV(byte[] iv, long byteOffset) {