/// <summary> /// Default constructor. /// </summary> protected virtual void Initialize() { m_notBefore = DateTime.UtcNow.AddDays(-1).Date; m_notAfter = NotBefore.AddMonths(X509Defaults.LifeTime); m_hashAlgorithmName = X509Defaults.HashAlgorithmName; m_serialNumberLength = X509Defaults.SerialNumberLengthMin; m_extensions = new X509ExtensionCollection(); }
public CertificateManager(string issuer, string certificateAuthorityName, StoreLocation location) { _myStore = new X509Store(StoreName.My, location); _rootStore = new X509Store(StoreName.Root, location); _certificateCache = new Dictionary <string, X509Certificate2>(); NotBefore = DateTime.Now; NotAfter = NotBefore.AddMonths(1); Issuer = issuer; CertificateAuthorityName = certificateAuthorityName; }
private CertificateBuilder(X509Certificate2 issuer, bool certificateAuthority, int pathLenConstraint = 0) : base(issuer) { // Initialize key strength KeyStrength = certificateAuthority ? DefaultCertificateAuthorityKeyStrength : DefaultCertificateKeyStrength; // Initialize serial number; can be changed. SerialNumber = BigInteger.ProbablePrime(120, SecureRandom); // Decide what kind of certificate will be issued. BasicConstraints = certificateAuthority ? new BasicConstraints(pathLenConstraint) : new BasicConstraints(false); // Validity period. NotBefore = DateTime.UtcNow; NotAfter = NotBefore.AddMonths(DefaultValidityPeriodInMonths); // Certificate policies; see DirectTrustCertificatePolicies Policies = new List <string>(); }
public WindowsCertificateEngine() { NotBefore = DateTime.Now; NotAfter = NotBefore.AddMonths(1); }