Crate yubihsm[−][src]
yubihsm.rs: pure Rust client for YubiHSM2
hardware security modules
Prerequisites
This crate builds on Rust 1.27+ and by default uses SIMD features
which require the following RUSTFLAGS
:
RUSTFLAGS=-Ctarget-feature=+aes
You can configure your ~/.cargo/config
to always pass these flags:
[build]
rustflags = ["-Ctarget-feature=+aes"]
Getting Started
The following documentation describes the most important parts of this crate's API:
- Session: end-to-end encrypted connection with the YubiHSM. You'll need an active one to do anything.
- commands: commands supported by the YubiHSM2 (i.e. main functionality)
The following is an example of how to create a Session
by connecting to a
yubihsm-connector process, and then performing an Ed25519 signature:
extern crate yubihsm; use yubihsm::Session; // Default host, port, auth key ID, and password for yubihsm-connector let mut session = Session::create_from_password(Default::default(), 1, "password", true).unwrap(); // Note: You'll need to create this key first. Run the following from yubihsm-shell: // `generate asymmetric 0 100 ed25519_test_key 1 asymmetric_sign_eddsa ed25519` let response = yubihsm::sign_ed25519(&mut session, 100, "Hello, world!").unwrap(); println!("Ed25519 signature: {:?}", response.signature);
Re-exports
pub use algorithm::Algorithm; |
pub use capability::Capability; |
pub use commands::*; |
pub use connector::Connector; |
pub use domain::Domain; |
pub use object::Id as ObjectId; |
pub use object::Label as ObjectLabel; |
pub use object::Origin as ObjectOrigin; |
pub use object::SequenceId; |
pub use object::Type as ObjectType; |
pub use session::Session; |
Modules
algorithm |
Cryptographic algorithms supported by the |
capability |
Object attributes specifying which operations are allowed to be performed |
commands |
Commands supported by the |
connector |
Client for the |
domain |
Logical partitions within the |
error |
Error types |
mockhsm |
Software simulation of the |
object |
Objects stored in the |
responses |
Responses to commands sent from the HSM |
session |
|
Structs
HttpConfig |
Configuration options for this connector |
HttpConnector |
HTTP(-ish) connector which supports the minimal parts of the protocol required to communicate with the yubihsm-connector service. |
SessionId |
Session/Channel IDs |
StaticKeys |
Static Secure Channel keys from which session keys are derived |
Type Definitions
SessionError |
Session errors |