pem
2.0.6, released a year ago by google.dev
PEM encoding and decoding of textual keys and certificates following RFC 7468.
What it does
Encodes and decodes PEM textual key formats and certificate chains. Supports both lax and strict modes, handling extra whitespace and surrounding text during parsing.
AI-written summary of version 2.0.6, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to parse PEM-encoded private or public keys in Dart
- You need to generate strict-mode PEM strings from key data bytes
- You are working with concatenated PEM blocks like certificate chains
Skip it when
- You need strict validation that distinguishes malformed PEM blocks from ignored surrounding text
Strengths
- Supports both lax and strict decoding modes
- Handles certificate chains with concatenated PEM blocks
- Follows RFC 7468 specifications
Weaknesses
- Decoding methods ignore surrounding text, meaning malformed PEM blocks do not throw specific exceptions
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
import 'package:pem/pem.dart';
List<int> keyData = PemCodec(PemLabel.privateKey).decode("""
-----BEGIN PRIVATE KEY-----
<key data>
-----END PRIVATE KEY-----
"");
String pemBlock = PemCodec(PemLabel.privateKey).encode(keyData);Alternatives
Packages that do the same job and could replace pem.
- cbor
A Dart library for RFC8949‑compliant CBOR encoding and decoding.
89Compare - webcrypto
Cross-platform implementation of Web Cryptography APIs for Dart.
89Compare - jwk
Encode and decode JSON Web Keys for use with the cryptography package
55Compare - plist_parser
Flutter plugin for parsing XML and binary Apple property list (plist) formats.
65Compare
Works with
Packages commonly used together with pem: ones it builds on, ones built on it, and its own family.