/// <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> public RijndaelUnmanagedTransform(CryptoAlgorithm algorithm, CryptoMethod method, byte[] key, byte[] iv, CipherMode mode, int feedback, PaddingMode padding) { m_Key = new SymmetricKey(CryptoProvider.RsaAes, 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> /// 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> public RijndaelUnmanagedTransform(CryptoAlgorithm algorithm, CryptoMethod method, byte[] key, byte[] iv, CipherMode mode, int feedback, PaddingMode padding) { m_Key = new SymmetricKey(CryptoProvider.RsaAes, 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> /// 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(CryptoProvider.RsaFull, CryptoAlgorithm.RC4, key); }
/// <summary> /// Disposes of the cryptographic parameters. /// </summary> public void Dispose() { if (m_Key != null) { m_Key.Dispose(); m_Key = null; } try { GC.SuppressFinalize(this); } catch {} }