pub struct CTorClientKeystore(/* private fields */);
keymgr
and ctor-keystore
only.Expand description
A read-only C Tor client keystore.
This keystore provides read-only access to the client restricted discovery keys
rooted at a given ClientOnionAuthDir
directory (see ClientOnionAuthDir
in tor(1)
).
The key files must be in the
<hsid>:descriptor:x25519:<base32-encoded-x25519-public-key>
format
and have the .auth_private
extension.
Invalid keys, and keys that don’t have the expected extension, will be ignored.
The only supported Keystore
operations are contains
,
get
, and list
. All other keystore operations
will return an error.
This keystore implementation uses the CTorPath
of the requested KeySpecifier
and the KeystoreItemType
to identify the appropriate restricted discovery keypair.
If the requested CTorPath
is not ClientHsDescEncKey
,
the keystore will declare the key not found.
If the requested CTorPath
is ClientHsDescEncKey
,
but the KeystoreItemType
is not X25519StaticKeypair
,
an error is returned.
Implementations§
Source§impl CTorClientKeystore
impl CTorClientKeystore
Sourcepub fn from_path_and_mistrust(
keystore_dir: impl AsRef<Path>,
mistrust: &Mistrust,
id: KeystoreId,
) -> Result<Self>
pub fn from_path_and_mistrust( keystore_dir: impl AsRef<Path>, mistrust: &Mistrust, id: KeystoreId, ) -> Result<Self>
Create a new CTorKeystore
rooted at the specified keystore_dir
directory.
This function returns an error if keystore_dir
is not a directory,
or if it does not conform to the requirements of the specified Mistrust
.
Trait Implementations§
Source§impl Keystore for CTorClientKeystore
impl Keystore for CTorClientKeystore
Source§fn id(&self) -> &KeystoreId
fn id(&self) -> &KeystoreId
Source§fn contains(
&self,
key_spec: &dyn KeySpecifier,
item_type: &KeystoreItemType,
) -> Result<bool>
fn contains( &self, key_spec: &dyn KeySpecifier, item_type: &KeystoreItemType, ) -> Result<bool>
key_spec
exists in this key store.Source§fn get(
&self,
key_spec: &dyn KeySpecifier,
item_type: &KeystoreItemType,
) -> Result<Option<ErasedKey>>
fn get( &self, key_spec: &dyn KeySpecifier, item_type: &KeystoreItemType, ) -> Result<Option<ErasedKey>>
key_spec
. Read moreSource§fn insert(
&self,
_key: &dyn EncodableItem,
_key_spec: &dyn KeySpecifier,
) -> Result<()>
fn insert( &self, _key: &dyn EncodableItem, _key_spec: &dyn KeySpecifier, ) -> Result<()>
key
to the key store.Source§fn remove(
&self,
_key_spec: &dyn KeySpecifier,
_item_type: &KeystoreItemType,
) -> Result<Option<()>>
fn remove( &self, _key_spec: &dyn KeySpecifier, _item_type: &KeystoreItemType, ) -> Result<Option<()>>
Source§fn list(&self) -> Result<Vec<KeystoreEntryResult<(KeyPath, KeystoreItemType)>>>
fn list(&self) -> Result<Vec<KeystoreEntryResult<(KeyPath, KeystoreItemType)>>>
Auto Trait Implementations§
impl Freeze for CTorClientKeystore
impl RefUnwindSafe for CTorClientKeystore
impl Send for CTorClientKeystore
impl Sync for CTorClientKeystore
impl Unpin for CTorClientKeystore
impl UnwindSafe for CTorClientKeystore
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more