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

session.Decrypt returning garbage characters appended in PKCS#11 Multipart Decryption with Pkcs11Interop v 4.x.x #234

Open
tankhare opened this issue Mar 2, 2024 · 0 comments

Comments

@tankhare
Copy link

tankhare commented Mar 2, 2024

Hello,

We are working on HSM integration with Client Application who is using Pkcs11Interop wrapper v4.0.0.

Almost, all operations are successful except Multi-part decryption where we are getting garbage characters at the end of original data. There is no error or exception. All HSM calls are successful. HSM logs shows data without any garbage characters. Even we tried to debug Pkcs11Interop library where the output stream object under Decrypt method (HighLevelAPI 41) is getting correct data.

But when it is being copied to MemoryStream and being written garbage characters are being added to it. We tried to investigate further and we found that after coping data to MemoryStream if we try to print the MemoryStream.ToString() value it is returning exactly the same data which is being added to the actual data. So, we are not sure whether this is an expected behavior and we are not handling this correctly or it is a known issue which has been fixed in later versions. We have tested this issue with Interop versions - v4.0.0, v4.0.0.2 v4.1.0 v4.1.1 v4.1.2 ). Any help would be appreciated.

I am attaching a document where I have tried to explain it in detail. Please let us know if we are missing something.

Thanks,
Tanmay

Pkcs11Interop_v_4.0.0_MultiPart_Decrypt_Issue.pdf

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

No branches or pull requests

1 participant