We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In pycose/keys/symmetric.py, there are several checks on key length which exclude keys for HS384 and HS512 algorithms.
pycose/keys/symmetric.py
if key_len not in [16, 24, 32]:
Here's how I reproduce this issue
from pycose.keys import SymmetricKey, keyops from pycose.algorithms import HMAC256, HMAC384, HMAC512 from binascii import hexlify hashes = [ ["HS256", HMAC256], ["HS384", HMAC384], ["HS512", HMAC512] ] for [name, alg] in hashes: print(f"{alg} - {alg.get_digest_length()}") key = SymmetricKey.generate_key(alg.get_digest_length()) key.kid = b"[email protected]" key.key_ops = [keyops.MacCreateOp, keyops.MacVerifyOp] key.alg = alg print(hexlify(key.encode()))
This may be corrected by updating said list to
if key_len not in [16, 24, 32, 48, 64]:
Other implementations do support this length, for example in rust: https://github.com/tramires/cose-rust/blob/main/src/algs.rs#L1006
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In
pycose/keys/symmetric.py
, there are several checks on key length which exclude keys for HS384 and HS512 algorithms.Here's how I reproduce this issue
This may be corrected by updating said list to
Other implementations do support this length, for example in rust: https://github.com/tramires/cose-rust/blob/main/src/algs.rs#L1006
The text was updated successfully, but these errors were encountered: