| Crates.io | p12-keystore |
| lib.rs | p12-keystore |
| version | 0.3.0-rc1 |
| created_at | 2024-03-19 12:28:41.981279+00 |
| updated_at | 2026-01-14 09:56:52.410428+00 |
| description | Convenient API to work with PKCS#12 files |
| homepage | |
| repository | https://github.com/ancwrd1/p12-keystore |
| max_upload_size | |
| id | 1179213 |
| size | 136,959 |
This project contains a simple to use high-level library to work with PKCS#12/PFX keystores, written in pure Rust, modeled after Java KeyStore API.
Features:
Limitations:
Usage example:
use p12_keystore::KeyStore;
const PASSWORD: &str = "changeit";
fn main() -> Result<(), Box<dyn std::error::Error>> {
let data = std::fs::read(std::env::args().nth(1).unwrap())?;
let keystore = KeyStore::from_pkcs12(&data, PASSWORD)?;
if let Some((alias, chain)) = keystore.private_key_chain() {
println!(
"Private key chain found, alias: {}, subject: {}",
alias,
chain.certs()[0].subject()
);
}
Ok(())
}
Licensed under MIT or Apache license (LICENSE-MIT or LICENSE-APACHE)