// Copyright (c) André N. Klingsheim. See License.txt in the project root for license information. using System; using System.Security.Cryptography.X509Certificates; using NWebsec.Core.Fluent; namespace NWebsec.Middleware { /// /// Fluent interface to configure options for Http Strict Transport Security. /// public interface IFluentHpkpOptions : IFluentInterface { /// /// Specifies the max age for the HPKP header. /// /// The number of days added to max age. /// The number of hours added to max age. /// The number of minutes added to max age. /// The number of seconds added to max age. /// The current instance. /// Thrown if a negative value was supplied in any of the parameters. IFluentHpkpOptions MaxAge(int days = 0, int hours = 0, int minutes = 0, int seconds = 0); /// /// Enables the IncludeSubdomains directive in the HPKP header. /// /// The current instance. IFluentHpkpOptions IncludeSubdomains(); /// /// Specifies a report URI where the browser can send HPKP violations. /// /// The report URI, which is an absolute URI with scheme http or https. /// The current instance. IFluentHpkpOptions ReportUri(string reportUri); /// /// Specifies that the HPKP header should also be set for HTTP responses. The header is always set for HTTPS responses. /// /// The HPKP standard specifies that the header should only be set over secure connections, which is the default behavior. /// This configuration option exists to accomodate websites running behind an SSL terminator. /// The current instance. IFluentHpkpOptions AllResponses(); /// /// Specifies one or more certificate pins to include in the HPKP header. A certificate pin is the Base64 encoded SHA-256 hash value of a certficate's SPKI. /// /// One or more certficate pin values. /// The current instance. IFluentHpkpOptions Sha256Pins(params string[] pins); /// /// Specifies a certificate that should be pinned in the HPKP header. /// /// The certificate thumbprint. /// The for the certificate. The default is . /// The for the certificate. The default is . /// The current instance. IFluentHpkpOptions PinCertificate(string thumbprint, StoreLocation storeLocation = StoreLocation.LocalMachine, StoreName storeName = StoreName.My); } }