Skip to content

Commit bd53e91

Browse files
Ryan van PolenRynibami
Ryan van Polen
authored andcommitted
Eagerly implemented PartialEq and Eq traits
1 parent cc1f8e2 commit bd53e91

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

rcgen/src/certificate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::{
2222
};
2323

2424
/// An issued certificate
25-
#[derive(Debug, Clone)]
25+
#[derive(Debug, Clone, PartialEq, Eq)]
2626
pub struct Certificate {
2727
pub(crate) der: CertificateDer<'static>,
2828
}

rcgen/src/crl.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ use crate::{
6464
/// key_identifier_method: KeyIdMethod::PreSpecified(vec![]),
6565
/// }.signed_by(&issuer_params, &key_pair).unwrap();
6666
///# }
67-
#[derive(Clone, Debug)]
67+
#[derive(Clone, Debug, PartialEq, Eq)]
6868
pub struct CertificateRevocationList {
6969
der: CertificateRevocationListDer<'static>,
7070
}
@@ -159,7 +159,7 @@ pub enum RevocationReason {
159159
}
160160

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

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

338338
/// Parameters used for describing a revoked certificate included in a [`CertificateRevocationList`].
339-
#[derive(Clone, Debug)]
339+
#[derive(Clone, Debug, PartialEq, Eq)]
340340
pub struct RevokedCertParams {
341341
/// Serial number identifying the revoked certificate.
342342
pub serial_number: SerialNumber,

rcgen/src/csr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl PublicKeyData for PublicKey {
3737
}
3838

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

6868
/// Parameters for a certificate signing request
69-
#[derive(Clone, Debug)]
69+
#[derive(Clone, Debug, PartialEq, Eq)]
7070
pub struct CertificateSigningRequestParams {
7171
/// Parameters for the certificate to be signed.
7272
pub params: CertificateParams,

rcgen/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ pub mod string;
8787
pub type RcgenError = Error;
8888

8989
/// An issued certificate, together with the subject keypair.
90+
#[derive(PartialEq, Eq)]
9091
pub struct CertifiedKey<S: SigningKey> {
9192
/// An issued certificate.
9293
pub cert: Certificate,
@@ -132,6 +133,7 @@ pub fn generate_simple_self_signed(
132133
Ok(CertifiedKey { cert, key_pair })
133134
}
134135

136+
#[derive(PartialEq, Eq)]
135137
struct Issuer<'a, S> {
136138
distinguished_name: &'a DistinguishedName,
137139
key_identifier_method: &'a KeyIdMethod,

0 commit comments

Comments
 (0)