@@ -126,6 +126,7 @@ pub struct RevocationCheckInput {
126126 pub issuer_spki_hash : IssuerSpkiHash ,
127127 /// CT log IDs and inclusion timestamps present in the end-entity certificate.
128128 pub sct_timestamps : Vec < CtTimestamp > ,
129+ issuer_serial_hash : [ u8 ; 32 ] ,
129130}
130131
131132impl RevocationCheckInput {
@@ -151,7 +152,7 @@ impl RevocationCheckInput {
151152 digest:: digest ( & digest:: SHA256 , & webpki:: spki_for_anchor ( & issuer) )
152153 . as_ref ( )
153154 . try_into ( )
154- . expect ( "sha256 output must be [u8;32]" ) ,
155+ . expect ( "sha256 output must be [u8; 32]" ) ,
155156 ) ;
156157
157158 let mut sct_timestamps = vec ! [ ] ;
@@ -167,15 +168,42 @@ impl RevocationCheckInput {
167168 } ) ;
168169 }
169170
170- Ok ( Self {
171- cert_serial : CertSerial ( end_entity. serial ( ) . into ( ) ) ,
171+ Ok ( Self :: new (
172+ CertSerial ( end_entity. serial ( ) . to_vec ( ) ) ,
172173 issuer_spki_hash,
173174 sct_timestamps,
174- } )
175+ ) )
176+ }
177+
178+ /// Construct a `RevocationCheckInput` from its constituent parts.
179+ pub fn new (
180+ cert_serial : CertSerial ,
181+ issuer_spki_hash : IssuerSpkiHash ,
182+ sct_timestamps : Vec < CtTimestamp > ,
183+ ) -> Self {
184+ let mut issuer_serial_context = digest:: Context :: new ( & digest:: SHA256 ) ;
185+ issuer_serial_context. update ( & cert_serial. 0 ) ;
186+ issuer_serial_context. update ( & issuer_spki_hash. 0 ) ;
187+ let issuer_serial_hash = issuer_serial_context
188+ . finish ( )
189+ . as_ref ( )
190+ . try_into ( )
191+ . expect ( "sha256 output must be [u8; 32]" ) ;
192+
193+ Self {
194+ cert_serial,
195+ issuer_spki_hash,
196+ sct_timestamps,
197+ issuer_serial_hash,
198+ }
175199 }
176200
177201 fn key ( & self ) -> CRLiteKey < ' _ > {
178- CRLiteKey :: new ( & self . issuer_spki_hash , & self . cert_serial . 0 )
202+ CRLiteKey :: with_hash (
203+ & self . issuer_spki_hash ,
204+ & self . cert_serial . 0 ,
205+ self . issuer_serial_hash ,
206+ )
179207 }
180208}
181209
0 commit comments