Skip to content

Commit

Permalink
various documentation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tertsdiepraam committed Oct 22, 2024
1 parent 1426c08 commit 14085ac
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 77 deletions.
14 changes: 7 additions & 7 deletions src/ca/idexchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ impl ChildRequest {
writer.done()
}

/// Writes the ChildRequest's XML representation to a new Vec<u8>.
/// Writes the ChildRequest's XML representation to a new `Vec<u8>`.
pub fn to_xml_vec(&self) -> Vec<u8> {
let mut vec = vec![];
self.write_xml(&mut vec).unwrap(); // safe
Expand Down Expand Up @@ -730,7 +730,7 @@ impl ParentResponse {
validate_idcert_at(&self.id_cert, when)
}

/// Writes the ParentResponse's XML representation to a new Vec<u8>.
/// Writes the ParentResponse's XML representation to a new `Vec<u8>`.
pub fn to_xml_vec(&self) -> Vec<u8> {
let mut vec = vec![];
self.write_xml(&mut vec).unwrap(); // safe
Expand All @@ -756,12 +756,12 @@ impl fmt::Display for ParentResponse {

//------------ PublisherRequest ----------------------------------------------

/// Type representing a <publisher_request/>
/// Type representing a `<publisher_request/>`
///
/// This is the XML message with identity information that a CA sends to a
/// Publication Server.
///
/// For more info, see: https://tools.ietf.org/html/rfc8183#section-5.2.3
/// For more info, see: <https://tools.ietf.org/html/rfc8183#section-5.2.3>
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct PublisherRequest {
/// The self-signed IdCert containing the publisher's public key.
Expand Down Expand Up @@ -912,7 +912,7 @@ impl PublisherRequest {
writer.done()
}

/// Writes the PublisherRequest's XML representation to a new Vec<u8>.
/// Writes the PublisherRequest's XML representation to a new `Vec<u8>`.
pub fn to_xml_vec(&self) -> Vec<u8> {
let mut vec = vec![];
self.write_xml(&mut vec).unwrap(); // safe
Expand Down Expand Up @@ -945,7 +945,7 @@ impl fmt::Display for PublisherRequest {
/// This is the response sent to a CA by the publication server. It contains
/// the details needed by the CA to send publication messages to the server.
///
/// See https://tools.ietf.org/html/rfc8183#section-5.2.4
/// See <https://tools.ietf.org/html/rfc8183#section-5.2.4>
#[derive(Clone, Debug, Deserialize, Eq, Serialize, PartialEq)]
pub struct RepositoryResponse {
/// The Publication Server Identity Certificate
Expand Down Expand Up @@ -1155,7 +1155,7 @@ impl RepositoryResponse {
validate_idcert_at(&self.id_cert, when)
}

/// Writes the RepositoryResponse's XML representation to a new Vec<u8>.
/// Writes the RepositoryResponse's XML representation to a new `Vec<u8>`.
pub fn to_xml_vec(&self) -> Vec<u8> {
let mut vec = vec![];
self.write_xml(&mut vec).unwrap(); // safe
Expand Down
10 changes: 5 additions & 5 deletions src/ca/provisioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ impl Message {
/// # Decoding from XML
///
impl Message {
/// Parses an RFC 6492 <message />
/// Parses an RFC 6492 `<message />`
pub fn decode<R: io::BufRead>(reader: R) -> Result<Self, Error> {
let mut reader = xml::decode::Reader::new(reader);

Expand Down Expand Up @@ -375,7 +375,7 @@ impl Payload {
/// # Encoding to XML
///
impl Payload {
/// Value for the type attribute in the <message /> element.
/// Value for the type attribute in the `<message />` element.
pub fn payload_type(&self) -> PayloadType {
match self {
Payload::List => PayloadType::List,
Expand Down Expand Up @@ -723,7 +723,7 @@ impl IssuanceResponse {
/// Note that the IssuanceRequest will be rejected by the parent, if the limit
/// exceeds the child's entitlements.
///
/// See: https://tools.ietf.org/html/rfc6492#section-3.4.1
/// See: <https://tools.ietf.org/html/rfc6492#section-3.4.1>
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct RequestResourceLimit {
#[serde(
Expand Down Expand Up @@ -998,7 +998,7 @@ impl From<&RevocationRequest> for RevocationResponse {

//------------ KeyElement ----------------------------------------------------

/// This type represents a <key /> element as used in both the Certificate
/// This type represents a `<key />` element as used in both the Certificate
/// Revocation Request and Response, sections 3.5.1 and 3.5.2 respectively,
/// of RFC6492.
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
Expand Down Expand Up @@ -1096,7 +1096,7 @@ impl fmt::Display for KeyElement {
/// This structure is what is called the "Resource Class List Response"
/// in section 3.3.2 of RFC6492.
///
/// This response can have 0 or more <class /> elements containing the
/// This response can have 0 or more `<class />` elements containing the
/// entitlements for 0 or more corresponding resource classes.
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct ResourceClassListResponse {
Expand Down
14 changes: 7 additions & 7 deletions src/ca/publication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl Message {
/// # Decoding from XML
///
impl Message {
/// Parses an RFC 8181 <msg />
/// Parses an RFC 8181 `<msg />`
pub fn decode<R: io::BufRead>(reader: R) -> Result<Self, Error> {
let mut reader = xml::decode::Reader::new(reader);

Expand Down Expand Up @@ -539,7 +539,7 @@ impl QueryPdu {
//------------ PublishDelta ------------------------------------------------

/// This type represents a multi element query as described in
/// https://tools.ietf.org/html/rfc8181#section-3.7
/// <https://tools.ietf.org/html/rfc8181#section-3.7>
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct PublishDelta(Vec<PublishDeltaElement>);

Expand Down Expand Up @@ -613,7 +613,7 @@ impl PublishDeltaElement {
//------------ Publish -------------------------------------------------------

/// Represents a publish element, that does not update any existing object.
/// See: https://tools.ietf.org/html/rfc8181#section-3.1
/// See: <https://tools.ietf.org/html/rfc8181#section-3.1>
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct Publish {
tag: Option<String>,
Expand Down Expand Up @@ -679,7 +679,7 @@ impl Publish {
//------------ Update --------------------------------------------------------

/// Represents a publish element, that replaces an existing object.
/// See: https://tools.ietf.org/html/rfc8181#section-3.2
/// See: <https://tools.ietf.org/html/rfc8181#section-3.2>
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct Update {
tag: Option<String>,
Expand Down Expand Up @@ -766,7 +766,7 @@ impl Update {
//------------ Withdraw ------------------------------------------------------

/// Represents a withdraw element that removes an object.
/// See: https://tools.ietf.org/html/rfc8181#section-3.3
/// See: <https://tools.ietf.org/html/rfc8181#section-3.3>
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct Withdraw {
tag: Option<String>,
Expand Down Expand Up @@ -1062,7 +1062,7 @@ impl ReplyPdu {
//------------ ListReply -----------------------------------------------------

/// This type represents the list reply as described in
/// https://tools.ietf.org/html/rfc8181#section-2.3
/// <https://tools.ietf.org/html/rfc8181#section-2.3>
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct ListReply {
elements: Vec<ListElement>,
Expand Down Expand Up @@ -1156,7 +1156,7 @@ impl ListElement {
//------------ ErrorReply ----------------------------------------------------

/// This type represents the error report as described in
/// https://tools.ietf.org/html/rfc8181#section-3.5 and 3.6
/// <https://tools.ietf.org/html/rfc8181#section-3.5> and 3.6
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct ErrorReply {
errors: Vec<ReportError>,
Expand Down
7 changes: 5 additions & 2 deletions src/ca/sigmsg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ use super::idcert::IdCert;
/// but similar structure.
///
/// Most important differences to watch out for:
/// = This uses [`IdCert`] instead of [`Cert`] as the EE (no INRs needed)
/// = This MUST include a CRL
/// - This uses [`IdCert`] instead of [`Cert`] as the EE (no INRs needed)
/// - This MUST include a CRL
///
/// [`Cert`]: crate::repository::cert::Cert
/// [`SignedObject`]: crate::repository::sigobj::SignedObject
#[derive(Clone, Debug)]
pub struct SignedMessage {
//--- From SignedData
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl DigestAlgorithm {
/// The functions and methods in this section allow decoding and encoding
/// such values.
///
/// [`SignatureAlgorithm`]: ../signature/struct.SignatureAlgorithm.html
/// [`SignatureAlgorithm`]: super::SignatureAlgorithm
/// [RFC 5754]: https://tools.ietf.org/html/rfc5754
/// [RFC 7935]: https://tools.ietf.org/html/rfc7935
impl DigestAlgorithm {
Expand Down Expand Up @@ -180,7 +180,7 @@ impl DigestAlgorithm {
encode::sequence(oid::SHA256.encode())
}

/// Provides an encoder for a indentifer as the sole value of a set.
/// Provides an encoder for a identifier as the sole value of a set.
pub fn encode_set(self) -> impl encode::Values {
encode::set(
self.encode()
Expand Down
12 changes: 6 additions & 6 deletions src/crypto/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl PublicKeyFormat {
/// defined by [RFC 4055] and the parameters must be present and NULL.
/// When parsing, we generously also allow it to be absent altogether.
///
/// For ECDSA keys, the object identifer needs to be `ecPublicKey` defined
/// For ECDSA keys, the object identifier needs to be `ecPublicKey` defined
/// in [RFC 5480] with the parameter being the object identifier `secp256r1`
/// defined in the same RFC.
///
Expand Down Expand Up @@ -113,7 +113,7 @@ impl PublicKeyFormat{
}
}

/// Provides an encoder for the algorihm identifier.
/// Provides an encoder for the algorithm identifier.
pub fn encode(self) -> impl encode::Values {
match self {
PublicKeyFormat::Rsa => {
Expand Down Expand Up @@ -177,7 +177,7 @@ impl PublicKey {
/// Creates an RSA Public Key based on the supplied exponent and modulus.
///
/// See:
/// [RFC 4055]: https://tools.ietf.org/html/rfc4055
/// [RFC 4055]: <https://tools.ietf.org/html/rfc4055>
///
/// An RSA Public Key uses the following DER encoded structure inside its
/// BitString component:
Expand Down Expand Up @@ -421,7 +421,7 @@ impl PrimitiveContent for PublicKeyCn {
pub struct KeyIdentifier([u8; 20]);

impl KeyIdentifier {
/// Returns an octet slice of the key identifer’s value.
/// Returns an octet slice of the key identifier’s value.
pub fn as_slice(&self) -> &[u8] {
self.0.as_ref()
}
Expand Down Expand Up @@ -456,7 +456,7 @@ impl KeyIdentifier {
cons.take_opt_value_if(bcder::Tag::OCTET_STRING, Self::from_content)
}

/// Parses an encoded key identifer from encoded content.
/// Parses an encoded key identifier from encoded content.
pub fn from_content<S: Source>(
content: &mut decode::Content<S>
) -> Result<Self, DecodeError<S::Error>> {
Expand All @@ -481,7 +481,7 @@ impl KeyIdentifier {
}
}

/// Skips over an encoded key indentifier.
/// Skips over an encoded key identifier.
pub fn skip_opt_in<S: Source>(
cons: &mut decode::Constructed<S>
) -> Result<Option<()>, DecodeError<S::Error>> {
Expand Down
29 changes: 13 additions & 16 deletions src/repository/cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
//!
//! In addition, there are several types for the components of a certificate.
//!
//! [`Cert`]: struct.Cert.html
//! [`ResourceCert`]: struct.ResourceCert.html
//! [RFC 5280]: https://tools.ietf.org/html/rfc5280
//! [RFC 6487]: https://tools.ietf.org/html/rfc5487
Expand Down Expand Up @@ -73,13 +71,12 @@ use super::x509::{
/// further processing. In addition, various methods exist to access
/// information contained in the certificate.
///
/// [`ResourceCert`]: struct.ResourceCert.html
/// [`decode`]: #method.decode
/// [`take_from`]: #method.take_from
/// [`from_constructed`]: #method.from_constructed
/// [`validate_ca`]: #method.validate_ca
/// [`validate_ee`]: #method.validate_ee
/// [`validate_ta`]: #method.validate_ta
/// [`decode`]: Cert::decode
/// [`take_from`]: Cert::take_from
/// [`from_constructed`]: Cert::from_constructed
/// [`validate_ca`]: Cert::validate_ca
/// [`validate_ee`]: Cert::validate_ee
/// [`validate_ta`]: Cert::validate_ta
#[derive(Clone, Debug)]
pub struct Cert {
/// The outer structure of the certificate.
Expand Down Expand Up @@ -256,7 +253,7 @@ impl Cert {
self.verify_ee_at(issuer, strict, now).map_err(Into::into)
}

/// Validates the certificate as a detached EE certficate.
/// Validates the certificate as a detached EE certificate.
///
/// Such a certificate is used by signed objects that are not published
/// through RPKI repositories.
Expand Down Expand Up @@ -384,7 +381,7 @@ impl Cert {
// 4.8.1. Basic Constraints: Must not be present.
if self.basic_ca.is_some(){
return Err(InspectionError::new(
"Basic Contraints extension \
"Basic Constraints extension \
not allowed in end entity certificate"
))
}
Expand Down Expand Up @@ -422,7 +419,7 @@ impl Cert {
Ok(())
}

/// Inspects the certificate as a detached EE certficate.
/// Inspects the certificate as a detached EE certificate.
///
/// Checks that the certificate fulfills all formal requirements of such
/// a certificate.
Expand All @@ -435,7 +432,7 @@ impl Cert {
// 4.8.1. Basic Constraints: Must not be present.
if self.basic_ca.is_some(){
return Err(InspectionError::new(
"Basic Contraints extension \
"Basic Constraints extension \
not allowed in end entity certificate"
))
}
Expand Down Expand Up @@ -506,7 +503,7 @@ impl Cert {
// 4.8.1. Basic Constraints. Must not be present.
if self.basic_ca.is_some(){
return Err(InspectionError::new(
"Basic Contraints extension \
"Basic Constraints extension \
not allowed in end entity certificate"
))
}
Expand All @@ -517,7 +514,7 @@ impl Cert {
self.subject_public_key_info().key_identifier()
{
return Err(InspectionError::new(
"Subject Key Identifer extension doesn't match \
"Subject Key Identifier extension doesn't match \
the public key"
))
}
Expand Down Expand Up @@ -588,7 +585,7 @@ impl Cert {
}
if self.as_resources().is_inherited() {
return Err(InspectionError::new(
"inherited AS Resources in router certifiate"
"inherited AS Resources in router certificate"
))
}

Expand Down
8 changes: 2 additions & 6 deletions src/repository/crl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
//!
//! The RPKI CRL profile is defined in RFC 6487 based on the Internet RPIX
//! profile defined in RFC 5280.
//!
//! [`Crl`]: struct.Crl.html
//! [`CrlStore`]: struct.CrlStore.html
use std::{fmt, ops};
use std::collections::HashSet;
use std::str::FromStr;
Expand Down Expand Up @@ -341,7 +337,7 @@ impl<C> TbsCertList<C> {
&self.authority_key_id
}

/// Sets the authority key identifer.
/// Sets the authority key identifier.
pub fn set_authority_key_identifier(&mut self, id: KeyIdentifier) {
self.authority_key_id = id
}
Expand Down Expand Up @@ -627,7 +623,7 @@ impl CrlEntry {
cons.take_sequence(Self::from_constructed)
}

/// Takes an optional CRL entry from the beginning of a contructed value.
/// Takes an optional CRL entry from the beginning of a constructed value.
pub fn take_opt_from<S: decode::Source>(
cons: &mut decode::Constructed<S>
) -> Result<Option<Self>, DecodeError<S::Error>> {
Expand Down
3 changes: 0 additions & 3 deletions src/repository/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
//! This module defines the type [`Manifest`] that represents a decoded
//! manifest and the type [`ManifestContent`] for the content of a validated
//! manifest, as well as some helper types for accessing the content.
//!
//! [`Manifest`]: struct.Manifest.html
//! [`ManifestContent`]: struct.ManifestContent.html
use std::{borrow, fmt, ops};
use bcder::{decode, encode};
Expand Down
Loading

0 comments on commit 14085ac

Please sign in to comment.