GithubHelp home page GithubHelp logo

java-pgp's Introduction

java-pgp's People

Contributors

mxku avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

illiqiang

java-pgp's Issues

[Solved] Exception in thread "main" java.io.IOException: unknown PGP public key algorithm encountered

hello! thanks for making this repo. I was writing an issue because I was struggling to get the code working but as I was writing this, I finally managed to get it running on my own. It might nonetheless be useful to someone running into the same issue.

Long story short, generate the public and private keys using:

gpg --full-generate-key

then when prompted:

Please select what kind of key you want:
   (1) RSA and RSA
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
   (9) ECC (sign and encrypt) *default*
  (10) ECC (sign only)

Select 1 or 2 or 4, but do not select 3, 9, or 10. The default choice being 9, it does not work with the default.
Otherwise, you will run into this error (when using 9 or 10,):

java.io.IOException: unknown PGP public key algorithm encountered

Or this error (when using 3):

java.lang.IllegalArgumentException: Can't find public key in the key ring.

Unknown packet type encountered: 20

Getting an error at line 165. of method decryptFile()
java.io.IOException: unknown packet type encountered: 20
at org.bouncycastle.bcpg.BCPGInputStream.readPacket(Unknown Source) ~[bcpg-jdk15on-1.70.jar:1.70.00.0]
at org.bouncycastle.openpgp.PGPEncryptedDataList.(Unknown Source) ~[bcpg-jdk15on-1.70.jar:1.70.00.0]
at org.bouncycastle.openpgp.PGPObjectFactory.nextObject(Unknown Source) ~[bcpg-jdk15on-1.70.jar:1.70.00.0]

Can you provide a sample encrypted file?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.