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

Decrypt empty files #88

Merged
merged 4 commits into from
Oct 25, 2023
Merged

Conversation

lyytinen
Copy link
Contributor

Describe the pull request:

  • Bug fix
  • Functional change
  • New feature
  • Unit/integration tests
  • Code cleanup
  • Build system change
  • Documentation change

Pull request long description:

Given an empty file empty.txt, the following succeeds with the command-line utility:

crypt4gh.exe encrypt -f empty.txt -p reader.pub.pem -s writer.sec.pem
crypt4gh.exe decrypt -f empty.txt.c4gh -s reader.sec.pem

However, the Crypt4GHInputStream throws an exception when attempting to process empty.txt.c4gh.

Related issues:

Additional information:

@lyytinen
Copy link
Contributor Author

To clarify, here I was using the go implementation. It appears that other implementations can have different behavior so need to check those as well. Not sure if the standard leaves room for interpretation when dealing with empty content.

@lyytinen
Copy link
Contributor Author

Addressed additional issues revealed when attempting to decrypt empty content created by the crypt4gh python module (or the GUI wrapper to be more specific).

Attempting to decrypt empty.go.txt.c4gh causes Crypt4GHInputStream to throw an ArrayIndexOutOfBoundsException.
Attempting to decrypt empty.python.txt.c4gh causes Crypt4GHInputStream to throw a NullPointerException.

This pull request now addresses both of these issues. In the end, I'm not sure if the implementations actually are different or if the difference can be explained by the fact that with the Go implementation I used the Crypt4GH keys and with Python I used the OpenSSL keys.

In anycase, accepting this change would solve a very concrete problem for me. I'm transferring millions of encrypted files between research environments and the files are produced by different teams using different tooling. It is therefore important that this library is interoperable with other implementations and that also empty files can be decrypted without issues.

@kjetilkl kjetilkl self-assigned this Oct 23, 2023
@kjetilkl kjetilkl merged commit 26f43b8 into uio-bmi:master Oct 25, 2023
3 checks passed
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.

3 participants