Use latest time encoding. #3

This commit is contained in:
Tim Bruijnzeels
2019-10-16 12:43:23 +02:00
parent 21e275852b
commit cb2fe0d194
3 changed files with 23 additions and 5 deletions
+3 -3
View File
@@ -357,7 +357,7 @@ impl SignedAttributes {
// attribute using the time that the SignedAttributes
// was created.
oid::SIGNING_TIME.encode(),
encode::set(self.signing_time.encode()),
encode::set(self.signing_time.encode_varied()),
)),
encode::sequence((
oid::MESSAGE_DIGEST.encode(),
@@ -492,8 +492,8 @@ impl SigMsgCrlBuilder {
name.encode_ref(),
),
(
just_now.encode(),
in_a_bit.encode(),
just_now.encode_varied(),
in_a_bit.encode_varied(),
// Real revocations go here
extensions,
),
+2 -2
View File
@@ -342,7 +342,7 @@ impl IdCert {
// Validity. Check according to RFC 5280.
self.validity.validate_at(now)?;
// Subject Key Identifer. Must be the SHA-1 hash of the octets
// Subject Key Identifier. Must be the SHA-1 hash of the octets
// of the subjectPublicKey.
if self.extensions.subject_key_id().as_slice().unwrap()
!= self.subject_public_key_info().key_identifier().as_ref()
@@ -574,7 +574,7 @@ pub mod tests {
}
#[test]
fn should_parse_id_publisher_ta_cert() {
fn parse_id_publisher_ta_cert() {
test_id_certificate()
.validate_ta_at(Time::utc(2012, 1, 1, 0, 0, 0))
.unwrap();
+18
View File
@@ -1378,3 +1378,21 @@ impl<S: Signer> CertAuth<S> {
Ok(res)
}
}
//------------ Tests ---------------------------------------------------------
#[cfg(test)]
mod tests {
use super::*;
use crate::commons::util::softsigner::OpenSslSigner;
use crate::commons::util::test;
#[test]
fn generate_id_cert() {
test::test_under_tmp(|d| {
let mut signer = OpenSslSigner::build(&d).unwrap();
let id = Rfc8183Id::generate(&mut signer).unwrap();
id.cert.validate_ta().unwrap();
});
}
}