瀏覽代碼

Delegate crypto algorithm creation to InsecureCipherFactory

This is a preparation change to Bazel build implementation. Error
Prone rejects the code with variable crypto algorithm as insecure
see: [1].

[1] http://errorprone.info/bugpattern/InsecureCryptoUsage

Change-Id: I92db70a7da454bc364597a995e8be5dccc2d6427
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
tags/v4.7.0.201704051617-r
David Ostrovsky 7 年之前
父節點
當前提交
cee9d444e9
共有 1 個檔案被更改,包括 4 行新增5 行删除
  1. 4
    5
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java

+ 4
- 5
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java 查看文件

@@ -91,7 +91,6 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.UUID;

import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;

import org.eclipse.jgit.api.Git;
@@ -772,16 +771,16 @@ public class WalkEncryptionTest {
String profile = props.getProperty(AmazonS3.Keys.CRYPTO_ALG);
String version = props.getProperty(AmazonS3.Keys.CRYPTO_VER,
WalkEncryption.Vals.DEFAULT_VERS);
String crytoAlgo;
String cryptoAlgo;
String keyAlgo;
switch (version) {
case WalkEncryption.Vals.DEFAULT_VERS:
case WalkEncryption.JGitV1.VERSION:
crytoAlgo = profile;
cryptoAlgo = profile;
keyAlgo = profile;
break;
case WalkEncryption.JGitV2.VERSION:
crytoAlgo = props
cryptoAlgo = props
.getProperty(profile + WalkEncryption.Keys.X_ALGO);
keyAlgo = props
.getProperty(profile + WalkEncryption.Keys.X_KEY_ALGO);
@@ -790,7 +789,7 @@ public class WalkEncryptionTest {
return false;
}
try {
Cipher.getInstance(crytoAlgo);
InsecureCipherFactory.create(cryptoAlgo);
SecretKeyFactory.getInstance(keyAlgo);
return true;
} catch (Throwable e) {

Loading…
取消
儲存