/// <summary>
		/// Initializes a new instance of the RijndaelUnmanagedTransform class.
		/// </summary>
		/// <param name="algorithm">One of the <see cref="CryptoAlgorithm"/> values.</param>
		/// <param name="method">One of the <see cref="CryptoMethod"/> values.</param>
		/// <param name="key">The key to use.</param>
		/// <param name="iv">The IV to use.</param>
		/// <param name="mode">One of the <see cref="CipherMode"/> values.</param>
		/// <param name="feedback">The feedback size of the cryptographic operation in bits.</param>
		/// <param name="padding">One of the <see cref="PaddingMode"/> values.</param>
        /// <exception cref="CryptographicException">An error occurs when acquiring the cryptographic context.</exception>
        public RijndaelUnmanagedTransform(CryptoAlgorithm algorithm, CryptoMethod method, byte[] key, byte[] iv, CipherMode mode, int feedback, PaddingMode padding) {
			m_Key = new SymmetricKey(algorithm, key);
			m_Key.IV = iv;
			m_Key.Mode = mode;
			if (mode == CipherMode.CFB)
				m_Key.FeedbackSize = feedback;
			m_Key.Padding = padding;
			m_BlockSize = 128;
			m_Method = method;
		}
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the RijndaelUnmanagedTransform class.
 /// </summary>
 /// <param name="algorithm">One of the <see cref="CryptoAlgorithm"/> values.</param>
 /// <param name="method">One of the <see cref="CryptoMethod"/> values.</param>
 /// <param name="key">The key to use.</param>
 /// <param name="iv">The IV to use.</param>
 /// <param name="mode">One of the <see cref="CipherMode"/> values.</param>
 /// <param name="feedback">The feedback size of the cryptographic operation in bits.</param>
 /// <param name="padding">One of the <see cref="PaddingMode"/> values.</param>
 /// <exception cref="CryptographicException">An error occurs when acquiring the cryptographic context.</exception>
 public RijndaelUnmanagedTransform(CryptoAlgorithm algorithm, CryptoMethod method, byte[] key, byte[] iv, CipherMode mode, int feedback, PaddingMode padding)
 {
     m_Key      = new SymmetricKey(algorithm, key);
     m_Key.IV   = iv;
     m_Key.Mode = mode;
     if (mode == CipherMode.CFB)
     {
         m_Key.FeedbackSize = feedback;
     }
     m_Key.Padding = padding;
     m_BlockSize   = 128;
     m_Method      = method;
 }
 /// <summary>
 /// Releases all unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     if (m_Key != null) {
         m_Key.Dispose();
         m_Key = null;
     }
     GC.SuppressFinalize(this);
 }
Esempio n. 4
0
		/// <summary>
		/// Initializes a new instance of the <see cref="RC4UnmanagedTransform"/> class.
		/// </summary>
		/// <param name="key">The key used to initialize the RC4 state.</param>
		public RC4UnmanagedTransform(byte[] key) {
			m_Key = new SymmetricKey(CryptoAlgorithm.RC4, key);
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="RC4UnmanagedTransform"/> class.
 /// </summary>
 /// <param name="key">The key used to initialize the RC4 state.</param>
 public RC4UnmanagedTransform(byte[] key)
 {
     m_Key = new SymmetricKey(CryptoAlgorithm.RC4, key);
 }