Ejemplo n.º 1
0
 /// <summary>
 /// Determines if the <paramref name="candidateSaltedPassword"/> is equal to this <see cref="ISaltedPassword"/>.
 /// </summary>
 /// <param name="candidateSaltedPassword">The <see cref="ISaltedPassword"/> to compare to this <see cref="ISaltedPassword"/>.</param>
 /// <returns><b>True</b> if the <paramref name="candidateSaltedPassword"/> is equal to this <see cref="ISaltedPassword"/>, otherwise <b>false</b>.</returns>
 public bool IsValid(ISaltedPassword candidateSaltedPassword)
 {
     if (candidateSaltedPassword == null)
     {
         return(false);
     }
     return(IsValid(candidateSaltedPassword.PasswordSaltHash));
 }
 /// <summary>
 /// Initializes a new instance of the EncryptorConfiguration.
 /// </summary>
 /// <param name="saltedPassword">The salted password required to encrypt and decrypt data.</param>
 /// <param name="symmetricAlgorithmType">The <see cref="System.Security.Cryptography.SymmetricAlgorithm"/> required to encrypt and decrypt data.</param>
 public EncryptorConfiguration(ISaltedPassword saltedPassword,
                               Type symmetricAlgorithmType)
     : this()
 {
     if (symmetricAlgorithmType == null)
     {
         throw new ArgumentNullException(nameof(symmetricAlgorithmType));
     }
     if (!typeof(System.Security.Cryptography.SymmetricAlgorithm).IsAssignableFrom(symmetricAlgorithmType))
     {
         throw new ArgumentException($"Parameter {nameof(symmetricAlgorithmType)} must be a type of System.Security.Cryptography.SymmetricAlgorithm.");
     }
     SaltedPassword         = saltedPassword ?? throw new ArgumentNullException(nameof(saltedPassword));
     SymmetricAlgorithmType = symmetricAlgorithmType;
 }