示例#1
0
 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)
示例#2
0
 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'])
示例#3
0
 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
示例#4
0
 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)
示例#5
0
 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'])