1# [RustCrypto]: PKCS#8 (Private Keys) 2 3[![crate][crate-image]][crate-link] 4[![Docs][docs-image]][docs-link] 5[![Build Status][build-image]][build-link] 6![Apache2/MIT licensed][license-image] 7![Rust Version][rustc-image] 8[![Project Chat][chat-image]][chat-link] 9 10Pure Rust implementation of Public-Key Cryptography Standards (PKCS) #8: 11Private-Key Information Syntax Specification ([RFC 5208]). 12 13[Documentation][docs-link] 14 15## About PKCS#8 16 17PKCS#8 is a format for cryptographic private keys, often containing pairs 18of private and public keys. 19 20You can identify a PKCS#8 private key encoded as PEM (i.e. text) by the 21following: 22 23```text 24-----BEGIN PRIVATE KEY----- 25``` 26 27PKCS#8 private keys can optionally be encrypted under a password using 28key derivation algorithms like PBKDF2 and [scrypt], and encrypted with 29ciphers like AES-CBC. When a PKCS#8 private key has been encrypted, 30it starts with the following: 31 32```text 33-----BEGIN ENCRYPTED PRIVATE KEY----- 34``` 35 36PKCS#8 private keys can also be serialized in an ASN.1-based binary format. 37The PEM text encoding is a Base64 representation of this format. 38 39## Supported Algorithms 40 41This crate is implemented in an algorithm-agnostic manner with the goal of 42enabling PKCS#8 support for any algorithm. 43 44That said, it has been tested for interoperability against keys generated by 45OpenSSL for the following algorithms: 46 47- ECC (`id-ecPublicKey`) 48- Ed25519 (`id-Ed25519`) 49- RSA (`id-rsaEncryption`) 50- X25519 (`id-X25519`) 51 52Please open an issue if you encounter trouble using it with a particular 53algorithm, including the ones listed above or other algorithms. 54 55## Minimum Supported Rust Version 56 57This crate requires **Rust 1.65** at a minimum. 58 59We may change the MSRV in the future, but it will be accompanied by a minor 60version bump. 61 62## License 63 64Licensed under either of: 65 66 * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) 67 * [MIT license](http://opensource.org/licenses/MIT) 68 69at your option. 70 71### Contribution 72 73Unless you explicitly state otherwise, any contribution intentionally submitted 74for inclusion in the work by you, as defined in the Apache-2.0 license, shall be 75dual licensed as above, without any additional terms or conditions. 76 77[//]: # (badges) 78 79[crate-image]: https://buildstats.info/crate/pkcs8 80[crate-link]: https://crates.io/crates/pkcs8 81[docs-image]: https://docs.rs/pkcs8/badge.svg 82[docs-link]: https://docs.rs/pkcs8/ 83[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg 84[rustc-image]: https://img.shields.io/badge/rustc-1.65+-blue.svg 85[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg 86[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/300570-formats 87[build-image]: https://github.com/RustCrypto/formats/workflows/pkcs8/badge.svg?branch=master&event=push 88[build-link]: https://github.com/RustCrypto/formats/actions 89 90[//]: # (links) 91 92[RustCrypto]: https://github.com/rustcrypto 93[RFC 5208]: https://tools.ietf.org/html/rfc5208 94[scrypt]: https://en.wikipedia.org/wiki/Scrypt 95