public void Init(IDerivationParameters parameters)
    {
        if (!typeof(MgfParameters).IsInstanceOfType(parameters))
        {
            throw new ArgumentException("MGF parameters required for MGF1Generator");
        }
        MgfParameters mgfParameters = (MgfParameters)parameters;

        seed = mgfParameters.GetSeed();
    }
Esempio n. 2
0
        public void Init(IDerivationParameters parameters)
        {
            //IL_0017: Unknown result type (might be due to invalid IL or missing references)
            if (!typeof(MgfParameters).IsInstanceOfType((object)parameters))
            {
                throw new ArgumentException("MGF parameters required for MGF1Generator");
            }
            MgfParameters mgfParameters = (MgfParameters)parameters;

            seed = mgfParameters.GetSeed();
        }
Esempio n. 3
0
        public void Init(
            IDerivationParameters parameters)
        {
            if (!(parameters is MgfParameters))
            {
                throw new ArgumentException("MGF parameters required for MGF1Generator");
            }

            MgfParameters p = (MgfParameters)parameters;

            seed = p.GetSeed();
        }
Esempio n. 4
0
        public void Init(
            IDerivationParameters parameters)
        {
            if (parameters == null || !(typeof(MgfParameters).GetTypeInfo().IsAssignableFrom(parameters.GetType().GetTypeInfo())))
            {
                throw new ArgumentException("MGF parameters required for MGF1Generator");
            }

            MgfParameters p = (MgfParameters)parameters;

            seed = p.GetSeed();
        }
        public byte[] ProcessBlock(
            byte[] input,
            int inOff,
            int inLen,
            byte[] macData)
        {
            // Compute the common value and convert to byte array.
            _agreement.Init(_privParam);
            BigInteger zAsInteger = _agreement.CalculateAgreement(_pubParam);

            byte[] z = BigIntegers.AsUnsignedByteArray(_agreement.GetFieldSize(), zAsInteger);

            // Create input to KDF.
            byte[] vz;
//        if (V.Length != 0)
//        {
//            VZ = new byte[V.Length + Z.Length];
//            Array.Copy(V, 0, VZ, 0, V.Length);
//            Array.Copy(Z, 0, VZ, V.Length, Z.Length);
//        }
//        else
            {
                vz = z;
            }

            // Initialise the KDF.
            IDerivationParameters kdfParam;

            if (_kdf is Mgf1BytesGenerator)
            {
                kdfParam = new MgfParameters(vz);
            }
            else
            {
                kdfParam = new KdfParameters(vz, _iesParameters.GetDerivationV());
            }
            _kdf.Init(kdfParam);

            return(_forEncryption
                ? EncryptBlock(input, inOff, inLen, macData)
                : DecryptBlock(input, inOff, inLen, macData));
        }
Esempio n. 6
0
        public void Init(MgfParameters parameters)
        {
            MgfParameters p = parameters;

            this.seed = p.GetSeed();
        }