File: validity-dates.lisp

package info (click to toggle)
acl2 8.5dfsg-5
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 991,452 kB
  • sloc: lisp: 15,567,759; javascript: 22,820; cpp: 13,929; ansic: 12,092; perl: 7,150; java: 4,405; xml: 3,884; makefile: 3,507; sh: 3,187; ruby: 2,633; ml: 763; python: 746; yacc: 723; awk: 295; csh: 186; php: 171; lex: 154; tcl: 49; asm: 23; haskell: 17
file content (28 lines) | stat: -rw-r--r-- 1,126 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
;;;; -*- Mode: LISP; Syntax: COMMON-LISP; indent-tabs-mode: nil; coding: utf-8; show-trailing-whitespace: t -*-

(in-package :cl+ssl.test)

(def-suite :cl+ssl.validity-dates :in :cl+ssl
  :description "Validity date tests")

(in-suite :cl+ssl.validity-dates)

(test validity-dates-google-cert
  (when (and (cl+ssl::openssl-is-at-least 1 1 0)
             (not  (cl+ssl::libresslp)))
    (with-cert ("google.der" cert)
      (is (= (cl+ssl:certificate-not-after-time cert)
             3641760000))
      (is (= (cl+ssl:certificate-not-before-time cert)
             3634055286)))))

(test validity-dates-after-2050
  "Make sure we handle dates after 2050, which are encoded in ASN1 as a
GeneralizedTime, whereas dates before 2050 are encoded as UTCTime."
  (when (and (cl+ssl::openssl-is-at-least 1 1 0)
             (not  (cl+ssl::libresslp)))
    (with-cert ("mixed-time-formats.der" cert)
      (is (= (cl+ssl:certificate-not-before-time cert)
             (encode-universal-time 04 25 11 20 11 2021 0)))
      (is (= (cl+ssl:certificate-not-after-time cert)
             (encode-universal-time 04 25 11 20 11 2071 0))))))