Skip to content
This repository was archived by the owner on Apr 20, 2025. It is now read-only.
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

Description

@Kristofy

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,
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions