/// <summary>
        /// Create self signed cert
        /// </summary>
        /// <param name="subject"></param>
        /// <param name="signature"></param>
        /// <returns></returns>
        internal static X509Certificate2 Create(this SignatureType signature, string subject,
                                                bool ca = false, TimeSpan?lifetime = null)
        {
            var now = DateTime.UtcNow;
            var end = now + (lifetime ?? TimeSpan.FromDays(1));

            using (var key = signature.CreateCsr(subject, ca, out var csr)) {
                return(csr.CreateSelfSigned(now, end));
            }
        }
        /// <summary>
        /// Create signed cert from issuer
        /// </summary>
        /// <param name="subject"></param>
        /// <param name="signature"></param>
        /// <returns></returns>
        internal static X509Certificate2 Create(this X509Certificate2 issuer,
                                                SignatureType signature, string subject, bool ca = false)
        {
            var sn  = Guid.NewGuid().ToByteArray();
            var now = DateTime.UtcNow;
            var end = now + ((issuer.NotAfter - now) / 2);

            using (var key = signature.CreateCsr(subject, ca, out var csr)) {
                return(csr.Create(issuer, now, end, sn).CopyWithPrivateKey(key));
            }
        }