/// <summary>
        /// Creates an <see cref="Func{X509Certificate2Collection}"/> given a path and password to a .pfx certificate.
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Func <X509Certificate2Collection> GetCertificatesByPathAndPassword(PathAndPasswordOptions options)
        {
            return(() =>
            {
                if (options == null)
                {
                    throw new ArgumentNullException(nameof(options));
                }

                return new X509Certificate2Collection(new X509Certificate2(options.Path, options.Password));
            });
        }
 public CertAuthenticator(PathAndPasswordOptions options)
 {
     CertificateFunc = CertificateFactory.GetCertificatesByPathAndPassword(options);
 }