コード例 #1
0
ファイル: jwe.py プロジェクト: ColtonProvias/jwcrypto
 def _jwa(self, name):
     try:
         attr = '_jwa_%s' % name.replace('-', '_').replace('+', '_')
         fn = getattr(self, attr)
     except (KeyError, AttributeError):
         raise InvalidJWAAlgorithm()
     allowed = self._allowed_algs or default_allowed_algs
     if name not in allowed:
         raise InvalidJWEOperation('Algorithm not allowed')
     return fn()
コード例 #2
0
ファイル: jws.py プロジェクト: ColtonProvias/jwcrypto
 def _jwa(self, name, allowed):
     if allowed is None:
         allowed = default_allowed_algs
     attr = '_jwa_%s' % name
     try:
         fn = getattr(self, attr)
     except (KeyError, AttributeError):
         raise InvalidJWAAlgorithm()
     if name not in allowed:
         raise InvalidJWSOperation('Algorithm not allowed')
     return fn()
コード例 #3
0
 def encryption_alg(cls, name):
     try:
         return cls.instantiate_alg(name, use='enc')
     except KeyError:
         raise InvalidJWAAlgorithm(
             '%s is not a valid Encryption algorithm name' % name)
コード例 #4
0
 def keymgmt_alg(cls, name):
     try:
         return cls.instantiate_alg(name, use='kex')
     except KeyError:
         raise InvalidJWAAlgorithm(
             '%s is not a valid Key Management algorithm name' % name)
コード例 #5
0
 def signing_alg(cls, name):
     try:
         return cls.instantiate_alg(name, use='sig')
     except KeyError:
         raise InvalidJWAAlgorithm(
             '%s is not a valid Signign algorithm name' % name)