mxku / java-pgp Goto Github PK
View Code? Open in Web Editor NEWOpenPGP+BouncyCastle Java encryption
OpenPGP+BouncyCastle Java encryption
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.
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.