|
10 | 10 | //! - Loading certificates from files, directories, and bytes |
11 | 11 |
|
12 | 12 | use alloc::sync::Arc; |
13 | | -use chrono::{DateTime, Utc}; |
| 13 | +use jiff::{Timestamp, Zoned, tz::TimeZone}; |
14 | 14 | use parking_lot::RwLock as ParkingRwLock; |
15 | 15 | use rustls::{ |
16 | 16 | DigitallySignedStruct, RootCertStore, SignatureScheme, |
@@ -201,10 +201,10 @@ fn format_ip_address(ip: &[u8]) -> String { |
201 | 201 | /// Formats certificate validity dates in the format: |
202 | 202 | /// "Mon DD HH:MM:SS YYYY GMT" |
203 | 203 | fn format_asn1_time(time: &x509_parser::time::ASN1Time) -> String { |
204 | | - let timestamp = time.timestamp(); |
205 | | - DateTime::<Utc>::from_timestamp(timestamp, 0) |
206 | | - .expect("ASN1Time must be valid timestamp") |
207 | | - .format("%b %e %H:%M:%S %Y GMT") |
| 204 | + let timestamp = |
| 205 | + Timestamp::from_second(time.timestamp()).expect("ASN1Time must be valid timestamp"); |
| 206 | + Zoned::new(timestamp, TimeZone::UTC) |
| 207 | + .strftime("%b %e %H:%M:%S %Y GMT") |
208 | 208 | .to_string() |
209 | 209 | } |
210 | 210 |
|
@@ -341,7 +341,7 @@ pub(super) fn cert_to_dict( |
341 | 341 | let serial = format_serial_number(&cert.serial); |
342 | 342 | dict.set_item("serialNumber", vm.ctx.new_str(serial).into(), vm)?; |
343 | 343 |
|
344 | | - // Validity dates - format with GMT using chrono |
| 344 | + // Validity dates - format with GMT using jiff |
345 | 345 | dict.set_item( |
346 | 346 | "notBefore", |
347 | 347 | vm.ctx |
@@ -414,7 +414,7 @@ pub(super) fn cert_der_to_dict_helper( |
414 | 414 | // CPython ordering: issuer, notAfter, notBefore, serialNumber, subject, version |
415 | 415 | dict.set_item("issuer", name_to_tuple(cert.issuer())?, vm)?; |
416 | 416 |
|
417 | | - // Validity - format with GMT using chrono |
| 417 | + // Validity - format with GMT using jiff |
418 | 418 | dict.set_item( |
419 | 419 | "notAfter", |
420 | 420 | vm.ctx |
|
0 commit comments