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

unable to encrypt a file with recipient as any string (example : 918A6B32) instead of email. #83

Open
npnaidu206 opened this issue Jun 21, 2024 · 1 comment

Comments

@npnaidu206
Copy link

When we use below java snippet , it works for recipient as email but does not work for any random string.
BouncyGPG
.encryptToStream()
.withConfig(keyringConfig)
.withStrongAlgorithms()
.toRecipient(recipient)
.andDoNotSign()
.armorAsciiOutput()
.andWriteTo(output)
** System (please complete the following information):**

  • OS: container as Linux
  • Java : 17

throws exception :"org.bouncycastle.openpgp.PGPException: No (suitable) public key for encryption to 918A6B32 found\n\tat name.neuhalfen.projects.crypto.bouncycastle.openpgp.BuildEncryptionOutputStreamAPI$WithAlgorithmSuiteImpl$ToImpl.extractValidKey(BuildEncryptionOutputStreamAPI.java:414)\n\tat name.neuhalfen.projects.crypto.bouncycastle.openpgp.BuildEncryptionOutputStreamAPI$WithAlgorithmSuiteImpl$ToImpl.toRecipient(BuildEncryptionOutputStreamAPI.java:431.

Where as it works for command line :
gpg --output /tmp/outputfile.txt.pgp --reciepient 918A6B32 --encrypt textfilePath

please let me know if it is issue with bouncy gpg issue ?

thanks for your help. looking forward for reply

@npnaidu206
Copy link
Author

using
name.neuhalfen.projects.crypto.bouncycastle.openpgp
bouncy-gpg
2.3.0

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