def _check_key(self, key): if not isinstance(key, JWK): raise ValueError('key is not a JWK object') if key.key_type not in ['EC', 'OKP']: raise InvalidJWEKeyType('EC or OKP', key.key_type) if key.key_type == 'OKP': if key.key_curve not in ['X25519', 'X448']: raise InvalidJWEKeyType('X25519 or X448', key.key_curve)
def _check_key(self, key): if not isinstance(key, JWK): raise ValueError('key is not a JWK object') if key['kty'] not in ['EC', 'OKP']: raise InvalidJWEKeyType('EC or OKP', key['kty']) if key['kty'] == 'OKP': if key['crv'] not in ['X25519', 'X448']: raise InvalidJWEKeyType('X25519 or X448', key['crv'])
def _get_key(self, key, op): if not isinstance(key, JWK): raise ValueError('key is not a JWK object') if key.key_type != 'oct': raise InvalidJWEKeyType('oct', key.key_type) rk = base64url_decode(key.get_op_key(op)) if _bitsize(rk) != self.keysize: raise InvalidJWEKeyLength(self.keysize, _bitsize(rk)) return rk
def _check_key(self, key): if not isinstance(key, JWK): raise ValueError('key is not a JWK object') if key.key_type != 'oct': raise InvalidJWEKeyType('oct', key.key_type)
def _check_key(self, key): if not isinstance(key, JWK): raise ValueError('key is not a JWK object') if key['kty'] != 'RSA': raise InvalidJWEKeyType('RSA', key['kty'])