All Projects → pgpainless → pgpainless

pgpainless / pgpainless

Licence: Apache-2.0 license
Simple to use OpenPGP API based on Bouncy Castle

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to pgpainless

openpgpkey-control
OpenPGP keys published on your website (WKD)
Stars: ✭ 36 (-50.68%)
Mutual labels:  pgp, gpg, openpgp
wp-pgp-encrypted-emails
🔐 📧 Encrypts WordPress emails using OpenPGP or S/MIME with a familiar API.
Stars: ✭ 35 (-52.05%)
Mutual labels:  pgp, gpg, openpgp
Bouncy Gpg
Make using Bouncy Castle with OpenPGP fun again!
Stars: ✭ 164 (+124.66%)
Mutual labels:  pgp, gpg, openpgp
Gpgsync
🔒 GPG Sync is designed to let users always have up-to-date public keys for other members of their organization
Stars: ✭ 301 (+312.33%)
Mutual labels:  pgp, gpg, openpgp
rune
tool to query for tokens and passwords for use as environment variables
Stars: ✭ 13 (-82.19%)
Mutual labels:  pgp, gpg
Cli
share secrets within teams to avoid plain-text secrets from day one
Stars: ✭ 138 (+89.04%)
Mutual labels:  pgp, gpg
Magicpad
MagicPad is an encryption suite for beginners. It is designed to be run standalone via the browser or executable (Electron).
Stars: ✭ 174 (+138.36%)
Mutual labels:  pgp, gpg
mitome.in
Explore OpenPGP and other cryptography as an alternative for seals (mitome-in)
Stars: ✭ 30 (-58.9%)
Mutual labels:  signature, openpgp
Pius
PGP Individual User Signer
Stars: ✭ 77 (+5.48%)
Mutual labels:  pgp, gpg
pgpverify-maven-plugin
Verify Open PGP / GPG signatures plugin
Stars: ✭ 42 (-42.47%)
Mutual labels:  pgp, gpg
SplitShare
Shamir's Secret Sharing Algorithm implementation in golang combined with PGP and a mail delivery system
Stars: ✭ 31 (-57.53%)
Mutual labels:  pgp, gpg
Zeyple
Postfix filter/hook to automatically encrypt outgoing emails with PGP/GPG
Stars: ✭ 122 (+67.12%)
Mutual labels:  pgp, gpg
Rnp
RNP: high performance C++ OpenPGP library, fully compliant to RFC 4880
Stars: ✭ 122 (+67.12%)
Mutual labels:  pgp, openpgp
Encrypt.to
Send encrypted PGP messages with one click
Stars: ✭ 116 (+58.9%)
Mutual labels:  pgp, openpgp
keygaen
Sign, verify, encrypt and decrypt data with PGP in your browser.
Stars: ✭ 78 (+6.85%)
Mutual labels:  pgp, gpg
paper-store
Cold store small files on paper as QR codes -- PGP keys, Bitcoin keys, Tox keys or any other small files in general.
Stars: ✭ 28 (-61.64%)
Mutual labels:  pgp, gpg
keylist-rfc
🔏 turning the system behind GPG Sync into an Internet standard
Stars: ✭ 15 (-79.45%)
Mutual labels:  pgp, gpg
Objectivepgp
OpenPGP library for iOS and macOS
Stars: ✭ 557 (+663.01%)
Mutual labels:  pgp, openpgp
Minisign
A dead simple tool to sign files and verify digital signatures.
Stars: ✭ 1,105 (+1413.7%)
Mutual labels:  pgp, gpg
ocaml-openpgp
WiP: RFC 4880 (OpenPGP) library and utilities in OCaml
Stars: ✭ 24 (-67.12%)
Mutual labels:  openpgp, rfc-4880

PGPainless - Use OpenPGP Painlessly!

Travis (.com) Maven Central Coverage Status Interoperability Test-Suite PGP REUSE status Documentation Status

PGPainless is an easy-to-use OpenPGP library for Java and Android applications

About

PGPainless aims to make using OpenPGP in Java projects as simple as possible. It does so by introducing an intuitive Builder structure, which allows easy setup of encryption/decryption operations, as well as straight forward key generation.

PGPainless is based around the Bouncy Castle java library and can be used on Android down to API level 10. It can be configured to either use the Java Cryptographic Engine (JCE), or Bouncy Castles lightweight reimplementation.

While signature verification in Bouncy Castle is limited to signature correctness, PGPainless goes much further. It also checks if signing subkeys are properly bound to their primary key, if keys are expired or revoked, as well as if keys are allowed to create signatures in the first place.

These rigorous checks make PGPainless stand out from other Java-based OpenPGP libraries and are the reason why PGPainless currently scores second place on Sequoia-PGPs Interoperability Test-Suite.

At FlowCrypt we are using PGPainless in our Kotlin code bases on Android and on server side. The ergonomics of legacy PGP tooling on Java is not very good, and PGPainless improves it greatly. We were so happy with our initial tests and with Paul - the maintainer, that we decided to sponsor further development of this library.

-Tom @ FlowCrypt.com

Finally, testing irrefutably confirmed that the library removes many associated difficulties with PGP use in its provision of an approachable and uncomplicated API. In this regard, Paul Schaub deserves the utmost praise.

-Mario @ Cure53.de

Get Started

The very easiest way to start using OpenPGP on Java/Kotlin based systems is to use an implementation of sop-java. sop-java defines a very stripped down API and is super easy to get started with. Luckily PGPainless provides an implementation for the sop-java interface definitions in the form of pgpainless-sop.

If you need more flexibility, directly using pgpainless-core is the way to go.

Features

Most of PGPainless' features can be accessed directly from the PGPainless class. If you want to get started, this class is your friend :)

For further details you should check out the javadoc!

Handle Keys

Reading keys from ASCII armored strings or from binary files is easy:

        String key = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n"...
        PGPSecretKeyRing secretKey = PGPainless.readKeyRing()
                .secretKeyRing(key);

Similarly, keys can quickly be exported::

        PGPSecretKeyRing secretKey = ...;
        String armored = PGPainless.asciiArmor(secretKey);
        ByteArrayOutputStream binary = new ByteArrayOutputStream();
        secretKey.encode(binary);

Extract a public key certificate from a secret key:

        PGPSecretKeyRing secretKey = ...;
        PGPPublicKeyRing certificate = PGPainless.extractCertificate(secretKey);

Easily Generate Keys

PGPainless comes with a simple to use KeyRingBuilder class that helps you to quickly generate modern OpenPGP keys. There are some predefined key archetypes, but it is possible to fully customize key generation to your needs.

        // RSA key without additional subkeys
        PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
                .simpleRsaKeyRing("Juliet <[email protected]>", RsaLength._4096);
                
        // EdDSA primary key with EdDSA signing- and XDH encryption subkeys
        PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
                .modernKeyRing("Romeo <[email protected]>", "I defy you, stars!");

        // Customized key
        PGPSecretKeyRing keyRing = PGPainless.buildKeyRing()
                .setPrimaryKey(KeySpec.getBuilder(
                        RSA.withLength(RsaLength._8192),
                        KeyFlag.SIGN_DATA, KeyFlag.CERTIFY_OTHER))
                .addSubkey(
                        KeySpec.getBuilder(ECDSA.fromCurve(EllipticCurve._P256), KeyFlag.SIGN_DATA)
                                .overrideCompressionAlgorithms(CompressionAlgorithm.ZLIB)
                ).addSubkey(
                        KeySpec.getBuilder(
                                        ECDH.fromCurve(EllipticCurve._P256),
                                        KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE)
                ).addUserId("Juliet <[email protected]>")
                .addUserId("xmpp:[email protected]")
                .setPassphrase(Passphrase.fromPassword("romeo_oh_Romeo<3"))
                .build();

Encrypt and Sign Data

PGPainless makes it easy and painless to encrypt and/or sign data. Passed in keys are automatically evaluated, so that you don't accidentally encrypt to revoked or expired keys. PGPainless will furthermore detect which algorithms are supported by recipient keys and will negotiate algorithms accordingly. Still it allows you to manually specify which algorithms to use of course.

        EncryptionStream encryptionStream = PGPainless.encryptAndOrSign()
                .onOutputStream(outputStream)
                .withOptions(
                        ProducerOptions.signAndEncrypt(
                                new EncryptionOptions()
                                        .addRecipient(aliceKey)
                                        .addRecipient(bobsKey)
                                        // optionally encrypt to a passphrase
                                        .addPassphrase(Passphrase.fromPassword("password123"))
                                        // optionally override symmetric encryption algorithm
                                        .overrideEncryptionAlgorithm(SymmetricKeyAlgorithm.AES_192),
                                new SigningOptions()
                                        // Sign in-line (using one-pass-signature packet)
                                        .addInlineSignature(secretKeyDecryptor, aliceSecKey, signatureType)
                                        // Sign using a detached signature
                                        .addDetachedSignature(secretKeyDecryptor, aliceSecKey, signatureType)
                                        // optionally override hash algorithm
                                        .overrideHashAlgorithm(HashAlgorithm.SHA256)
                        ).setAsciiArmor(true) // Ascii armor or not
                );

        Streams.pipeAll(plaintextInputStream, encryptionStream);
        encryptionStream.close();

        // Information about the encryption (algorithms, detached signatures etc.)
        EncryptionResult result = encryptionStream.getResult();

Decrypt and Verify Signatures

Decrypting data and verifying signatures is being done similarly. PGPainless will not only verify correctness of signatures, but also if the signing key was allowed to create the signature. A key might not be allowed to create signatures if, for example, it expired or was revoked, or was not properly bound to the key ring. Furthermore, PGPainless will reject signatures made using weak algorithms like SHA-1. This behaviour can be modified though using the Policy class.

        DecryptionStream decryptionStream = PGPainless.decryptAndOrVerify()
                .onInputStream(encryptedInputStream)
                .withOptions(new ConsumerOptions()
                        .addDecryptionKey(bobSecKeys, secretKeyProtector)
                        .addVerificationCert(alicePubKeys)
                );

        Streams.pipeAll(decryptionStream, outputStream);
        decryptionStream.close();

        // Result contains information like signature status etc.
        OpenPgpMetadata metadata = decryptionStream.getResult();

After the DecryptionStream was closed, you can get metadata about the processed data by retrieving the OpenPgpMetadata. Again, this object will contain information about how the message was encrypted, who signed it and so on.

Many more examples can be found in the examples package!!!

Include PGPainless in your Project

PGPainless is available on maven central. In order to include it in your project, just add the maven central repository and add PGPainless as a dependency.

repositories {
	mavenCentral()
}

dependencies {
	implementation 'org.pgpainless:pgpainless-core:1.3.1'
}

Professional Support

Do you need a custom feature? Are you unsure of what's the best way to integrate PGPainless into your product? We offer paid professional services. Don't hesitate to send an inquiry to [email protected].

Development

PGPainless is developed in - and accepts contributions from - the following places:

We are using SemVer (MAJOR.MINOR.PATCH) versioning, although MINOR releases could contain breaking changes from time to time.

If you want to contribute a bug fix, please check the release/X.Y branches first to see, what the oldest release is which contains the bug you are fixing. That way we can update older revisions of the library easily.

Branches

  • release/X.Y contains the state of the latest X.Y.Z PATCH release + next PATCH snapshot definition.
  • master contains the state of the latest MINOR release + some smaller changes that will make it into the next PATCH release.
  • development contains new features that will make it into the next MINOR release.

Example:

Latest release: 1.1.4

  • release/1.0 contains the state of 1.0.5-SNAPSHOT
  • release/1.1 contains the state of 1.1.5-SNAPSHOT
  • master contains the state release/1.1 plus patch level changes that will make it into 1.1.5.
  • development contains the state which will at some point become 1.2.0.

Please follow the code of conduct if you want to be part of the project.

Acknowledgements

Development on PGPainless is generously sponsored by FlowCrypt.com. Thank you very very very much! FlowCrypt Logo

Parts of PGPainless development (project page) will be funded by NGI Assure through NLNet.
NGI Assure is made possible with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology. NGI Assure Logo

Continuous Integration is kindly provided by Travis-CI.com.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].