Skip to content

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

Open
@npnaidu206

Description

@npnaidu206

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions