File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -220,7 +220,18 @@ impl CertificateMetadata {
220220 /// Returns the set of trust bits expressed for this certificate. Panics if the raw
221221 /// trust bits are invalid/unknown.
222222 fn trust_bits ( & self ) -> HashSet < TrustBits > {
223- self . trust_bits . split ( ';' ) . map ( TrustBits :: from) . collect ( )
223+ let bits = self
224+ . trust_bits
225+ . split ( ';' )
226+ . map ( TrustBits :: from)
227+ . collect :: < HashSet < _ > > ( ) ;
228+ if bits. contains ( & TrustBits :: AllTrustBitsTurnedOff ) && bits. len ( ) > 1 {
229+ panic ! (
230+ "unexpected trust bits: AllTrustBitsTurnedOff \
231+ is mutually exclusive (found {bits:?})"
232+ ) ;
233+ }
234+ bits
224235 }
225236
226237 /// Returns the PEM metadata for the certificate with the leading/trailing single quotes
@@ -252,6 +263,8 @@ pub enum TrustBits {
252263 Email ,
253264 /// certificate is trusted for code signing
254265 Code ,
266+ /// certificate is not trusted for anything
267+ AllTrustBitsTurnedOff ,
255268}
256269
257270impl From < & str > for TrustBits {
@@ -260,6 +273,7 @@ impl From<&str> for TrustBits {
260273 "Websites" => TrustBits :: Websites ,
261274 "Email" => TrustBits :: Email ,
262275 "Code" => TrustBits :: Code ,
276+ "All Trust Bits Turned Off" => TrustBits :: AllTrustBitsTurnedOff ,
263277 val => panic ! ( "unknown trust bit: {val:?}" ) ,
264278 }
265279 }
You can’t perform that action at this time.
0 commit comments