/// <summary> /// Initializes a new instance of the <see cref="CertificateSubjectPublicKeyInfoValidator"/> class. /// </summary> /// <param name="validBase64EncodedSubjectPublicKeyInfoHashes">A collection of valid base64 encoded hashes of the certificate public key information blob.</param> /// <param name="algorithm">The algorithm used to generate the hashes.</param> public CertificateSubjectPublicKeyInfoValidator([NotNull] IEnumerable <string> validBase64EncodedSubjectPublicKeyInfoHashes, SubjectPublicKeyInfoAlgorithm algorithm) { _validBase64EncodedSubjectPublicKeyInfoHashes = new HashSet <string>(validBase64EncodedSubjectPublicKeyInfoHashes); if (_validBase64EncodedSubjectPublicKeyInfoHashes.Count == 0) { throw new ArgumentOutOfRangeException("validBase64EncodedSubjectPublicKeyInfoHashes"); } if (_algorithm != SubjectPublicKeyInfoAlgorithm.Sha1 && _algorithm != SubjectPublicKeyInfoAlgorithm.Sha256) { throw new ArgumentOutOfRangeException("algorithm"); } _algorithm = algorithm; }
/// <summary> /// Initializes a new instance of the <see cref="CertificateSubjectPublicKeyInfoValidator"/> class. /// </summary> /// <param name="validBase64EncodedSubjectPublicKeyInfoHashes">A collection of valid base64 encoded hashes of the certificate public key information blob.</param> /// <param name="algorithm">The algorithm used to generate the hashes.</param> public CertificateSubjectPublicKeyInfoValidator([NotNull] IEnumerable<string> validBase64EncodedSubjectPublicKeyInfoHashes, SubjectPublicKeyInfoAlgorithm algorithm) { _validBase64EncodedSubjectPublicKeyInfoHashes = new HashSet<string>(validBase64EncodedSubjectPublicKeyInfoHashes); if (_validBase64EncodedSubjectPublicKeyInfoHashes.Count == 0) { throw new ArgumentOutOfRangeException(nameof(validBase64EncodedSubjectPublicKeyInfoHashes)); } if (_algorithm != SubjectPublicKeyInfoAlgorithm.Sha1 && _algorithm != SubjectPublicKeyInfoAlgorithm.Sha256) { throw new ArgumentOutOfRangeException(nameof(algorithm)); } _algorithm = algorithm; }
public SubjectPublicKeyInfoValidator(IEnumerable <string> validBase64EncodedSubjectPublicKeyInfoHashes, SubjectPublicKeyInfoAlgorithm algorithm) : base(validBase64EncodedSubjectPublicKeyInfoHashes, algorithm) { }