def test_create(self):
     from letsencrypt.acme.messages import RevocationRequest
     self.assertEqual(
         self.msg,
         RevocationRequest.create(certificate=CERT,
                                  key=KEY,
                                  sig_nonce=self.sig_nonce))
class RevocationRequestTest(unittest.TestCase):
    def setUp(self):
        self.sig_nonce = '\xec\xd6\xf2oYH\xeb\x13\xd5#q\xe0\xdd\xa2\x92\xa9'

        signature = other.Signature(
            alg=jose.RS256,
            jwk=jose.JWKRSA(key=KEY.publickey()),
            sig='eJ\xfe\x12"U\x87\x8b\xbf/ ,\xdeP\xb2\xdc1\xb00\xe5\x1dB'
            '\xfch<\xc6\x9eH@!\x1c\x16\xb2\x0b_\xc4\xddP\x89\xc8\xce?'
            '\x16g\x069I\xb9\xb3\x91\xb9\x0e$3\x9f\x87\x8e\x82\xca\xc5'
            's\xd9\xd0\xe7',
            nonce=self.sig_nonce)

        from letsencrypt.acme.messages import RevocationRequest
        self.msg = RevocationRequest(certificate=CERT, signature=signature)

        self.jmsg_to = {
            'type': 'revocationRequest',
            'certificate': jose.b64encode(CERT.as_der()),
            'signature': signature,
        }
        self.jmsg_from = self.jmsg_to.copy()
        self.jmsg_from['signature'] = self.jmsg_from[
            'signature'].fully_serialize()

    def test_create(self):
        from letsencrypt.acme.messages import RevocationRequest
        self.assertEqual(
            self.msg,
            RevocationRequest.create(certificate=CERT,
                                     key=KEY,
                                     sig_nonce=self.sig_nonce))

    def test_verify(self):
        self.assertTrue(self.msg.verify())

    def test_to_json(self):
        self.assertEqual(self.msg.to_json(), self.jmsg_to)

    def test_from_json(self):
        from letsencrypt.acme.messages import RevocationRequest
        self.assertEqual(self.msg, RevocationRequest.from_json(self.jmsg_from))
Example #3
0
    def setUp(self):
        self.sig_nonce = '\xec\xd6\xf2oYH\xeb\x13\xd5#q\xe0\xdd\xa2\x92\xa9'

        signature = other.Signature(
            alg='RS256',
            jwk=jose.JWK(key=KEY.publickey()),
            sig='eJ\xfe\x12"U\x87\x8b\xbf/ ,\xdeP\xb2\xdc1\xb00\xe5\x1dB'
            '\xfch<\xc6\x9eH@!\x1c\x16\xb2\x0b_\xc4\xddP\x89\xc8\xce?'
            '\x16g\x069I\xb9\xb3\x91\xb9\x0e$3\x9f\x87\x8e\x82\xca\xc5'
            's\xd9\xd0\xe7',
            nonce=self.sig_nonce)

        from letsencrypt.acme.messages import RevocationRequest
        self.msg = RevocationRequest(certificate=CERT, signature=signature)

        self.jmsg = {
            'type': 'revocationRequest',
            'certificate': jose.b64encode(CERT.as_der()),
            'signature': signature,
        }
class RevocationRequestTest(unittest.TestCase):

    def setUp(self):
        self.sig_nonce = '\xec\xd6\xf2oYH\xeb\x13\xd5#q\xe0\xdd\xa2\x92\xa9'

        signature = other.Signature(
            alg='RS256', jwk=jose.JWK(key=KEY.publickey()),
            sig='eJ\xfe\x12"U\x87\x8b\xbf/ ,\xdeP\xb2\xdc1\xb00\xe5\x1dB'
                '\xfch<\xc6\x9eH@!\x1c\x16\xb2\x0b_\xc4\xddP\x89\xc8\xce?'
                '\x16g\x069I\xb9\xb3\x91\xb9\x0e$3\x9f\x87\x8e\x82\xca\xc5'
                's\xd9\xd0\xe7',
            nonce=self.sig_nonce)

        from letsencrypt.acme.messages import RevocationRequest
        self.msg = RevocationRequest(certificate=CERT, signature=signature)

        self.jmsg = {
            'type': 'revocationRequest',
            'certificate': jose.b64encode(CERT.as_der()),
            'signature': signature,
        }

    def test_create(self):
        from letsencrypt.acme.messages import RevocationRequest
        self.assertEqual(self.msg, RevocationRequest.create(
            certificate=CERT, key=KEY, sig_nonce=self.sig_nonce))

    def test_verify(self):
        self.assertTrue(self.msg.verify())

    def test_to_json(self):
        self.assertEqual(self.msg.to_json(), self.jmsg)

    def test_from_json(self):
        self.jmsg['signature'] = self.jmsg['signature'].to_json()
        self.jmsg['signature']['jwk'] = self.jmsg['signature']['jwk'].to_json()

        from letsencrypt.acme.messages import RevocationRequest
        self.assertEqual(self.msg, RevocationRequest.from_json(self.jmsg))
    def setUp(self):
        self.sig_nonce = '\xec\xd6\xf2oYH\xeb\x13\xd5#q\xe0\xdd\xa2\x92\xa9'

        signature = other.Signature(
            alg='RS256', jwk=jose.JWK(key=KEY.publickey()),
            sig='eJ\xfe\x12"U\x87\x8b\xbf/ ,\xdeP\xb2\xdc1\xb00\xe5\x1dB'
                '\xfch<\xc6\x9eH@!\x1c\x16\xb2\x0b_\xc4\xddP\x89\xc8\xce?'
                '\x16g\x069I\xb9\xb3\x91\xb9\x0e$3\x9f\x87\x8e\x82\xca\xc5'
                's\xd9\xd0\xe7',
            nonce=self.sig_nonce)

        from letsencrypt.acme.messages import RevocationRequest
        self.msg = RevocationRequest(certificate=CERT, signature=signature)

        self.jmsg = {
            'type': 'revocationRequest',
            'certificate': jose.b64encode(CERT.as_der()),
            'signature': signature,
        }
 def test_from_json(self):
     from letsencrypt.acme.messages import RevocationRequest
     self.assertEqual(self.msg, RevocationRequest.from_json(self.jmsg_from))
 def test_from_json(self):
     from letsencrypt.acme.messages import RevocationRequest
     self.assertEqual(self.msg, RevocationRequest.from_json(self.jmsg_from))
 def test_create(self):
     from letsencrypt.acme.messages import RevocationRequest
     self.assertEqual(self.msg, RevocationRequest.create(
         certificate=CERT, key=KEY, sig_nonce=self.sig_nonce))
    def test_from_json(self):
        self.jmsg['signature'] = self.jmsg['signature'].to_json()
        self.jmsg['signature']['jwk'] = self.jmsg['signature']['jwk'].to_json()

        from letsencrypt.acme.messages import RevocationRequest
        self.assertEqual(self.msg, RevocationRequest.from_json(self.jmsg))
Example #10
0
    def test_from_json(self):
        self.jmsg['signature'] = self.jmsg['signature'].to_json()
        self.jmsg['signature']['jwk'] = self.jmsg['signature']['jwk'].to_json()

        from letsencrypt.acme.messages import RevocationRequest
        self.assertEqual(self.msg, RevocationRequest.from_json(self.jmsg))