def revoke(self, cert):
        """Revoke certificate.

        :param .ComparableX509 cert: `OpenSSL.crypto.X509` wrapped in
            `.ComparableX509`

        :raises .ClientError: If revocation is unsuccessful.

        """
        response = self.net.post(messages.Revocation.url(self.new_reg_uri),
                                 messages.Revocation(certificate=cert))
        if response.status_code != http_client.OK:
            raise errors.ClientError(
                'Successful revocation must return HTTP OK status')
Exemple #2
0
    def _revoke(self, cert, rsn, url):
        """Revoke certificate.

        :param .ComparableX509 cert: `OpenSSL.crypto.X509` wrapped in
            `.ComparableX509`

        :param int rsn: Reason code for certificate revocation.

        :param str url: ACME URL to post to

        :raises .ClientError: If revocation is unsuccessful.

        """
        response = self._post(
            url, messages.Revocation(certificate=cert, reason=rsn))
        if response.status_code != http_client.OK:
            raise errors.ClientError(
                'Successful revocation must return HTTP OK status')
    def revoke(self, cert, rsn):
        """Revoke certificate.

        :param .ComparableX509 cert: `OpenSSL.crypto.X509` wrapped in
            `.ComparableX509`

        :param int rsn: Reason code for certificate revocation.

        :raises .ClientError: If revocation is unsuccessful.

        """
        response = self.net.post(self.directory[messages.Revocation],
                                 messages.Revocation(certificate=cert,
                                                     reason=rsn),
                                 content_type=None)
        if response.status_code != http_client.OK:
            raise errors.ClientError(
                'Successful revocation must return HTTP OK status')
Exemple #4
0
    async def certificate_revoke(
        self,
        certificate: "cryptography.x509.Certificate",
        reason: messages.RevocationReason = None,
    ) -> bool:
        """Revokes the given certificate.

        :param certificate: The certificate to revoke.
        :param reason: Optional reason for revocation.
        :raises:

            * :class:`aiohttp.ClientResponseError` If the certificate does not exist.
            * :class:`acme.messages.Error` If the revocation did not succeed.

        :return: *True* if the revocation succeeded.
        """
        cert_rev = messages.Revocation(certificate=certificate, reason=reason)
        resp, _ = await self._signed_request(cert_rev,
                                             self._directory["revokeCert"])

        return resp.status == 200
Exemple #5
0
 def test_revocation_payload(self):
     obj = messages.Revocation(certificate=self.certr.body, reason=self.rsn)
     self.assertTrue('reason' in obj.to_partial_json().keys())
     self.assertEquals(self.rsn, obj.to_partial_json()['reason'])