public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV, byte[] additional)
		{
			if (rgbKey == null)
				throw new ArgumentNullException("rgbKey");
			if (rgbKey.Length != _keySize)
				throw new CryptographicException("rgbKey");
			if (rgbIV == null)
				throw new ArgumentNullException("rgbIV");
			if (rgbIV.Length != BlockSize)
				throw new CryptographicException("rgbIV");
			
			AriaBlockCipher cipher = new AriaBlockCipher(rgbKey);
			return new GenericCbcModeCryptoTransform(cipher, true, rgbIV);
		}
Exemplo n.º 2
0
        public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV, byte[] additional)
        {
            if (rgbKey == null)
            {
                throw new ArgumentNullException("rgbKey");
            }
            if (rgbKey.Length != _keySize)
            {
                throw new CryptographicException("rgbKey");
            }
            if (rgbIV == null)
            {
                throw new ArgumentNullException("rgbIV");
            }
            if (additional == null)
            {
                throw new ArgumentNullException("additional");
            }

            IGenericBlockCipher cipher = new AriaBlockCipher(rgbKey);

            return(new GenericGcmModeCryptoTransform(cipher, true, rgbIV, additional, _tagSize));
        }
        public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV, byte[] additional)
        {
            if (rgbKey == null)
            {
                throw new ArgumentNullException("rgbKey");
            }
            if (rgbKey.Length != _keySize)
            {
                throw new CryptographicException("rgbKey");
            }
            if (rgbIV == null)
            {
                throw new ArgumentNullException("rgbIV");
            }
            if (rgbIV.Length != BlockSize)
            {
                throw new CryptographicException("rgbIV");
            }

            AriaBlockCipher cipher = new AriaBlockCipher(rgbKey);

            return(new GenericCbcModeCryptoTransform(cipher, false, rgbIV));
        }
		public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV, byte[] additional)
		{
			if (rgbKey == null)
				throw new ArgumentNullException("rgbKey");
			if (rgbKey.Length != _keySize)
				throw new CryptographicException("rgbKey");
			if (rgbIV == null)
				throw new ArgumentNullException("rgbIV");
			if (additional == null)
				throw new ArgumentNullException("additional");
			
			IGenericBlockCipher cipher = new AriaBlockCipher(rgbKey);
			return new GenericGcmModeCryptoTransform(cipher, false, rgbIV, additional, _tagSize);
		}