Skip to content

Commit

Permalink
Should use default if no enc_alg is defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
rohe committed Sep 20, 2016
1 parent 8de6732 commit b050cd9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/oic/oic/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,10 +825,17 @@ def encrypt(self, payload, client_info, cid, val_type="id_token", cty=""):

try:
alg = client_info["%s_encrypted_response_alg" % val_type]
enc = client_info["%s_encrypted_response_enc" % val_type]
except KeyError as err: # both must be defined
logger.warning("undefined parameter: %s" % err)
raise JWEException("%s undefined" % err)
except KeyError:
logger.warning('{} NOT defined means no encryption').format(
val_type)
return payload
else:
try:
enc = client_info["%s_encrypted_response_enc" % val_type]
except KeyError as err: # if not defined-> A128CBC-HS256 (default)
logger.warning("undefined parameter: %s" % err)
logger.info("using default")
enc = 'A128CBC-HS256'

logger.debug("alg=%s, enc=%s, val_type=%s" % (alg, enc, val_type))
keys = self.keyjar.get_encrypt_key(owner=cid)
Expand Down

0 comments on commit b050cd9

Please sign in to comment.