6 releases (3 breaking)

0.4.0 Jul 20, 2018
0.3.1 Jun 15, 2018
0.2.0 Jun 8, 2018
0.1.1 Feb 8, 2018
0.1.0 Nov 24, 2017

#2177 in Cryptography


Used in bpb

MIT/Apache

32KB
624 lines

pbp - Pretty Bad Protocol

This crate lets you generate OpenPGP datagrams from ed25519 keys and signatures; it is intended to bridge from a non-PGP system to a transport medium that expects PGP data.

fn print_key(keypair: KeyPair) {
    let pgp_key = PgpKey::new(&keypair.public[..], "user id string", |data| {
        keypair.sign(data).to_bytes()
    });
    println!("{}", pgp_key);
}

It's agnostic about what library you use to implement ed25519, but it has a feature which integrates with ed25519-dalek

Thanks to isis lovecruft and Henry de Valence for assistance with the dalek API and understanding the OpenPGP specification.

Demonstration

The "print" example prints an ASCII armored OpenPGP public key to stdout; you can check that using:

$ cargo run --features dalek --example print

lib.rs:

This library is designed to integrate non-PGP generated and verified keys and signatures with channels that expect PGP data. It specifically only supports the ed25519 signature scheme.

Sometimes you want to be able to sign data, and the only reasonable channel to transmit signatures and public keys available to you expects them to be PGP formatted. If you don't want to use a heavyweight dependency like gpg, this library supports only the minimal necessary components of the PGP format to transmit your keys and signatures.

Dependencies

~0.8–1.9MB
~39K SLoC