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 ?
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):
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