14 releases (7 breaking)

0.8.3 Feb 15, 2021
0.8.2 Nov 23, 2020
0.8.1 Jun 8, 2020
0.7.0 Oct 31, 2019
0.2.0 Mar 14, 2016

#10 in Cryptography

Download history 46671/week @ 2021-01-21 52769/week @ 2021-01-28 54914/week @ 2021-02-04 56093/week @ 2021-02-11 63359/week @ 2021-02-18 63292/week @ 2021-02-25 64635/week @ 2021-03-04 60758/week @ 2021-03-11 59358/week @ 2021-03-18 64255/week @ 2021-03-25 50842/week @ 2021-04-01 59390/week @ 2021-04-08 58372/week @ 2021-04-15 63316/week @ 2021-04-22 67636/week @ 2021-04-29 56967/week @ 2021-05-06

264,756 downloads per month
Used in 366 crates (48 directly)

MIT license

26KB
337 lines

pem

A Rust library for parsing and encoding PEM-encoded data.

Build Status

Documentation

Module documentation with examples

Usage

Add this to your Cargo.toml:

[dependencies]
pem = "0.8"

and this to your crate root:

extern crate pem;

Here is a simple example that parse PEM-encoded data and prints the tag:

extern crate pem;

use pem::parse;

const SAMPLE: &'static str = "-----BEGIN RSA PRIVATE KEY-----
MIIBPQIBAAJBAOsfi5AGYhdRs/x6q5H7kScxA0Kzzqe6WI6gf6+tc6IvKQJo5rQc
dWWSQ0nRGt2hOPDO+35NKhQEjBQxPh/v7n0CAwEAAQJBAOGaBAyuw0ICyENy5NsO
2gkT00AWTSzM9Zns0HedY31yEabkuFvrMCHjscEF7u3Y6PB7An3IzooBHchsFDei
AAECIQD/JahddzR5K3A6rzTidmAf1PBtqi7296EnWv8WvpfAAQIhAOvowIXZI4Un
DXjgZ9ekuUjZN+GUQRAVlkEEohGLVy59AiEA90VtqDdQuWWpvJX0cM08V10tLXrT
TTGsEtITid1ogAECIQDAaFl90ZgS5cMrL3wCeatVKzVUmuJmB/VAmlLFFGzK0QIh
ANJGc7AFk4fyFD/OezhwGHbWmo/S+bfeAiIh2Ss2FxKJ
-----END RSA PRIVATE KEY-----

let pem = parse(SAMPLE)?;
println!("PEM tag: {}", pem.tag);

Dependencies

~1.5MB
~44K SLoC