Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ALG_RSA_NOPAD cryptographic operation for input blocks that are same size as RSA key #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mrautio
Copy link

@mrautio mrautio commented Dec 5, 2023

Fixing the issue that ALG_RSA_NOPAD cipher cryptographic operation cannot be used if input block for encryption operation is same size as the RSA key length.

https://docs.oracle.com/javacard/3.0.5/api/javacardx/crypto/Cipher.html#ALG_RSA_NOPAD specifies that input block data can have same amount of bytes as the RSA key as long as the input block is not equal or greater to RSA modulus. BouncyCastle has stricter approach then JavaCard what comes to getInputBlockSize method https://github.com/bcgit/bc-java/blob/c62e5d0aaa222dfbba2422d8249f9e28a1c64158/core/src/main/java/org/bouncycastle/crypto/engines/RSACoreEngine.java#L57 but it is capable of handling RSA input blocks that are same size as the key as long as the input block is less than RSA modulus.
@mrautio
Copy link
Author

mrautio commented Sep 9, 2024

@ph4r05 is this PR something that could be considered as part of this project?

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.

1 participant