Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fboulnois/ring-pkae-example
An example of public key authenticated encryption in Rust
https://github.com/fboulnois/ring-pkae-example
aead crypto cryptography ecdh elliptic-curve-cryptography public-key-cryptography public-key-encryption rust
Last synced: 4 days ago
JSON representation
An example of public key authenticated encryption in Rust
- Host: GitHub
- URL: https://github.com/fboulnois/ring-pkae-example
- Owner: fboulnois
- License: mpl-2.0
- Created: 2021-12-24T03:38:46.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-24T17:25:54.000Z (about 3 years ago)
- Last Synced: 2024-12-22T04:42:34.450Z (12 days ago)
- Topics: aead, crypto, cryptography, ecdh, elliptic-curve-cryptography, public-key-cryptography, public-key-encryption, rust
- Language: Rust
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Public key authenticated encryption in Rust
This is an example implementation of public key authenticated encryption (PKAE)
in Rust using only the high performance [Ring](https://github.com/briansmith/ring)
cryptography library.PKAE enables a person or service X to send confidential data to another person
or service Y such that only Y can read the data. Y can also verify that the data
originated from X and not an impostor.## Motivation
Both the [libsodium](https://doc.libsodium.org/public-key_cryptography/authenticated_encryption)
and [openssl](https://www.openssl.org/docs/manmaster/man7/evp.html) libraries
can perform PKAE using specific primitives, however these are easy to misuse and
call a lot of potentially unsafe C code. No such similar examples to perform
PKAE exist for `ring`. Also, the Rust interfaces to libsodium and openssl
require the full libraries which substantially increase code size. Finally, many
Rust crates already depend on `ring` directly or transitively, including
`rustls` and by extension `actix-net`, `actix-web`, `tokio-rustls`, `h2`, and
`reqwest`. Writing PKAE functionality using `ring` avoids having to bring in a
separate dependency.## Documentation
The implementation is short and each function is documented, so the best
documentation is the [code itself](src/main.rs). A browsable `rustdoc` version
can also be created using `cargo rustdoc -- --document-private-items`.## Building and running the code
Type `cargo run`. If the code encrypts and decrypts the message successfully, it
should print `Ok`.