/**
 * 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(IBasicAgreement agree, IDerivationFunction kdf, IMac mac, BufferedBlockCipher cipher)
 {
     _agree = agree;
     _kdf = kdf;
     _mac = mac;
     _macBuf = new byte[mac.GetMacSize()];
     _cipher = cipher;
 }
 /**
 * 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(IBasicAgreement agree, IDerivationFunction kdf, IMac mac)
 {
     _agree = agree;
     _kdf = kdf;
     _mac = mac;
     _macBuf = new byte[mac.GetMacSize()];
     //            this.cipher = null;
 }
        public ECDHWithKdfBasicAgreement(string algorithm, IDerivationFunction kdf)
        {
            if (algorithm == null)
                throw new ArgumentNullException("algorithm");
            if (kdf == null)
                throw new ArgumentNullException("kdf");

            _algorithm = algorithm;
            _kdf = kdf;
        }
Ejemplo n.º 4
0
		public ECDHWithKdfBasicAgreement(
			string				algorithm,
			IDerivationFunction	kdf)
		{
			if (algorithm == null)
				throw new ArgumentNullException("algorithm");
			if (!algorithms.Contains(algorithm))
				throw new ArgumentException("Unknown algorithm", "algorithm");
			if (kdf == null)
				throw new ArgumentNullException("kdf");

			this.algorithm = algorithm;
			this.kdf = kdf;
		}
        public ECDHWithKdfBasicAgreement(
            string algorithm,
            IDerivationFunction kdf)
        {
            if (algorithm == null)
            {
                throw new ArgumentNullException("algorithm");
            }
            if (kdf == null)
            {
                throw new ArgumentNullException("kdf");
            }

            this.algorithm = algorithm;
            this.kdf       = kdf;
        }
Ejemplo n.º 6
0
        private void checkMask(
            int count,
            IDerivationFunction 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);
            }
        }
Ejemplo n.º 7
0
		private void checkMask(
			int					count,
			IDerivationFunction	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);
			}
		}
Ejemplo n.º 8
0
		private void CheckMask(
			int						count,
			IDerivationFunction		kdf,
			IDerivationParameters	parameters,
			byte[]					result)
		{
			byte[] data = new byte[result.Length];

			kdf.Init(parameters);

			kdf.GenerateBytes(data, 0, data.Length);

			if (!AreEqual(result, data))
			{
				Fail("ECDHKekGenerator failed generator test " + count);
			}
		}
        private void CheckMask(
            int count,
            IDerivationFunction kdf,
            IDerivationParameters parameters,
            byte[]                                  result)
        {
            byte[] data = new byte[result.Length];

            kdf.Init(parameters);

            kdf.GenerateBytes(data, 0, data.Length);

            if (!AreEqual(result, data))
            {
                Fail("ECDHKekGenerator failed generator test " + count);
            }
        }
Ejemplo n.º 10
0
 public ECDHKekGenerator(IDigest digest)
 {
     this.kdf = new Kdf2BytesGenerator(digest);
 }
Ejemplo n.º 11
0
 internal AgreementKdfCalculator(AgreementKdfParameters parameters, IDerivationFunction derivationFunction)
 {
     this.parameters         = parameters;
     this.derivationFunction = derivationFunction;
 }
 public EcdhKekGenerator(IDigest digest)
 {
     _kdf = new Kdf2BytesGenerator(digest);
 }
Ejemplo n.º 13
0
 public ECDHKekGenerator(IDigest digest)
 {
     this.kdf = new Kdf2BytesGenerator(digest);
 }
Ejemplo n.º 14
0
 public EcdhKekGenerator(IDigest digest)
 {
     _kdf = new Kdf2BytesGenerator(digest);
 }
Ejemplo n.º 15
0
 public PascalCoinIesEngine(IBasicAgreement agree, IDerivationFunction kdf, IMac mac, BufferedBlockCipher cipher)
     : base(agree, kdf, mac, cipher)
 {
 }
Ejemplo n.º 16
0
 public PascalCoinIesEngine(IBasicAgreement agree, IDerivationFunction kdf, IMac mac) : base(agree, kdf, mac)
 {
 }