pub struct CTorServiceKeystore {
keystore: CTorKeystore,
nickname: HsNickname,
}
keymgr
and ctor-keystore
only.Expand description
A read-only C Tor service keystore.
This keystore provides read-only access to the hidden service keys
rooted at a given HiddenServiceDirectory
directory
(see HiddenServiceDirectory
in tor(1)
).
This keystore can be used to read the HiddenServiceDirectory/private_key
and HiddenServiceDirectory/public_key
C Tor keys, specified by
CTorServicePath::PrivateKey
(with KeyType::Ed25519ExpandedKeypair
)
and CTorServicePath::PublicKey
(with KeyType::Ed25519PublicKey
),
respectively. Any other files stored in HiddenServiceDirectory
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 key.
If the requested CTorPath
is not Service
,
or if the HsNickname
specified in the CTorPath
does not match the nickname of this store,
the key will be declared not found.
If the requested CTorPath
is Service
,
but the ItemType
and CTorServicePath
are mismatched,
an error is returned.
Fields§
§keystore: CTorKeystore
The underlying keystore
nickname: HsNickname
The nickname of the service this keystore is meant for
Implementations§
Source§impl CTorServiceKeystore
impl CTorServiceKeystore
Sourcepub fn from_path_and_mistrust(
keystore_dir: impl AsRef<Path>,
mistrust: &Mistrust,
id: KeystoreId,
nickname: HsNickname,
) -> Result<Self>
pub fn from_path_and_mistrust( keystore_dir: impl AsRef<Path>, mistrust: &Mistrust, id: KeystoreId, nickname: HsNickname, ) -> Result<Self>
Create a new CTorServiceKeystore
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 CTorServiceKeystore
impl Keystore for CTorServiceKeystore
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.Auto Trait Implementations§
impl Freeze for CTorServiceKeystore
impl RefUnwindSafe for CTorServiceKeystore
impl Send for CTorServiceKeystore
impl Sync for CTorServiceKeystore
impl Unpin for CTorServiceKeystore
impl UnwindSafe for CTorServiceKeystore
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