def setUp(self): self.privkey_pem = load_testdata('rsa_privkey.pem') self.inst_priv = jwk_from_pem(self.privkey_pem) self.pubkey_pem = load_testdata('rsa_pubkey.pem') self.inst_pub = jwk_from_pem(self.pubkey_pem) self.privkey_json = json.loads(load_testdata('rsa_privkey.json', 'r')) self.privkey_full_json = json.loads( load_testdata('rsa_privkey_full.json', 'r')) self.pubkey_json = json.loads(load_testdata('rsa_pubkey.json', 'r'))
def test_jwk_from_pem_not_deserializable(): with raises(UnsupportedKeyTypeError): jwk_from_pem(b'')
def test_jwk_from_unsupported_pem(): with raises(UnsupportedKeyTypeError): jwk_from_pem(load_testdata('dsa_privkey.pem'))
def test_jwk_from_pem(): jwk_priv = jwk_from_pem(load_testdata('rsa_privkey.pem')) assert isinstance(jwk_priv, RSAJWK) assert isinstance(jwk_priv.keyobj, RSAPrivateKey)