byte[] encoding = Hex.decode("303132333435363738393a3b3c3d3e3f");
IESCipher c1 = new org.bouncycastle.jcajce.provider.asymmetric.dh.IESCipher.IES();
IESCipher c2 = new org.bouncycastle.jcajce.provider.asymmetric.dh.IESCipher.IES();
IESParameterSpec params = new IESParameterSpec(derivation,encoding,128);
// Testing DHIES with default prime in streaming mode
KeyPairGenerator g = KeyPairGenerator.getInstance("DH", "BC");
g.initialize(param);
doTest("DHIES with default", g, "DHIES", params);
// Testing DHIES with 512-bit prime in streaming mode
g.initialize(512, new SecureRandom());
doTest("DHIES with 512-bit", g, "DHIES", params);
// Testing ECIES with 1024-bit prime in streaming mode
g.initialize(1024, new SecureRandom());
doTest("DHIES with 1024-bit", g, "DHIES", params);
c1 = new IESCipher(new IESEngine(new DHBasicAgreement(),
new KDF2BytesGenerator(new SHA1Digest()),
new HMac(new SHA1Digest()),
new PaddedBufferedBlockCipher(new DESEngine())));
c2 = new IESCipher(new IESEngine(new DHBasicAgreement(),
new KDF2BytesGenerator(new SHA1Digest()),
new HMac(new SHA1Digest()),
new PaddedBufferedBlockCipher(new DESEngine())));
params = new IESParameterSpec(derivation, encoding, 128, 192);
// Testing DHIES with default prime using DESEDE
g = KeyPairGenerator.getInstance("DH", "BC");
doTest("DHIESwithDES default", g, "DHIESwithDESEDE", params);
// Testing DHIES with 512-bit prime using DESEDE
g.initialize(512, new SecureRandom());
doTest("DHIESwithDES 512-bit", g, "DHIESwithDESEDE", params);
// Testing DHIES with 1024-bit prime using DESEDE
g.initialize(1024, new SecureRandom());
doTest("DHIESwithDES 1024-bit", g, "DHIESwithDESEDE", params);
g = KeyPairGenerator.getInstance("DH", "BC");
g.initialize(param);
c1 = new IESCipher.IESwithAES();
c2 = new IESCipher.IESwithAES();
params = new IESParameterSpec(derivation, encoding, 128, 128);
// Testing DHIES with default curve using AES
doTest("DHIESwithAES default", g, "DHIESwithAES", params);
// Testing DHIES with 512-bit curve using AES