[][src]Struct rpki::crypto::signature::SignatureAlgorithm

pub struct SignatureAlgorithm;

The signature algorihms used by RPKI.

These are the algorithms used for creating and verifying signatures. For RPKI, RFC 7935 allows only one algorithm, RSA PKCS #1 v1.5 with SHA-256. Because of that, this type is currently a zero-sized struct. Should additional algorithms ever be allowed, it will change into an enum.

Methods

impl SignatureAlgorithm[src]

pub fn public_key_format(self) -> PublicKeyFormat[src]

Returns the preferred public key format for this algorithm.

impl SignatureAlgorithm[src]

ASN.1 Values

Signature algorithm identifiers appear in certificates and other objects from [RFC 5280] (simply as algorithm identifiers) as well as in signed objects.

SignatureAlgorithmIdentifier ::= AlgorithmIdentifier
AlgorithmIdentifier          ::= SEQUENCE {
     algorithm                   OBJECT IDENTIFIER,
     parameters                  ANY DEFINED BY algorithm OPTIONAL }

Currently, RFC 7935 allows only one algorithm, but sadly it uses different identifiers in different places. For X.509-related objects, i.e., certificates, CRLs, and certification requests, this is sha256WithRSAEncryption from RFC 4055. For signed objects, the identifier must be rsaEncryption from RFC 3370 for constructed objects while both must be accepted when reading objects.

Because of these differences, you’ll find two sets of functions and methods in this section. Those prefixed with x509 deal with the X.509-related identifiers while cms_ is the prefix for signed objects.

The parameters field for the former identifier can be either NULL or missing and must be NULL for the latter. We will, however, accept an absent field for the latter as well. When constructing identifiers, we will always include a parameters field and set it to NULL.

pub fn x509_take_from<S: Source>(
    cons: &mut Constructed<S>
) -> Result<Self, S::Err>
[src]

Takes a signature algorithm identifier for X.509 objects.

Returns a malformed error if the algorithm isn’t the allowed for RPKI or if it isn’t correctly encoded.

pub fn cms_take_from<S: Source>(
    cons: &mut Constructed<S>
) -> Result<Self, S::Err>
[src]

Takes a signature algorithm identifier for CMS objects.

Returns a malformed error if the algorithm isn’t the allowed for RPKI or if it isn’t correctly encoded.

pub fn x509_encode(self) -> impl Values[src]

Provides an encoder for X.509 objects.

pub fn cms_encode(self) -> impl Values[src]

Provides an encoder for CMS objects.

Trait Implementations

impl Copy for SignatureAlgorithm[src]

impl PartialEq<SignatureAlgorithm> for SignatureAlgorithm[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Clone for SignatureAlgorithm[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for SignatureAlgorithm[src]

impl Debug for SignatureAlgorithm[src]

impl Hash for SignatureAlgorithm[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.