Skip to content

Commit 6de1c6c

Browse files
committed
fix: handle possible missing value error
1 parent cbf28ee commit 6de1c6c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pymdoccbor/mso/issuer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ def __init__(
101101

102102
alg_map = {"ES256": "sha256", "ES384": "sha384", "ES512": "sha512"}
103103

104-
hashfunc = getattr(hashlib, alg_map.get(self.alg))
104+
if self.alg not in alg_map:
105+
raise ValueError(f"Unsupported algorithm: {self.alg}")
106+
107+
hashfunc = getattr(hashlib, alg_map[self.alg])
105108

106109
digest_cnt = 0
107110
for ns, values in data.items():

0 commit comments

Comments
 (0)