Skip to content

Commit

Permalink
make aes ctr encryption can set iv
Browse files Browse the repository at this point in the history
  • Loading branch information
aldoli committed Sep 24, 2021
1 parent c44bb41 commit e7887ae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.qcloud</groupId>
<artifactId>cos_api</artifactId>
<version>5.6.57</version>
<version>5.6.58</version>
<packaging>jar</packaging>
<name>cos-java-sdk</name>
<description>java sdk for qcloud cos</description>
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/qcloud/cos/internal/crypto/AesCtr.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e7887ae

Please sign in to comment.