Skip to content

Check that integer representation of message is smaller than modulus#1252

Merged
jasonkatonica merged 1 commit into
IBM:mainfrom
KostasTsiounis:rsa_check
May 27, 2026
Merged

Check that integer representation of message is smaller than modulus#1252
jasonkatonica merged 1 commit into
IBM:mainfrom
KostasTsiounis:rsa_check

Conversation

@KostasTsiounis

Copy link
Copy Markdown
Member

In RSA cipher operations, the message is converted into an integer that needs to be smaller than the public key's modulus.

A check is added to fail early with the proper message, instead of failing during the actual operation with a not so helpful message.

An additional test to verify that behaviour is introduced as well.

Signed-off-by: Kostas Tsiounis kostas.tsiounis@ibm.com

Comment thread src/main/java/com/ibm/crypto/plus/provider/RSA.java Outdated
Comment thread src/main/java/com/ibm/crypto/plus/provider/RSA.java Outdated
Comment thread src/main/java/com/ibm/crypto/plus/provider/RSA.java
Comment thread src/test/java/ibm/jceplus/junit/base/BaseTestRSA.java Outdated
Comment thread src/main/java/com/ibm/crypto/plus/provider/RSA.java Outdated
Comment thread src/main/java/com/ibm/crypto/plus/provider/RSA.java Outdated
Comment thread src/main/java/com/ibm/crypto/plus/provider/RSA.java Outdated
In RSA cipher operations, the message is converted into an integer
that needs to be smaller than the public key's modulus.

A check is added to fail early with the proper message, instead of
failing during the actual operation with a not so helpful message.

Additional tests to verify that behaviour are introduced as well.

Signed-off-by: Kostas Tsiounis <kostas.tsiounis@ibm.com>

@jasonkatonica jasonkatonica left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JinhangZhang JinhangZhang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@taoliult taoliult left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants