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

jpgpj cannot detect unencrypted data #18

Closed
nooota opened this issue Aug 20, 2018 · 1 comment
Closed

jpgpj cannot detect unencrypted data #18

nooota opened this issue Aug 20, 2018 · 1 comment

Comments

@nooota
Copy link

nooota commented Aug 20, 2018

Hello,

I'm using jpgpj to decrypt file. My program received an unencrypted file and tried to decrypt it.
I expected an exception will be thrown. But I got a empty file with no exception. Please help me.

the data in the file is
H000001018

Regards

justinludwig added a commit that referenced this issue Feb 21, 2019
Add a simple file-detection utility function to scan the first few bytes
of an input stream, and check if it looks like either:

* a pgp binary file
* an ascii-armor file
* or a gpg keybox file

When decrypting, if this utility determines the input stream is not a
pgp binary file or an ascii-armor file, decryption will fail by raising
a `PGPException` with a message "not a pgp message".
@justinludwig
Copy link
Owner

Sorry for taking so long to respond -- the latest version of JPGPJ (0.6.1) should do a better job of checking if a file is encrypted before trying to decrypt it. If the file is clearly not a PGP-encrypted file, JPGPJ will now raise a org.bouncycastle.openpgpg.PGPException (with a message "not a pgp message").

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

2 participants