Updates for release of BouncyCastle 1.56 (#8)
- add maven entry for BC 1.56 and update the versions range - DHIES weak crypto tests now pass if algs not even supported - some ECIES entries moved to the invalid list - ECIES decryption init calls fixed to pass the correct parameters - EciesTest.testModifyPoint now expects GeneralSecurityException
This commit is contained in:
committed by
Thai Duong
parent
06d73e0349
commit
fa01b5aeae
@@ -71,9 +71,9 @@ public class DhiesTest extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* WARNING: This test uses weak crypto (i.e. DHIESWithAES). Checks that key agreement using DHIES
|
||||
* works in the sense that it can decrypt what it encrypts. Unfortunately it seems that there is
|
||||
* no secure mode using AES.
|
||||
* WARNING: This test uses weak crypto (i.e. DHIESWithAES), if supported. Checks that key agreement
|
||||
* using DHIES works in the sense that it can decrypt what it encrypts. Unfortunately it seems that
|
||||
* there is no secure mode using AES.
|
||||
*/
|
||||
@SuppressWarnings("InsecureCryptoUsage")
|
||||
public void testDhiesBasic() throws Exception {
|
||||
@@ -84,7 +84,13 @@ public class DhiesTest extends TestCase {
|
||||
PrivateKey priv = keyPair.getPrivate();
|
||||
PublicKey pub = keyPair.getPublic();
|
||||
byte[] message = "Hello".getBytes("UTF-8");
|
||||
Cipher dhies = Cipher.getInstance("DHIESwithAES");
|
||||
Cipher dhies;
|
||||
try {
|
||||
dhies = Cipher.getInstance("DHIESwithAES");
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
// The algorithm isn't supported - even better!
|
||||
return;
|
||||
}
|
||||
dhies.init(Cipher.ENCRYPT_MODE, pub);
|
||||
byte[] ciphertext = dhies.doFinal(message);
|
||||
System.out.println("testDhiesBasic:" + TestUtil.bytesToHex(ciphertext));
|
||||
@@ -106,7 +112,13 @@ public class DhiesTest extends TestCase {
|
||||
PrivateKey priv = keyPair.getPrivate();
|
||||
PublicKey pub = keyPair.getPublic();
|
||||
byte[] message = new byte[32];
|
||||
Cipher dhies = Cipher.getInstance("DHIESwithAES");
|
||||
Cipher dhies;
|
||||
try {
|
||||
dhies = Cipher.getInstance("DHIESwithAES");
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
// The algorithm isn't supported - even better!
|
||||
return;
|
||||
}
|
||||
dhies.init(Cipher.ENCRYPT_MODE, pub);
|
||||
byte[] ciphertext = dhies.doFinal(message);
|
||||
for (int i = 0; i < ciphertext.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user