public static IESParameterSpec guessParameterSpec(IESEngine engine) { if (engine.getCipher() == null) { return new IESParameterSpec(null, null, 128); } else if (engine.getCipher().getUnderlyingCipher().getAlgorithmName().equals("DES") || engine.getCipher().getUnderlyingCipher().getAlgorithmName().equals("RC2") || engine.getCipher().getUnderlyingCipher().getAlgorithmName().equals("RC5-32") || engine.getCipher().getUnderlyingCipher().getAlgorithmName().equals("RC5-64")) { return new IESParameterSpec(null, null, 64, 64); } else if (engine.getCipher().getUnderlyingCipher().getAlgorithmName().equals("SKIPJACK")) { return new IESParameterSpec(null, null, 80, 80); } else if (engine.getCipher().getUnderlyingCipher().getAlgorithmName().equals("GOST28147")) { return new IESParameterSpec(null, null, 256, 256); } return new IESParameterSpec(null, null, 128, 128); }
public static byte[] decryptMessage(PrivateKey key, ECIESMessage message) throws ECIESException { try { // check key algorithm if (!key.getAlgorithm().equals(ASYMMETRIC_ALGORITHM)) throw new ECIESException("Wrong key algorithm"); // IES engine IESEngine ies = getIESEngine(); // initialize engine Curve25519DecryptionParameter ep = new Curve25519DecryptionParameter(key.getEncoded(), message.getR()); ParametersWithIV p = new ParametersWithIV(new IESWithCipherParameters(message.getSh1(), message.getSh2(), MAC_KEY_SIZE_BITS, AES_KEY_SIZE_BITS), message.getIv()); ies.init(false, null, ep, p); // decrypt and return data return ies.processBlock(message.getCd(), 0, message.getCd().length); } catch (InvalidCipherTextException ex) { throw new ECIESException("Message corrupted or wrong key", ex); } }
public IESwithDESede() { super(new IESEngine(new DHBasicAgreement(), new KDF2BytesGenerator(new SHA1Digest()), new HMac(new SHA1Digest()), new PaddedBufferedBlockCipher(new DESedeEngine()))); }
public IESwithAES() { super(new IESEngine(new DHBasicAgreement(), new KDF2BytesGenerator(new SHA1Digest()), new HMac(new SHA1Digest()), new PaddedBufferedBlockCipher(new AESEngine()))); }
public ECIESwithDESede() { super(new IESEngine(new ECDHBasicAgreement(), new KDF2BytesGenerator(new SHA1Digest()), new HMac(new SHA1Digest()), new PaddedBufferedBlockCipher(new DESedeEngine()))); }
public ECIESwithAES() { super(new IESEngine(new ECDHBasicAgreement(), new KDF2BytesGenerator(new SHA1Digest()), new HMac(new SHA1Digest()), new PaddedBufferedBlockCipher(new AESEngine()))); }
public IES() { super(new IESEngine( new DHBasicAgreement(), new KDF2BytesGenerator(new SHA1Digest()), new HMac(new SHA1Digest()))); }
public ECIES() { super(new IESEngine( new ECDHBasicAgreement(), new KDF2BytesGenerator(new SHA1Digest()), new HMac(new SHA1Digest()))); }
public ECIESwithCipher(BlockCipher cipher) { super(new IESEngine(new ECDHBasicAgreement(), new KDF2BytesGenerator(new SHA1Digest()), new HMac(new SHA1Digest()), new PaddedBufferedBlockCipher(cipher))); }
public ECIESwithCipher(BlockCipher cipher, int ivLength) { super(new IESEngine(new ECDHBasicAgreement(), new KDF2BytesGenerator(new SHA1Digest()), new HMac(new SHA1Digest()), new PaddedBufferedBlockCipher(cipher)), ivLength); }
public IESCipher(IESEngine engine) { this.engine = engine; }
public IES() { super(new IESEngine(new DHBasicAgreement(), new KDF2BytesGenerator(new SHA1Digest()), new HMac(new SHA1Digest()))); }
public ECIES() { super(new IESEngine(new ECDHBasicAgreement(), new KDF2BytesGenerator(new SHA1Digest()), new HMac(new SHA1Digest()))); }
public CipherSpi( IESEngine engine) { cipher = engine; }
public JCEIESCipher( IESEngine engine) { cipher = engine; }
public IESCipher(IESEngine engine) { this.engine = engine; this.ivLength = 0; }