Пример #1
0
        public void RevokeCertificate(
            string id,
            string issuerId,
            string crlReason,
            DateTimeOffset?compromiseTime)
        {
            Console.Write($"Revoking certificate {id}...");

            var context = new RevokeCertificateContext(
                id,
                issuerId,
                crlReason,
                compromiseTime,
                this);

            RevokeCertificate(context);

            Console.WriteLine(" done.");
        }
Пример #2
0
        private void RevokeCertificate(RevokeCertificateContext context)
        {
            if (context.CrlReason == RevocationReason.CaCompromise)
            {
                var arguments = new List <string>
                {
                    "ca",
                    "-revoke", context.CertificatePemFilePath,
                    "-crl_CA_compromise", FormatDate(context.CompromiseTime.Value),
                    "-config", context.ConfigFilePath,
                };

                Execute(context, arguments.ToArray());
            }
            else if (context.CrlReason == RevocationReason.KeyCompromise)
            {
                var arguments = new List <string>
                {
                    "ca",
                    "-revoke", context.CertificatePemFilePath,
                    "-crl_compromise", FormatDate(context.CompromiseTime.Value),
                    "-config", context.ConfigFilePath,
                };

                Execute(context, arguments.ToArray());
            }
            else
            {
                var arguments = new List <string>
                {
                    "ca",
                    "-revoke", context.CertificatePemFilePath,
                    "-crl_reason", context.CrlReason,
                    "-config", context.ConfigFilePath,
                };

                Execute(context, arguments.ToArray());
            }
        }