/** * Set up the ECIES-KEM. * * @param kdf the key derivation function to be used. * @param rnd the random source for the session key. * @param cofactorMode true to use the new cofactor ECDH. * @param oldCofactorMode true to use the old cofactor ECDH. * @param singleHashMode true to use single hash mode. */ public ECIESKeyEncapsulation( DerivationFunction kdf, SecureRandom rnd, boolean cofactorMode, boolean oldCofactorMode, boolean singleHashMode) { this.kdf = kdf; this.rnd = rnd; // If both cofactorMode and oldCofactorMode are set to true // then the implementation will use the new cofactor ECDH this.CofactorMode = cofactorMode; this.OldCofactorMode = oldCofactorMode; this.SingleHashMode = singleHashMode; }
private void checkMask( int count, DerivationFunction kdf, byte[] seed, byte[] result) { byte[] data = new byte[result.length]; kdf.init(new MGFParameters(seed)); kdf.generateBytes(data, 0, data.length); if (!areEqual(result, data)) { fail("MGF1 failed generator test " + count); } }
private void checkMask( int count, DerivationFunction kdf, byte[] seed, byte[] result) { byte[] data = new byte[result.length]; kdf.init(new ISO18033KDFParameters(seed)); kdf.generateBytes(data, 0, data.length); if (!areEqual(result, data)) { fail("KDF1 failed generator test " + count); } }
private void checkMask( int count, DerivationFunction kdf, DerivationParameters params, byte[] result) { byte[] data = new byte[result.length]; kdf.init(params); kdf.generateBytes(data, 0, data.length); if (!areEqual(result, data)) { fail("DHKEKGenerator failed generator test " + count); } }
private void checkMask( int count, DerivationFunction kdf, DerivationParameters params, byte[] result) { byte[] data = new byte[result.length]; kdf.init(params); kdf.generateBytes(data, 0, data.length); if (!areEqual(result, data)) { fail("ECDHKEKGenerator failed generator test " + count); } }
private void checkMask( int count, DerivationFunction kdf, byte[] seed, byte[] result) { byte[] data = new byte[result.length]; kdf.init(new KDFParameters(seed, new byte[0])); kdf.generateBytes(data, 0, data.length); if (!areEqual(result, data)) { fail("KDF2 failed generator test " + count); } }
/** * set up for use with stream mode, where the key derivation function * is used to provide a stream of bytes to xor with the message. * * @param agree the key agreement used as the basis for the encryption * @param kdf the key derivation function used for byte generation * @param mac the message authentication code generator for the message */ public IESEngine( BasicAgreement agree, DerivationFunction kdf, Mac mac) { this.agree = agree; this.kdf = kdf; this.mac = mac; this.macBuf = new byte[mac.getMacSize()]; this.cipher = null; }
/** * set up for use in conjunction with a block cipher to handle the * message. * * @param agree the key agreement used as the basis for the encryption * @param kdf the key derivation function used for byte generation * @param mac the message authentication code generator for the message * @param cipher the cipher to used for encrypting the message */ public IESEngine( BasicAgreement agree, DerivationFunction kdf, Mac mac, BufferedBlockCipher cipher) { this.agree = agree; this.kdf = kdf; this.mac = mac; this.macBuf = new byte[mac.getMacSize()]; this.cipher = cipher; }
/** * Set up the RSA-KEM. * * @param kdf the key derivation function to be used. * @param rnd the random source for the session key. */ public RSAKeyEncapsulation( DerivationFunction kdf, SecureRandom rnd) { this.kdf = kdf; this.rnd = rnd; }
/** * Set up the ECIES-KEM. * * @param kdf the key derivation function to be used. * @param rnd the random source for the session key. */ public ECIESKeyEncapsulation( DerivationFunction kdf, SecureRandom rnd) { this.kdf = kdf; this.rnd = rnd; this.CofactorMode = false; this.OldCofactorMode = false; this.SingleHashMode = false; }
protected KeyAgreementSpi( String kaAlgorithm, BasicAgreement agreement, DerivationFunction kdf) { this.kaAlgorithm = kaAlgorithm; this.agreement = agreement; this.kdf = kdf; }
protected KeyAgreementSpi( String kaAlgorithm, BasicAgreement agreement, DerivationFunction kdf) { super(kaAlgorithm, kdf); this.kaAlgorithm = kaAlgorithm; this.agreement = agreement; }