kdfParam = new MGFParameters(VZ); } else { kdfParam = new KDFParameters(VZ, param.getDerivationV());
K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; byte[] P2 = param.getEncodingV();
null); IESParameters p = new IESParameters(null, null, KEY_SIZE); ParametersWithIV parametersWithIV = new ParametersWithIV(p, new byte[0]);
KDFParameters kParam = new KDFParameters(z, param.getDerivationV()); int c_text_length = 0; int macKeySize = param.getMacKeySize(); byte[] macIV = param.getEncodingV();
KDFParameters kParam = new KDFParameters(z, param.getDerivationV()); int macKeySize = param.getMacKeySize(); byte[] macIV = param.getEncodingV();
if (inLen <= (param.getMacKeySize() / 8)) K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; byte[] P2 = param.getEncodingV();
/** * Encryption equivalent to the Crypto++ default ECIES<ECP> settings: * * DL_KeyAgreementAlgorithm: DL_KeyAgreementAlgorithm_DH<struct ECPPoint,struct EnumToType<enum CofactorMultiplicationOption,0> > * DL_KeyDerivationAlgorithm: DL_KeyDerivationAlgorithm_P1363<struct ECPPoint,0,class P1363_KDF2<class SHA1> > * DL_SymmetricEncryptionAlgorithm: DL_EncryptionAlgorithm_Xor<class HMAC<class SHA1>,0> * DL_PrivateKey: DL_Key<ECPPoint> * DL_PrivateKey_EC<class ECP> * * Used for Whisper V3 */ public static byte[] decryptSimple(BigInteger privKey, byte[] cipher) throws IOException, InvalidCipherTextException { EthereumIESEngine iesEngine = new EthereumIESEngine( new ECDHBasicAgreement(), new MGF1BytesGeneratorExt(new SHA1Digest(), 1), new HMac(new SHA1Digest()), new SHA1Digest(), null); IESParameters p = new IESParameters(null, null, KEY_SIZE); ParametersWithIV parametersWithIV = new ParametersWithIV(p, new byte[0]); iesEngine.setHashMacKey(false); iesEngine.init(new ECPrivateKeyParameters(privKey, CURVE), parametersWithIV, new ECIESPublicKeyParser(ECKey.CURVE)); return iesEngine.processBlock(cipher, 0, cipher.length); }
kdfParam = new MGFParameters(VZ); } else { kdfParam = new KDFParameters(VZ, param.getDerivationV());
K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; byte[] P2 = param.getEncodingV(); byte[] L2 = null; if (V.length != 0)
IESParameters p = new IESParameters(engineParams.getDerivationV(), engineParams.getEncodingV(), engineParams.getMacKeySize());
KDFParameters kdfParam = new KDFParameters(Z, param.getDerivationV()); kdf.init(kdfParam);
K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; byte[] P2 = param.getEncodingV();
/** * Encryption equivalent to the Crypto++ default ECIES<ECP> settings: * * DL_KeyAgreementAlgorithm: DL_KeyAgreementAlgorithm_DH<struct ECPPoint,struct EnumToType<enum CofactorMultiplicationOption,0> > * DL_KeyDerivationAlgorithm: DL_KeyDerivationAlgorithm_P1363<struct ECPPoint,0,class P1363_KDF2<class SHA1> > * DL_SymmetricEncryptionAlgorithm: DL_EncryptionAlgorithm_Xor<class HMAC<class SHA1>,0> * DL_PrivateKey: DL_Key<ECPPoint> * DL_PrivateKey_EC<class ECP> * * Used for Whisper V3 */ public static byte[] decryptSimple(BigInteger privKey, byte[] cipher) throws IOException, InvalidCipherTextException { EthereumIESEngine iesEngine = new EthereumIESEngine( new ECDHBasicAgreement(), new MGF1BytesGeneratorExt(new SHA1Digest(), 1), new HMac(new SHA1Digest()), new SHA1Digest(), null); IESParameters p = new IESParameters(null, null, KEY_SIZE); ParametersWithIV parametersWithIV = new ParametersWithIV(p, new byte[0]); iesEngine.setHashMacKey(false); iesEngine.init(new ECPrivateKeyParameters(privKey, CURVE), parametersWithIV, new ECIESPublicKeyParser(ECKey.CURVE)); return iesEngine.processBlock(cipher, 0, cipher.length); }
kdfParam = new MGFParameters(VZ); } else { kdfParam = new KDFParameters(VZ, param.getDerivationV());
K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; byte[] P2 = param.getEncodingV();
/** * Encryption equivalent to the Crypto++ default ECIES<ECP> settings: * <p> * DL_KeyAgreementAlgorithm: DL_KeyAgreementAlgorithm_DH<struct ECPPoint,struct EnumToType<enum CofactorMultiplicationOption,0> > * DL_KeyDerivationAlgorithm: DL_KeyDerivationAlgorithm_P1363<struct ECPPoint,0,class P1363_KDF2<class SHA1> > * DL_SymmetricEncryptionAlgorithm: DL_EncryptionAlgorithm_Xor<class HMAC<class SHA1>,0> * DL_PrivateKey: DL_Key<ECPPoint> * DL_PrivateKey_EC<class ECP> * <p> * Used for Whisper V3 */ public static byte[] decryptSimple(BigInteger privKey, byte[] cipher) throws InvalidCipherTextException { EthereumIESEngine iesEngine = new EthereumIESEngine( new ECDHBasicAgreement(), new MGF1BytesGeneratorExt(new SHA1Digest(), 1), new HMac(new SHA1Digest()), new SHA1Digest(), null); IESParameters p = new IESParameters(null, null, KEY_SIZE); ParametersWithIV parametersWithIV = new ParametersWithIV(p, new byte[0]); iesEngine.setHashMacKey(false); iesEngine.init(new ECPrivateKeyParameters(privKey, CURVE), parametersWithIV, new ECIESPublicKeyParser(ECKey.CURVE)); return iesEngine.processBlock(cipher, 0, cipher.length); }
K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; byte[] P2 = param.getEncodingV(); byte[] L2 = null; if (V.length != 0)
null); IESParameters p = new IESParameters(null, null, KEY_SIZE); ParametersWithIV parametersWithIV = new ParametersWithIV(p, new byte[0]);
if (inLen <= (param.getMacKeySize() / 8)) { throw new InvalidCipherTextException("Length of input must be greater than the MAC"); K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; K2 = new byte[param.getMacKeySize() / 8]; K = new byte[K1.length + K2.length]; byte[] P2 = param.getEncodingV();
null); IESParameters p = new IESParameters(null, null, KEY_SIZE); ParametersWithIV parametersWithIV = new ParametersWithIV(p, new byte[0]);