isideload_p12_keystore/lib.rs
1//!
2//! A convenient high-level library to work with PKCS#12/PFX keystores, written in pure Rust,
3//! modeled after Java KeyStore API.
4//!
5//! This crate consists of a [KeyStore] struct which provides a set of functions to read and write PKCS#12 files
6//! and their contents. It supports single- or multi-keychain keystores and also so called 'truststores'
7//! (keystores with only root certificates and without private keys).
8//!
9//! Each entry in the keystore is accessed by 'alias', which is a friendly name chosen when creating it.
10//!
11//! All certificates must be encoded in X.509 format. Private keys must be encoded in PKCS#8.
12//!
13//! Each private key contains a key material, a local key ID (unique byte or string sequence) and a list of
14//! certificates organized into chain. The first in the chain must be the entity certificate associated with
15//! the private key. The last must be the CA root certificate, with any intermediates in between.
16//!
17//! Supported encryption schemes:
18//!
19//! * [EncryptionAlgorithm::PbeWithShaAnd3KeyTripleDesCbc] - legacy encryption to support the existing stores
20//! * [EncryptionAlgorithm::PbeWithShaAnd40BitRc4Cbc] - legacy encryption to support the existing stores
21//! * [EncryptionAlgorithm::PbeWithHmacSha256AndAes256] - the default encryption which should be used for new keystores
22//!
23//! Supported MAC algorithms: [MacAlgorithm::HmacSha1], [MacAlgorithm::HmacSha256]
24//!
25
26mod cert;
27mod codec;
28pub mod error;
29mod keychain;
30mod keystore;
31mod oid;
32#[cfg(feature = "pbes1")]
33mod pbes1;
34pub mod secret;
35
36pub use rand;
37
38/// Result type for keystore operations
39pub type Result<T> = std::result::Result<T, error::Error>;
40
41pub use cert::Certificate;
42pub use keychain::{LocalKeyId, PrivateKey, PrivateKeyChain};
43pub use keystore::{EncryptionAlgorithm, KeyStore, KeyStoreEntry, MacAlgorithm, Pkcs12ImportPolicy, Pkcs12Writer};