Skip to content

Commit

Permalink
feat: 敏感信息存储支持国密 TencentBlueKing#2055
Browse files Browse the repository at this point in the history
修复从输入流中提取元数据后解密失败的问题
  • Loading branch information
jsonwan committed Aug 21, 2023
1 parent fae52ad commit 7076e01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ buildscript {
maven { url mavenRepoUrl }
maven { url "https://plugins.gradle.org/m2/" }
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
classpath "io.spring.gradle:dependency-management-plugin:$springDependencyManagePluginVersion"
Expand Down Expand Up @@ -130,7 +131,7 @@ ext {
set('jcommanderVersion', "1.71")
set('kubernetesJavaClientVersion', "11.0.4")
set('springCloudKubernetesVersion', "2.0.6")
set('cryptoJavaSDKVersion', "1.0.1")
set('cryptoJavaSDKVersion', "1.1.2-SNAPSHOT")
if (System.getProperty("bkjobVersion")) {
set('bkjobVersion', System.getProperty("bkjobVersion"))
println "bkjobVersion:" + bkjobVersion
Expand Down Expand Up @@ -193,6 +194,7 @@ allprojects {
url "https://repo.spring.io/milestone"
}
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ public void encryptBackupFile(String password, File inFile, File outFile) {
public void decryptBackupFile(String password, File inFile, File outFile) {
try {
FileInputStream in = new FileInputStream(inFile);
log.debug("in.available={}", in.available());
BufferedInputStream bis = new BufferedInputStream(in);
String algorithm = CryptorMetaUtil.getCryptorNameFromCipherStream(bis);
if (StringUtils.isBlank(algorithm)) {
algorithm = JobCryptorNames.AES_CBC;
}
try (FileOutputStream out = new FileOutputStream(outFile)) {
log.debug("Use {} to decryptBackupFile", algorithm);
log.debug("Use {} to decryptBackupFile, bis.available={}", algorithm, bis.available());
symmetricCryptoService.decrypt(password, bis, out, algorithm);
}
} catch (Exception e) {
Expand Down

0 comments on commit 7076e01

Please sign in to comment.