Crate tor_keymgr
source ·Expand description
§tor-keymgr
Code to fetch, store, and update keys.
§Overview
This crate is part of Arti, a project to implement Tor in Rust.
§Likely to change
The APIs exposed by this crate (even without the keymgr feature)
are new and are likely to change rapidly.
We’ll therefore often be making semver-breaking changes
(and will update the crate version accordingly).
§Key stores
The KeyMgr is an interface to one or more key stores. The key
stores are types that implement the Keystore trait.
This crate provides the following key store implementations:
- Arti key store: an on-disk store that stores keys in OpenSSH format.
- (not yet implemented) C Tor key store: an on-disk store that is backwards-compatible with C Tor (new keys are stored in the format used by C Tor, and any existing keys are expected to be in this format too).
In the future we plan to also support HSM-based key stores.
§Key specifiers and key types
The Keystore APIs expect a “key specifier” (specified for each supported key
type via the KeySpecifier trait), and a KeyType.
A “key specifier” identifies a group of equivalent keys, each of a different type (algorithm). It is used to determine the path of the key within the key store (minus the extension).
KeyType represents the type of a key (e.g. “Ed25519 keypair”).
KeyType::arti_extension specifies what file extension keys of that type are
expected to have (when stored in an Arti store).
The KeySpecifier::arti_path and KeyType::arti_extension are joined
to form the path of the key on disk (relative to the root dir of the key store).
This enables the key stores to have multiple keys with the same role (i.e. the
same KeySpecifier::arti_path), but different key types (i.e. different
KeyType::arti_extensions).
KeySpecifier implementers must specify:
arti_path: the location of the key in the Arti key store. This also serves as a unique identifier for a particular instance of a key.ctor_path: the location of the key in the C Tor key store (optional).
§Feature flags
§Additive features
(None yet.)
§Experimental and unstable features
Note that the APIs enabled by these features are NOT covered by semantic versioning1 guarantees: we might break them or remove them between patch versions.
keymgr– build with full key manager support. Disabling this feature causestor-keymgrto export a no-op, placeholder implementation.
Remember, semantic versioning is what makes various
↩cargofeatures work reliably. To be explicit: if you wantcargo updateto only make safe changes, then you cannot enable these features.
Re-exports§
pub use ssh_key;keymgr
Modules§
- Keystore configuration.
- test_utils
testingTest helpers.
Macros§
- A helper for implementing
KeySpecifiers. - Register a
KeyInfoExtractorfor use withKeyMgr.
Structs§
- ArtiNativeKeystore
keymgrThe Arti key store. - A unique identifier for a particular instance of a key.
- The path of a key in the C Tor key store.
- KeyMgr
keymgr - KeyMgrBuilder
keymgrBuilder forKeyMgr. - Information about a
KeyPath. - Builder for
KeyPathInfo. - A range specifying a substring of a
KeyPath. - An identifier for a particular
Keystoreinstance. - UnknownKeyTypeError
keymgrAn error that happens when we encounter an unknown key type.
Enums§
- An error caused by a syntactically invalid
ArtiPath. - An error returned by a
KeySpecifier. - An Error type for this crate.
- The identifier of a key.
- An error while attempting to extract information about a key given its path
- KeyType
keymgrA type of key stored in the key store. - An error caused by keystore corruption.
- Specifies which keystores a
KeyMgroperation should apply to. - SshKeyData
keymgrA public key or a keypair.
Constants§
- A separator for that marks the beginning of the keys denotators within an
ArtiPath.
Traits§
- EncodableKey
keymgrA key that can be serialized to, and deserialized from, a format used by aKeystore. - A trait for extracting info out of a
KeyPaths. - The “specifier” of a key, which identifies an instance of a key.
- A trait for serializing and deserializing specific types of
Slugs. - A pattern specifying some or all of a kind of key
- Keygen
keymgrA trait for generating fresh keys. - KeygenRng
keymgrA random number generator for generatingEncodableKeys. - Keystore
keymgrA generic key store. - An error returned by a
Keystore. - ToEncodableKey
keymgrA key that can be converted to anEncodableKey.