pub struct EncodedAuthCert(/* private fields */);parse2 and plain-consensus only.Expand description
Entire authority key certificate, encoded and signed
This is a newtype around String.
§Invariants
- Is a complete document in netdoc metasyntax including trailing newline.
- Starts with one
dir-key-certificate-version - Ends with one
dir-key-certification - No other items are structural in a vote
- Every item keyword starts
dir-or isfingerprint
See https://spec.torproject.org/dir-spec/creating-key-certificates.html#nesting
§Non-invariant
- Signature and timeliness have not been checked.
§Functionality
Implements TryFrom<String> and FromStr.
Implements NetdocParseable:
parser matches dir-key-certificate-version and dir-key-certification,
but also calls Bug if the caller’s stop_at
reports that this keyword is structural for its container.
(This could happen if an EncodedAuthCert existedd in some other
document but a vote. We do not check this property during encoding.)
§Rationale
Unlike most sub-documents found within netdocs, an authcert is a signed document. We expect to be able to copy an authcert into a vote, encode, convey and parse the vote, and extract the authcert, and verify the authcert’s signature.
Additionally, the fact that authcerts have their own signatures means that they need to be constructed separately from the surrounding document, and then embedded in it later.
When parsing a vote, we need to be able to see which parts are the authcert, and we need to be able to extract the specific document text, but we maybe don’t want to parse the authcert.
Conversely, signature verification of authcerts during decoding of a vote is fairly complex. We don’t want to do signature verification during parsing, because signature verification involves the time, and we don’t want parsing to need to know the time.
Implementations§
Trait Implementations§
Source§impl AsRef<str> for EncodedAuthCert
impl AsRef<str> for EncodedAuthCert
Source§impl Clone for EncodedAuthCert
impl Clone for EncodedAuthCert
Source§fn clone(&self) -> EncodedAuthCert
fn clone(&self) -> EncodedAuthCert
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EncodedAuthCert
impl Debug for EncodedAuthCert
Source§impl FromStr for EncodedAuthCert
impl FromStr for EncodedAuthCert
Source§impl Hash for EncodedAuthCert
impl Hash for EncodedAuthCert
Source§impl NetdocParseable for EncodedAuthCert
impl NetdocParseable for EncodedAuthCert
Source§fn doctype_for_error() -> &'static str
fn doctype_for_error() -> &'static str
Source§fn is_intro_item_keyword(kw: KeywordRef<'_>) -> bool
fn is_intro_item_keyword(kw: KeywordRef<'_>) -> bool
Keyword an intro Item Keyword for this kind of document? Read moreSource§fn is_structural_keyword(kw: KeywordRef<'_>) -> Option<IsStructural>
fn is_structural_keyword(kw: KeywordRef<'_>) -> Option<IsStructural>
Keyword a structural keyword for this kind of document? Read moreSource§fn from_items(
input: &mut ItemStream<'_>,
stop_at: StopAt<impl StopPredicate>,
) -> Result<Self, EP>
fn from_items( input: &mut ItemStream<'_>, stop_at: StopAt<impl StopPredicate>, ) -> Result<Self, EP>
Source§impl Ord for EncodedAuthCert
impl Ord for EncodedAuthCert
Source§fn cmp(&self, other: &EncodedAuthCert) -> Ordering
fn cmp(&self, other: &EncodedAuthCert) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for EncodedAuthCert
impl PartialEq for EncodedAuthCert
Source§impl PartialOrd for EncodedAuthCert
impl PartialOrd for EncodedAuthCert
Source§impl TryFrom<String> for EncodedAuthCert
impl TryFrom<String> for EncodedAuthCert
impl Eq for EncodedAuthCert
impl StructuralPartialEq for EncodedAuthCert
Auto Trait Implementations§
impl Freeze for EncodedAuthCert
impl RefUnwindSafe for EncodedAuthCert
impl Send for EncodedAuthCert
impl Sync for EncodedAuthCert
impl Unpin for EncodedAuthCert
impl UnsafeUnpin for EncodedAuthCert
impl UnwindSafe for EncodedAuthCert
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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> AsUncased for T
impl<T> AsUncased for T
Source§fn as_uncased(&self) -> &UncasedStr
fn as_uncased(&self) -> &UncasedStr
self to an UncasedStr.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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