@@ -502,7 +502,7 @@ impl fmt::Debug for PrivatePkcs8KeyDer<'_> {
502502/// The most common way to get one of these is to call [`rustls_webpki::anchor_from_trusted_cert()`].
503503///
504504/// [`rustls_webpki::anchor_from_trusted_cert()`]: https://docs.rs/rustls-webpki/latest/webpki/fn.anchor_from_trusted_cert.html
505- #[ derive( Clone , Debug , PartialEq , Eq ) ]
505+ #[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
506506pub struct TrustAnchor < ' a > {
507507 /// Value of the `subject` field of the trust anchor
508508 pub subject : Der < ' a > ,
@@ -555,7 +555,7 @@ impl TrustAnchor<'_> {
555555/// # }
556556/// ```
557557
558- #[ derive( Clone , Debug , PartialEq , Eq ) ]
558+ #[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
559559pub struct CertificateRevocationListDer < ' a > ( Der < ' a > ) ;
560560
561561#[ cfg( feature = "alloc" ) ]
@@ -607,7 +607,7 @@ impl From<Vec<u8>> for CertificateRevocationListDer<'_> {
607607/// CertificateSigningRequestDer::from_pem_slice(byte_slice).unwrap();
608608/// # }
609609/// ```
610- #[ derive( Clone , Debug , PartialEq , Eq ) ]
610+ #[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
611611pub struct CertificateSigningRequestDer < ' a > ( Der < ' a > ) ;
612612
613613#[ cfg( feature = "alloc" ) ]
@@ -668,7 +668,7 @@ impl From<Vec<u8>> for CertificateSigningRequestDer<'_> {
668668/// assert_eq!(certs.len(), 3);
669669/// # }
670670/// ```
671- #[ derive( Clone , Debug , PartialEq , Eq ) ]
671+ #[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
672672pub struct CertificateDer < ' a > ( Der < ' a > ) ;
673673
674674impl < ' a > CertificateDer < ' a > {
@@ -738,7 +738,7 @@ pub type SubjectPublicKeyInfo<'a> = SubjectPublicKeyInfoDer<'a>;
738738/// SubjectPublicKeyInfoDer::from_pem_slice(byte_slice).unwrap();
739739/// # }
740740/// ```
741- #[ derive( Clone , Debug , PartialEq , Eq ) ]
741+ #[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
742742pub struct SubjectPublicKeyInfoDer < ' a > ( Der < ' a > ) ;
743743
744744#[ cfg( feature = "alloc" ) ]
@@ -783,7 +783,7 @@ impl SubjectPublicKeyInfoDer<'_> {
783783
784784/// A TLS-encoded Encrypted Client Hello (ECH) configuration list (`ECHConfigList`); as specified in
785785/// [draft-ietf-tls-esni-18 §4](https://datatracker.ietf.org/doc/html/draft-ietf-tls-esni-18#section-4)
786- #[ derive( Clone , Eq , PartialEq ) ]
786+ #[ derive( Clone , Eq , Hash , PartialEq ) ]
787787pub struct EchConfigListBytes < ' a > ( BytesInner < ' a > ) ;
788788
789789impl EchConfigListBytes < ' _ > {
@@ -936,7 +936,7 @@ pub struct InvalidSignature;
936936/// A timestamp, tracking the number of non-leap seconds since the Unix epoch.
937937///
938938/// The Unix epoch is defined January 1, 1970 00:00:00 UTC.
939- #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord ) ]
939+ #[ derive( Debug , Clone , Copy , Hash , PartialEq , Eq , PartialOrd , Ord ) ]
940940pub struct UnixTime ( u64 ) ;
941941
942942impl UnixTime {
@@ -974,7 +974,7 @@ impl UnixTime {
974974/// This wrapper type is used to represent DER-encoded data in a way that is agnostic to whether
975975/// the data is owned (by a `Vec<u8>`) or borrowed (by a `&[u8]`). Support for the owned
976976/// variant is only available when the `alloc` feature is enabled.
977- #[ derive( Clone , Eq , PartialEq ) ]
977+ #[ derive( Clone , Eq , Hash , PartialEq ) ]
978978pub struct Der < ' a > ( BytesInner < ' a > ) ;
979979
980980impl < ' a > Der < ' a > {
@@ -1054,6 +1054,12 @@ impl AsRef<[u8]> for BytesInner<'_> {
10541054 }
10551055}
10561056
1057+ impl core:: hash:: Hash for BytesInner < ' _ > {
1058+ fn hash < H : core:: hash:: Hasher > ( & self , state : & mut H ) {
1059+ state. write ( self . as_ref ( ) ) ;
1060+ }
1061+ }
1062+
10571063impl PartialEq for BytesInner < ' _ > {
10581064 fn eq ( & self , other : & Self ) -> bool {
10591065 self . as_ref ( ) == other. as_ref ( )
0 commit comments