这是indexloc提供的服务,不要输入任何密码
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.

Add range checks to decrypt_int and decrypt_int_fast #235

@myheroyuki

Description

@myheroyuki

According to RFC 8017: PKCS#1 v2.2, all cryptographic primitives should be performing range checks on their inputs. Specifically, section 5.1.2. says for RSADP

If the ciphertext representative c is not between 0 and n - 1, output "ciphertext representative out of range" and stop

and section 5.2.1. says for RSASP1

If the message representative m is not between 0 and n - 1, output "message representative out of range" and stop.

These two functions are the same and correspond to decrypt_int/decrypt_int_fast in Python-RSA. These functions should be updated since they do not have the necessary range checks. This would result in a minor API change because the user would have to consider handling new possible exceptions.

See #234 for more context.

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