Example #1
0
 def test_can_create_public_JWK(self):
     jwk = JWK(**self.public_key)
     self.assertEqual(jwk.type, JWK.PUBLIC)
     self.assertEqual(jwk.kty, self.public_key['kty'])
     self.assertEqual(jwk.alg, self.public_key['alg'])
     self.assertEqual(jwk.n, self.public_key['n'])
     self.assertEqual(jwk.e, self.public_key['e'])
Example #2
0
 def test_can_create_private_JWK(self):
     jwk = JWK(**self.private_key)
     self.assertEqual(jwk.type, JWK.PRIVATE)
     self.assertEqual(jwk.kty, self.private_key['kty'])
     self.assertEqual(jwk.alg, self.private_key['alg'])
     self.assertEqual(jwk.n, self.private_key['n'])
     self.assertEqual(jwk.e, self.private_key['e'])
     self.assertEqual(jwk.d, self.private_key['d'])
Example #3
0
 def test_can_convert_to_RSA(self):
     jwk_public = JWK(**self.public_key)
     jwk_private = JWK(**self.private_key)
     self.assertIsInstance(jwk_public.to_rsa(), RsaKey)
     self.assertIsInstance(jwk_private.to_rsa(), RsaKey)
Example #4
0
 def test_can_convert_base64_to_int(self):
     expected = 65537
     observed = JWK.b64_to_int('AQAB')
     self.assertEqual(observed, expected)