Inheritance: IBlockCipher
Exemple #1
0
 public CfbBlockCipherMac(IBlockCipher cipher, int cfbBitSize, int macSizeInBits, IBlockCipherPadding padding)
 {
     if (macSizeInBits % 8 != 0)
     {
         throw new ArgumentException("MAC size must be multiple of 8");
     }
     this.mac     = new byte[cipher.GetBlockSize()];
     this.cipher  = new MacCFBBlockCipher(cipher, cfbBitSize);
     this.padding = padding;
     this.macSize = macSizeInBits / 8;
     this.Buffer  = new byte[this.cipher.GetBlockSize()];
     this.bufOff  = 0;
 }
 public CfbBlockCipherMac(IBlockCipher cipher, int cfbBitSize, int macSizeInBits, IBlockCipherPadding padding)
 {
     //IL_0010: Unknown result type (might be due to invalid IL or missing references)
     if (macSizeInBits % 8 != 0)
     {
         throw new ArgumentException("MAC size must be multiple of 8");
     }
     mac          = new byte[cipher.GetBlockSize()];
     this.cipher  = new MacCFBBlockCipher(cipher, cfbBitSize);
     this.padding = padding;
     macSize      = macSizeInBits / 8;
     Buffer       = new byte[this.cipher.GetBlockSize()];
     bufOff       = 0;
 }
Exemple #3
0
		/**
        * create a standard MAC based on a block cipher with the size of the
        * MAC been given in bits. This class uses CFB mode as the basis for the
        * MAC generation.
        * <p>
        * Note: the size of the MAC must be at least 24 bits (FIPS Publication 81),
        * or 16 bits if being used as a data authenticator (FIPS Publication 113),
        * and in general should be less than the size of the block cipher as it reduces
        * the chance of an exhaustive attack (see Handbook of Applied Cryptography).
        * </p>
        * @param cipher the cipher to be used as the basis of the MAC generation.
        * @param cfbBitSize the size of an output block produced by the CFB mode.
        * @param macSizeInBits the size of the MAC in bits, must be a multiple of 8.
        * @param padding a padding to be used.
        */
        public CfbBlockCipherMac(
            IBlockCipher		cipher,
            int					cfbBitSize,
            int					macSizeInBits,
            IBlockCipherPadding	padding)
        {
            if ((macSizeInBits % 8) != 0)
                throw new ArgumentException("MAC size must be multiple of 8");

			mac = new byte[cipher.GetBlockSize()];

			this.cipher = new MacCFBBlockCipher(cipher, cfbBitSize);
            this.padding = padding;
            this.macSize = macSizeInBits / 8;

			Buffer = new byte[this.cipher.GetBlockSize()];
            bufOff = 0;
        }