Skip to content
This repository was archived by the owner on Apr 20, 2025. It is now read-only.

Warning would always trigger when loading pkcs1 der #243

Open
Kristofy opened this issue Apr 9, 2025 · 0 comments · May be fixed by #244
Open

Warning would always trigger when loading pkcs1 der #243

Kristofy opened this issue Apr 9, 2025 · 0 comments · May be fixed by #244

Comments

@Kristofy
Copy link

Kristofy commented Apr 9, 2025

The result of the warning check bellow would always result in the error showing, because we are comparing a map object, and a list.

You are compering the results, with the expected ones, but the compared elements do not share the common type

rs, ds, ts are a map object, while the Private key properties are garanteed to be of type list[int]

python-rsa/rsa/key.py

Lines 601 to 615 in 63772a6

n, e, d, p, q = map(int, priv[1:6])
exp1, exp2, coef = map(int, priv[6:9])
rs = map(int, priv[9::3])
ds = map(int, priv[10::3])
ts = map(int, priv[11::3])
key = cls(n, e, d, p, q, list(rs))
if (key.exp1, key.exp2, key.coef, key.rs, key.ds, key.ts) != (exp1, exp2, coef, rs, ds, ts):
warnings.warn(
"You have provided a malformed keyfile. Either the exponents "
"or the coefficient are incorrect. Using the correct values "
"instead.",
UserWarning,
)

@Kristofy Kristofy linked a pull request Apr 9, 2025 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant