You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: circuit_setup/scripts/crescent_helper.py
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@
14
14
CIRCOM_RS256_LIMB_BITS=121
15
15
CIRCOM_ES256K_LIMB_BITS=64
16
16
CIRCOM_ES256_LIMB_BITS=43# Required by the ecdsa-p256 circuit we use
17
-
CRESCENT_CONFIG_KEYS= ['alg', 'credtype', 'reveal_all_claims', 'defer_sig_ver', 'max_jwt_len'] # fields in config.json that are for crescent configuration and do not refer to claims in the token
17
+
CRESCENT_CONFIG_KEYS= ['alg', 'credtype', 'reveal_all_claims', 'defer_sig_ver', 'max_cred_len'] # fields in config.json that are for crescent configuration and do not refer to claims in the token
18
18
CRESCENT_SUPPORTED_ALGS= ['RS256', 'ES256', 'ES256K'] # Signature algorithms used to sign JWT/mDL
19
19
20
20
@@ -191,17 +191,17 @@ def check_config(config):
191
191
if'credtype'notinconfig:
192
192
config['credtype'] ='jwt'
193
193
194
-
if'max_jwt_len'notinconfig:
195
-
config['max_jwt_len'] =2048# Maximum length of JWT, excluding the
194
+
if'max_cred_len'notinconfig:
195
+
config['max_cred_len'] =2048# Maximum length of JWT, excluding the
196
196
# signature part. The length in bytes of the header
197
197
# and payload, base64url encoded. Must be a multiple of 64.
198
198
else:
199
-
iftype(config['max_jwt_len']) !=int:
200
-
print_debug("Error: config field 'max_jwt_len' must be an integer")
199
+
iftype(config['max_cred_len']) !=int:
200
+
print_debug("Error: config field 'max_cred_len' must be an integer")
201
201
returnFalse
202
-
max_jwt_len=config['max_jwt_len']
203
-
ifmax_jwt_len%64!=0:
204
-
print_debug("Error: 'max_jwt_len' must be a multiple of 64. Found {}, try {}".format(max_jwt_len, (64- (max_jwt_len%64)) +max_jwt_len ))
202
+
max_cred_len=config['max_cred_len']
203
+
ifmax_cred_len%64!=0:
204
+
print_debug("Error: 'max_cred_len' must be a multiple of 64. Found {}, try {}".format(max_cred_len, (64- (max_cred_len%64)) +max_cred_len ))
print_debug("Error: JWT too large. Current token JSON header + payload is {} bytes ({} bytes after SHA256 padding), but maximum length supported is {} bytes.".format(len(tbs_data), msg_len_after_SHA2_padding, base64_decoded_size(config['max_jwt_len'])))
216
-
print_debug("The config file value `max_jwt_len` would have to be increased to {} bytes (currently config['max_jwt_len'] = {})".format(len(tbs_data)+64, config['max_jwt_len']))
print_debug("Error: mDL too large. Current mDL header + payload is {} bytes ({} bytes after SHA256 padding), but maximum length supported is {} bytes.".format(len(tbs_data), msg_len_after_SHA2_padding, base64_decoded_size(config['max_cred_len'])))
215
+
print_debug("The config file value `max_cred_len` would have to be increased to {} bytes (currently config['max_cred_len'] = {})".format(len(tbs_data)+64, config['max_cred_len']))
217
216
sys.exit(-1)
218
217
219
-
while (len(padded_m) <config['max_jwt_len']): # Additional zero padding for Circom program
218
+
while (len(padded_m) <config['max_cred_len']): # Additional zero padding for Circom program
let msg_len_after_sha2_padding = padded_m.len()asu64;
129
129
130
-
if msg_len_after_sha2_padding > config["max_jwt_len"].as_u64().unwrap(){
131
-
let errmsg = format!("Error: JWT too large. Current token JSON header + payload is {} bytes ({} bytes after SHA256 padding), but maximum length supported is {} bytes.\nThe config file value `max_jwt_len` would have to be increased to {} bytes (currently config['max_jwt_len'] = {})",
130
+
if msg_len_after_sha2_padding > config["max_cred_len"].as_u64().unwrap(){
131
+
let errmsg = format!("Error: JWT too large. Current token JSON header + payload is {} bytes ({} bytes after SHA256 padding), but maximum length supported is {} bytes.\nThe config file value `max_cred_len` would have to be increased to {} bytes (currently config['max_cred_len'] = {})",
0 commit comments