Skip to content

Eagerly implemented PartialEq and Eq traits #344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rcgen/src/certificate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{
};

/// An issued certificate
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Certificate {
pub(crate) der: CertificateDer<'static>,
}
Expand Down
8 changes: 4 additions & 4 deletions rcgen/src/crl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use crate::{
/// key_identifier_method: KeyIdMethod::PreSpecified(vec![]),
/// }.signed_by(&issuer_params, &key_pair).unwrap();
///# }
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CertificateRevocationList {
der: CertificateRevocationListDer<'static>,
}
Expand Down Expand Up @@ -159,7 +159,7 @@ pub enum RevocationReason {
}

/// Parameters used for certificate revocation list (CRL) generation
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CertificateRevocationListParams {
/// Issue date of the CRL.
pub this_update: OffsetDateTime,
Expand Down Expand Up @@ -293,7 +293,7 @@ impl CertificateRevocationListParams {

/// A certificate revocation list (CRL) issuing distribution point, to be included in a CRL's
/// [issuing distribution point extension](https://datatracker.ietf.org/doc/html/rfc5280#section-5.2.5).
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CrlIssuingDistributionPoint {
/// The CRL's distribution point, containing a sequence of URIs the CRL can be retrieved from.
pub distribution_point: CrlDistributionPoint,
Expand Down Expand Up @@ -336,7 +336,7 @@ pub enum CrlScope {
}

/// Parameters used for describing a revoked certificate included in a [`CertificateRevocationList`].
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RevokedCertParams {
/// Serial number identifying the revoked certificate.
pub serial_number: SerialNumber,
Expand Down
4 changes: 2 additions & 2 deletions rcgen/src/csr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl PublicKeyData for PublicKey {
}

/// A certificate signing request (CSR) that can be encoded to PEM or DER.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CertificateSigningRequest {
pub(crate) der: CertificateSigningRequestDer<'static>,
}
Expand Down Expand Up @@ -66,7 +66,7 @@ impl From<CertificateSigningRequest> for CertificateSigningRequestDer<'static> {
}

/// Parameters for a certificate signing request
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CertificateSigningRequestParams {
/// Parameters for the certificate to be signed.
pub params: CertificateParams,
Expand Down
2 changes: 2 additions & 0 deletions rcgen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pub mod string;
pub type RcgenError = Error;

/// An issued certificate, together with the subject keypair.
#[derive(PartialEq, Eq)]
pub struct CertifiedKey<S: SigningKey> {
/// An issued certificate.
pub cert: Certificate,
Expand Down Expand Up @@ -132,6 +133,7 @@ pub fn generate_simple_self_signed(
Ok(CertifiedKey { cert, key_pair })
}

#[derive(PartialEq, Eq)]
struct Issuer<'a, S> {
distinguished_name: &'a DistinguishedName,
key_identifier_method: &'a KeyIdMethod,
Expand Down
Loading