@@ -61,7 +61,7 @@ public class CipherInputStreamTest extends TestCase {
|
||||
public byte[] aad;
|
||||
public byte[] ct;
|
||||
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public TestVector(
|
||||
String algorithm, int keySize, int ivSize, int tagSize, int ptSize, int aadSize)
|
||||
throws Exception {
|
||||
@@ -100,7 +100,7 @@ public class CipherInputStreamTest extends TestCase {
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testEncrypt(Iterable<TestVector> tests) throws Exception {
|
||||
for (TestVector t : tests) {
|
||||
Cipher cipher = Cipher.getInstance(t.algorithm);
|
||||
@@ -124,7 +124,7 @@ public class CipherInputStreamTest extends TestCase {
|
||||
}
|
||||
|
||||
/** JDK-8016249: CipherInputStream in decrypt mode fails on close with AEAD ciphers */
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testDecrypt(Iterable<TestVector> tests) throws Exception {
|
||||
for (TestVector t : tests) {
|
||||
Cipher cipher = Cipher.getInstance(t.algorithm);
|
||||
@@ -155,7 +155,7 @@ public class CipherInputStreamTest extends TestCase {
|
||||
* with BouncyCastle v 1.52. A possible explanation is that BouncyCastle has its own
|
||||
* implemenatation of CipherInputStream (org.bouncycastle.crypto.io.CipherInputStream).
|
||||
*/
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testCorruptDecrypt(Iterable<TestVector> tests) throws Exception {
|
||||
for (TestVector t : tests) {
|
||||
Cipher cipher = Cipher.getInstance(t.algorithm);
|
||||
@@ -189,7 +189,7 @@ public class CipherInputStreamTest extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testCorruptDecryptEmpty(Iterable<TestVector> tests) throws Exception {
|
||||
for (TestVector t : tests) {
|
||||
Cipher cipher = Cipher.getInstance(t.algorithm);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class CipherOutputStreamTest extends TestCase {
|
||||
}
|
||||
|
||||
/** Test vectors */
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public static class TestVector {
|
||||
public String algorithm;
|
||||
public SecretKeySpec key;
|
||||
@@ -99,7 +99,7 @@ public class CipherOutputStreamTest extends TestCase {
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testEncrypt(Iterable<TestVector> tests) throws Exception {
|
||||
for (TestVector t : tests) {
|
||||
Cipher cipher = Cipher.getInstance(t.algorithm);
|
||||
@@ -113,7 +113,7 @@ public class CipherOutputStreamTest extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testDecrypt(Iterable<TestVector> tests) throws Exception {
|
||||
for (TestVector t : tests) {
|
||||
Cipher cipher = Cipher.getInstance(t.algorithm);
|
||||
@@ -127,7 +127,7 @@ public class CipherOutputStreamTest extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testCorruptDecrypt(Iterable<TestVector> tests) throws Exception {
|
||||
for (TestVector t : tests) {
|
||||
Cipher cipher = Cipher.getInstance(t.algorithm);
|
||||
@@ -158,7 +158,7 @@ public class CipherOutputStreamTest extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testCorruptDecryptEmpty(Iterable<TestVector> tests) throws Exception {
|
||||
for (TestVector t : tests) {
|
||||
Cipher cipher = Cipher.getInstance(t.algorithm);
|
||||
@@ -216,7 +216,7 @@ public class CipherOutputStreamTest extends TestCase {
|
||||
}
|
||||
|
||||
/** Tests CipherOutputStream with AES-EAX if AES-EAS is supported by the provider. */
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testAesEax() throws Exception {
|
||||
final String algorithm = "AES/EAX/NoPadding";
|
||||
final int[] keySizes = {16, 32};
|
||||
|
||||
@@ -75,7 +75,7 @@ public class DhiesTest extends TestCase {
|
||||
* works in the sense that it can decrypt what it encrypts. Unfortunately it seems that there is
|
||||
* no secure mode using AES.
|
||||
*/
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testDhiesBasic() throws Exception {
|
||||
DHParameterSpec params = ike2048();
|
||||
KeyPairGenerator kf = KeyPairGenerator.getInstance("DH");
|
||||
@@ -98,7 +98,7 @@ public class DhiesTest extends TestCase {
|
||||
* ciphertexts. Checks that a modification of the ciphertext is dectected.
|
||||
*/
|
||||
@SlowTest(providers = {ProviderType.BOUNCY_CASTLE, ProviderType.SPONGY_CASTLE})
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testDhiesCorrupt() throws Exception {
|
||||
KeyPairGenerator kf = KeyPairGenerator.getInstance("DH");
|
||||
kf.initialize(ike2048());
|
||||
@@ -126,7 +126,7 @@ public class DhiesTest extends TestCase {
|
||||
* Tries to detect if an algorithm is using ECB. Unfortunately, many JCE algorithms use ECB if no
|
||||
* encryption mode is specified.
|
||||
*/
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testNotEcb(String algorithm) throws Exception {
|
||||
Cipher dhies;
|
||||
try {
|
||||
|
||||
@@ -1126,7 +1126,7 @@ public class DsaTest extends TestCase {
|
||||
* DSA does not allow encryption. This test verifies that a provider does not implement an ad hoc
|
||||
* scheme that attempts to turn DSA into a public key encryption scheme.
|
||||
*/
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testEncryptionWithDsa() throws Exception {
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("DSA");
|
||||
|
||||
@@ -68,7 +68,7 @@ public class EciesTest extends TestCase {
|
||||
* AES-CBC with PKCS #5 padding. HMAC-SHA1 with a 20 byte digest. The AES and the HMAC key are
|
||||
* both 128 bits.
|
||||
*/
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testEciesBasic() throws Exception {
|
||||
ECGenParameterSpec ecSpec = new ECGenParameterSpec("secp256r1");
|
||||
KeyPairGenerator kf = KeyPairGenerator.getInstance("EC");
|
||||
@@ -92,7 +92,7 @@ public class EciesTest extends TestCase {
|
||||
*/
|
||||
// TODO(bleichen): This test describes BouncyCastles behaviour, but not necessarily what we
|
||||
// expect.
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testInvalidNames() throws Exception {
|
||||
String[] invalidNames =
|
||||
new String[] {
|
||||
@@ -114,7 +114,7 @@ public class EciesTest extends TestCase {
|
||||
/** Here are a few names that BouncyCastle accepts. */
|
||||
// TODO(bleichen): This test describes BouncyCastles behaviour, but not necessarily what we
|
||||
// expect.
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testValidNames() throws Exception {
|
||||
String[] invalidNames =
|
||||
new String[] {
|
||||
@@ -151,7 +151,7 @@ public class EciesTest extends TestCase {
|
||||
* <li> CVE-2016-1000345 BouncyCastle before v.1.56 is vulnerable to a padding oracle attack.
|
||||
* </ul>
|
||||
*/
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testExceptions(String algorithm) throws Exception {
|
||||
Cipher ecies;
|
||||
try {
|
||||
@@ -197,7 +197,7 @@ public class EciesTest extends TestCase {
|
||||
testExceptions("ECIES");
|
||||
}
|
||||
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testModifyPoint() throws Exception {
|
||||
ECGenParameterSpec ecSpec = new ECGenParameterSpec("secp256r1");
|
||||
KeyPairGenerator kf = KeyPairGenerator.getInstance("EC");
|
||||
@@ -224,7 +224,7 @@ public class EciesTest extends TestCase {
|
||||
* This test tries to detect ECIES implementations using ECB. This is insecure and also violates
|
||||
* the claims of ECIES, since ECIES is secure agains adaptive chosen-ciphertext attacks.
|
||||
*/
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testNotEcb(String algorithm) throws Exception {
|
||||
Cipher ecies;
|
||||
try {
|
||||
@@ -257,7 +257,7 @@ public class EciesTest extends TestCase {
|
||||
* Tests whether algorithmA is an alias of algorithmB by encrypting with algorithmA and decrypting
|
||||
* with algorithmB.
|
||||
*/
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testIsAlias(String algorithmA, String algorithmB) throws Exception {
|
||||
Cipher eciesA;
|
||||
Cipher eciesB;
|
||||
|
||||
@@ -94,7 +94,7 @@ public class RsaEncryptionTest extends TestCase {
|
||||
* differences are too small to be reliably detectable in unit tests.
|
||||
* </ul>
|
||||
*/
|
||||
@SuppressWarnings("InsecureCipherMode")
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testExceptions(String algorithm) throws Exception {
|
||||
KeyPairGenerator keygen = KeyPairGenerator.getInstance("RSA");
|
||||
keygen.initialize(1024);
|
||||
|
||||
Reference in New Issue
Block a user