26 releases (12 stable)

3.0.4 Apr 8, 2024
3.0.3 Dec 12, 2023
3.0.2 Aug 23, 2023
3.0.1 Jul 26, 2023
0.2.0 Mar 14, 2016

#11 in Cryptography

Download history 851375/week @ 2024-09-10 812727/week @ 2024-09-17 930207/week @ 2024-09-24 960396/week @ 2024-10-01 930361/week @ 2024-10-08 1030840/week @ 2024-10-15 1026445/week @ 2024-10-22 983517/week @ 2024-10-29 960186/week @ 2024-11-05 1036631/week @ 2024-11-12 1033132/week @ 2024-11-19 845456/week @ 2024-11-26 1045628/week @ 2024-12-03 1145542/week @ 2024-12-10 935945/week @ 2024-12-17 398331/week @ 2024-12-24

3,698,626 downloads per month
Used in 2,189 crates (203 directly)

MIT license

46KB
829 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 = "3.0"

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

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

~215–395KB