/// <summary>
 /// Creates the decryptor object based on <paramref name="keyIv" />.
 /// </summary>
 /// <param name="keyIv">The encryption key IV.</param>
 /// <returns>Decryptor object.</returns>
 public ICryptoTransform CreateDecryptor(EncryptionKeyIv keyIv)
 {
     return(Algorithm.CreateDecryptor(keyIv.Key, keyIv.Iv));
 }
Exemple #2
0
 protected EncryptionService CreateSut(IEncryptionAlgorithm algorithm, EncryptionKeyIv key)
 {
     return(new EncryptionService(algorithm, key));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:ByteDev.Crypto.Encryption.EncryptionService" /> class.
 /// </summary>
 /// <param name="encryptionAlgorithm">Encryption algorithm to use when encrypting and decrypting.</param>
 /// <param name="keyIv">The key and initialization vector to use when encrypting and decrypting.</param>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="encryptionAlgorithm" /> is null.</exception>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="keyIv" /> is null.</exception>
 public EncryptionService(IEncryptionAlgorithm encryptionAlgorithm, EncryptionKeyIv keyIv)
 {
     _encryptionAlgorithm = encryptionAlgorithm ?? throw new ArgumentNullException(nameof(encryptionAlgorithm));
     _keyIv          = keyIv ?? throw new ArgumentNullException(nameof(keyIv));
     _encoderFactory = new EncoderFactory();
 }