| | | 1 | | namespace Renci.SshNet.Security.Cryptography |
| | | 2 | | { |
| | | 3 | | /// <summary> |
| | | 4 | | /// Base class for cipher implementation. |
| | | 5 | | /// </summary> |
| | | 6 | | public abstract class Cipher |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Gets the minimum data size. |
| | | 10 | | /// </summary> |
| | | 11 | | /// <value> |
| | | 12 | | /// The minimum data size. |
| | | 13 | | /// </value> |
| | | 14 | | public abstract byte MinimumSize { get; } |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Encrypts the specified input. |
| | | 18 | | /// </summary> |
| | | 19 | | /// <param name="input">The input.</param> |
| | | 20 | | /// <returns>Encrypted data.</returns> |
| | | 21 | | public byte[] Encrypt(byte[] input) |
| | 864 | 22 | | { |
| | 864 | 23 | | return Encrypt(input, 0, input.Length); |
| | 864 | 24 | | } |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Encrypts the specified input. |
| | | 28 | | /// </summary> |
| | | 29 | | /// <param name="input">The input.</param> |
| | | 30 | | /// <param name="offset">The zero-based offset in <paramref name="input"/> at which to begin encrypting.</param> |
| | | 31 | | /// <param name="length">The number of bytes to encrypt from <paramref name="input"/>.</param> |
| | | 32 | | /// <returns> |
| | | 33 | | /// The encrypted data. |
| | | 34 | | /// </returns> |
| | | 35 | | public abstract byte[] Encrypt(byte[] input, int offset, int length); |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Decrypts the specified input. |
| | | 39 | | /// </summary> |
| | | 40 | | /// <param name="input">The input.</param> |
| | | 41 | | /// <returns> |
| | | 42 | | /// The decrypted data. |
| | | 43 | | /// </returns> |
| | | 44 | | public abstract byte[] Decrypt(byte[] input); |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Decrypts the specified input. |
| | | 48 | | /// </summary> |
| | | 49 | | /// <param name="input">The input.</param> |
| | | 50 | | /// <param name="offset">The zero-based offset in <paramref name="input"/> at which to begin decrypting.</param> |
| | | 51 | | /// <param name="length">The number of bytes to decrypt from <paramref name="input"/>.</param> |
| | | 52 | | /// <returns> |
| | | 53 | | /// The decrypted data. |
| | | 54 | | /// </returns> |
| | | 55 | | public abstract byte[] Decrypt(byte[] input, int offset, int length); |
| | | 56 | | } |
| | | 57 | | } |