Ejemplo n.º 1
0
        /// <summary>
        /// Generate a CRL revoke list, this is used to send to all clients that are using the certificate.
        /// </summary>
        /// <param name="caPassPhrase">The root certificate authority password.</param>
        /// <param name="revokeCertificatePath">The full path and file name where the list should be place. (extension PEM)</param>
        /// <param name="revokeListPath">The certificate revoke list (CRL) full path and file name.  (extension CRL)</param>
        public void CreateRevokationList(string caPassPhrase, string revokeCertificatePath, string revokeListPath)
        {
            if (String.IsNullOrEmpty(caPassPhrase))
            {
                throw new ArgumentNullException("caPassPhrase");
            }
            if (String.IsNullOrEmpty(revokeCertificatePath))
            {
                throw new ArgumentNullException("revokeCertificatePath");
            }
            if (String.IsNullOrEmpty(revokeListPath))
            {
                throw new ArgumentNullException("revokeListPath");
            }

            // Create a new certificate request.
            CertificateRevoke certificate = new CertificateRevoke(_openSslExecutablePath, _openSslConfigurationPath);

            certificate.RevokeCertificateList(caPassPhrase, revokeCertificatePath);
            certificate.RevokeList(revokeCertificatePath, revokeListPath);

            try
            {
                // Attempt to delete the revoke list certificate pem file.
                if (System.IO.File.Exists(revokeCertificatePath))
                {
                    System.IO.File.Delete(revokeCertificatePath);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Revoke active certificate
        /// </summary>
        /// <param name="request"></param>
        /// <param name="certificateId"></param>
        /// <returns></returns>
        public async Task RevokeActiveCertificate(CertificateRevoke request, string certificateId)
        {
            CheckRequestValid(request);
            var client   = GetBaseHttpClient();
            var response = await client.PostAsync($"certificates/{certificateId}/revoke", JsonConvert.SerializeObject(request, JsonSettings));

            await CheckResponseMessageIsValid(response);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Revoke active certificate
        /// </summary>
        /// <param name="request"></param>
        /// <param name="certificateId"></param>
        /// <returns></returns>
        public async Task RevokeActiveCertificate(CertificateRevoke request, string certificateId)
        {
            CheckRequestValid(request);
            var client   = GetBaseHttpClient();
            var response = await client.PostAsync($"certificates/{certificateId}/revoke", request);

            await CheckResponseMessageIsValid(response);

            return;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Update the certificate database.
        /// </summary>
        /// <param name="caPassPhrase">The root certificate authority password.</param>
        /// <returns>True if no error has been found else false.</returns>
        public void UpdateDatabaseCertificate(string caPassPhrase)
        {
            if (String.IsNullOrEmpty(caPassPhrase))
            {
                throw new ArgumentNullException("caPassPhrase");
            }

            // Create a new certificate request.
            CertificateRevoke certificate = new CertificateRevoke(
                Nequeo.Security.OpenSsl.Properties.Settings.Default.OpenSSLExecutable,
                Nequeo.Security.OpenSsl.Properties.Settings.Default.OpenSSLConfiguration);

            // Create the new certificate.
            certificate.UpdateDatabase(caPassPhrase);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Generate a CRL revoke list, this is used to send to all clients that are using the certificate.
        /// </summary>
        /// <param name="revokeCertificatePath">The full path and file name where the list should be place. (extension PEM)</param>
        /// <param name="revokeListPath">The certificate revoke list (CRL) full path and file name.  (extension CRL)</param>
        /// <returns>True if no error has been found else false.</returns>
        public void RevokeListCertificate(string revokeCertificatePath, string revokeListPath)
        {
            if (String.IsNullOrEmpty(revokeListPath))
            {
                throw new ArgumentNullException("revokeListPath");
            }
            if (String.IsNullOrEmpty(revokeCertificatePath))
            {
                throw new ArgumentNullException("revokeCertificatePath");
            }

            // Create a new certificate request.
            CertificateRevoke certificate = new CertificateRevoke(
                Nequeo.Security.OpenSsl.Properties.Settings.Default.OpenSSLExecutable,
                Nequeo.Security.OpenSsl.Properties.Settings.Default.OpenSSLConfiguration);

            // Create the new certificate.
            certificate.RevokeList(revokeCertificatePath, revokeListPath);
        }
        /// <summary>
        /// Generate a CRL certificate revoke.
        /// </summary>
        /// <param name="caPassPhrase">The root certificate authority password.</param>
        /// <param name="revokeCertificatePath">The full path and file name where the list should be place. (extension PEM)</param>
        /// <returns>True if no error has been found else false.</returns>
        public void RevokeCertificateList(string caPassPhrase, string revokeCertificatePath)
        {
            if (String.IsNullOrEmpty(caPassPhrase))
            {
                throw new ArgumentNullException("caPassPhrase");
            }
            if (String.IsNullOrEmpty(revokeCertificatePath))
            {
                throw new ArgumentNullException("revokeCertificatePath");
            }

            // Create a new certificate request.
            CertificateRevoke certificate = new CertificateRevoke(
                Nequeo.Cryptography.Openssl.Properties.Settings.Default.OpenSSLExecutable,
                Nequeo.Cryptography.Openssl.Properties.Settings.Default.OpenSSLConfiguration);

            // Create the new certificate.
            certificate.RevokeCertificateList(caPassPhrase, revokeCertificatePath);
        }