Skip to content

Commit 1188132

Browse files
committed
Add STFL private key size error msg.
Signed-off-by: Guiliano99 <guilianolehmann@live.de>
1 parent 8c3eb20 commit 1188132

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

oqs/oqs.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,13 @@ def _load_secret_key(self, data: bytes) -> None:
10351035
buf = ct.create_string_buffer(data, len(data))
10361036
rc = native().OQS_SIG_STFL_SECRET_KEY_deserialize(self._secret_key, buf, len(data), None)
10371037
if rc != OQS_SUCCESS:
1038+
if len(data) != int(self.length_secret_key):
1039+
msg = (
1040+
f"Secret key length must be {self.length_secret_key} bytes, "
1041+
f"got {len(data)} bytes"
1042+
)
1043+
raise ValueError(msg)
1044+
10381045
msg = "Secret‑key deserialization failed"
10391046
raise RuntimeError(msg)
10401047

0 commit comments

Comments
 (0)