< Summary

Information
Class: Renci.SshNet.Security.Cryptography.Ciphers.CipherMode
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\Cryptography\Ciphers\CipherMode.cs
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 75
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)100%1100%
Init(...)100%1100%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\Cryptography\Ciphers\CipherMode.cs

#LineLine coverage
 1using Renci.SshNet.Common;
 2
 3namespace Renci.SshNet.Security.Cryptography.Ciphers
 4{
 5    /// <summary>
 6    /// Base class for cipher mode implementations.
 7    /// </summary>
 8    public abstract class CipherMode
 9    {
 10#pragma warning disable SA1401 // Fields should be private
 11#pragma warning disable SA1306 // Field names should begin with lower-case letter
 12        /// <summary>
 13        /// Gets the cipher.
 14        /// </summary>
 15        protected BlockCipher Cipher;
 16
 17        /// <summary>
 18        /// Gets the IV vector.
 19        /// </summary>
 20        protected byte[] IV;
 21
 22        /// <summary>
 23        /// Holds block size of the cipher.
 24        /// </summary>
 25        protected int _blockSize;
 26#pragma warning restore SA1306 // Field names should begin with lower-case letter
 27#pragma warning restore SA1401 // Fields should be private
 28
 29        /// <summary>
 30        /// Initializes a new instance of the <see cref="CipherMode"/> class.
 31        /// </summary>
 32        /// <param name="iv">The iv.</param>
 11533        protected CipherMode(byte[] iv)
 11534        {
 11535            IV = iv;
 11536        }
 37
 38        /// <summary>
 39        /// Initializes the specified cipher mode.
 40        /// </summary>
 41        /// <param name="cipher">The cipher.</param>
 42        internal void Init(BlockCipher cipher)
 11543        {
 11544            Cipher = cipher;
 11545            _blockSize = cipher.BlockSize;
 11546            IV = IV.Take(_blockSize);
 11547        }
 48
 49        /// <summary>
 50        /// Encrypts the specified region of the input byte array and copies the encrypted data to the specified region 
 51        /// </summary>
 52        /// <param name="inputBuffer">The input data to encrypt.</param>
 53        /// <param name="inputOffset">The offset into the input byte array from which to begin using data.</param>
 54        /// <param name="inputCount">The number of bytes in the input byte array to use as data.</param>
 55        /// <param name="outputBuffer">The output to which to write encrypted data.</param>
 56        /// <param name="outputOffset">The offset into the output byte array from which to begin writing data.</param>
 57        /// <returns>
 58        /// The number of bytes encrypted.
 59        /// </returns>
 60        public abstract int EncryptBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int o
 61
 62        /// <summary>
 63        /// Decrypts the specified region of the input byte array and copies the decrypted data to the specified region 
 64        /// </summary>
 65        /// <param name="inputBuffer">The input data to decrypt.</param>
 66        /// <param name="inputOffset">The offset into the input byte array from which to begin using data.</param>
 67        /// <param name="inputCount">The number of bytes in the input byte array to use as data.</param>
 68        /// <param name="outputBuffer">The output to which to write decrypted data.</param>
 69        /// <param name="outputOffset">The offset into the output byte array from which to begin writing data.</param>
 70        /// <returns>
 71        /// The number of bytes decrypted.
 72        /// </returns>
 73        public abstract int DecryptBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int o
 74    }
 75}