using System; namespace Renci.SshNet.Security.Cryptography { /// /// Base class for symmetric cipher implementations. /// public abstract class SymmetricCipher : Cipher { /// /// Gets the key. /// protected byte[] Key { get; private set; } /// /// Initializes a new instance of the class. /// /// The key. /// is null. protected SymmetricCipher(byte[] key) { if (key == null) throw new ArgumentNullException("key"); Key = key; } /// /// Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array. /// /// The input data to encrypt. /// The offset into the input byte array from which to begin using data. /// The number of bytes in the input byte array to use as data. /// The output to which to write encrypted data. /// The offset into the output byte array from which to begin writing data. /// /// The number of bytes encrypted. /// public abstract int EncryptBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset); /// /// Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array. /// /// The input data to decrypt. /// The offset into the input byte array from which to begin using data. /// The number of bytes in the input byte array to use as data. /// The output to which to write decrypted data. /// The offset into the output byte array from which to begin writing data. /// /// The number of bytes decrypted. /// public abstract int DecryptBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset); } }