Skip to main content

Crate keystore_rs

Crate keystore_rs 

Source
Expand description

§Keystore-RS

A Rust implementation of Java KeyStore (JKS) encoder/decoder.

§Example

use keystore_rs::{KeyStore, PrivateKeyEntry, Certificate};
use std::time::SystemTime;

let mut ks = KeyStore::new();

let entry = PrivateKeyEntry {
    creation_time: SystemTime::now(),
    private_key: vec![/* PKCS#8 private key */],
    certificate_chain: vec![
        Certificate {
            cert_type: "X509".to_string(),
            content: vec![/* certificate bytes */],
        }
    ],
};

let password = b"password";
ks.set_private_key_entry("myalias", entry, password)?;

// Write to file
let mut file = std::fs::File::create("keystore.jks")?;
ks.store(&mut file, password)?;

Re-exports§

pub use common::zeroing;
pub use common::Certificate;
pub use common::KeyStoreOptions;
pub use common::PrivateKeyEntry;
pub use common::TrustedCertificateEntry;

Modules§

common
Common types and constants for keystore operations
decoder
Decoder for reading JKS format
encoder
Encoder for writing JKS format
keyprotector
Key protection (encryption/decryption) for private keys

Structs§

KeyStore
Java KeyStore (JKS) implementation

Enums§

Entry
Entry types in the keystore
KeyStoreError
Main error type for keystore operations

Type Aliases§

Result
Result type for keystore operations