]>
Commit | Line | Data |
---|---|---|
0f113f3e | 1 | /* |
3c2bdd7d | 2 | * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. |
3d8accc3 | 3 | * |
4286ca47 | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
d2e9e320 RS |
5 | * this file except in compliance with the License. You can obtain a copy |
6 | * in the file LICENSE in the source distribution or at | |
7 | * https://www.openssl.org/source/license.html | |
3d8accc3 DSH |
8 | */ |
9 | ||
10 | #include <stdio.h> | |
b39fc560 | 11 | #include "internal/cryptlib.h" |
ec577822 | 12 | #include <openssl/asn1.h> |
9d6b1ce6 | 13 | #include <openssl/asn1t.h> |
ec577822 | 14 | #include <openssl/x509v3.h> |
df2ee0e2 | 15 | #include "ext_dat.h" |
3d8accc3 | 16 | |
0f113f3e MC |
17 | static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method, |
18 | PKEY_USAGE_PERIOD *usage, BIO *out, | |
19 | int indent); | |
7f517c26 | 20 | |
47864aea | 21 | const X509V3_EXT_METHOD ossl_v3_pkey_usage_period = { |
0f113f3e MC |
22 | NID_private_key_usage_period, 0, ASN1_ITEM_ref(PKEY_USAGE_PERIOD), |
23 | 0, 0, 0, 0, | |
24 | 0, 0, 0, 0, | |
25 | (X509V3_EXT_I2R)i2r_PKEY_USAGE_PERIOD, NULL, | |
26 | NULL | |
3d8accc3 DSH |
27 | }; |
28 | ||
9d6b1ce6 | 29 | ASN1_SEQUENCE(PKEY_USAGE_PERIOD) = { |
0f113f3e MC |
30 | ASN1_IMP_OPT(PKEY_USAGE_PERIOD, notBefore, ASN1_GENERALIZEDTIME, 0), |
31 | ASN1_IMP_OPT(PKEY_USAGE_PERIOD, notAfter, ASN1_GENERALIZEDTIME, 1) | |
d339187b | 32 | } ASN1_SEQUENCE_END(PKEY_USAGE_PERIOD) |
3d8accc3 | 33 | |
9d6b1ce6 | 34 | IMPLEMENT_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) |
3d8accc3 | 35 | |
6b691a5c | 36 | static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method, |
0f113f3e MC |
37 | PKEY_USAGE_PERIOD *usage, BIO *out, |
38 | int indent) | |
3d8accc3 | 39 | { |
0f113f3e MC |
40 | BIO_printf(out, "%*s", indent, ""); |
41 | if (usage->notBefore) { | |
42 | BIO_write(out, "Not Before: ", 12); | |
43 | ASN1_GENERALIZEDTIME_print(out, usage->notBefore); | |
44 | if (usage->notAfter) | |
45 | BIO_write(out, ", ", 2); | |
46 | } | |
47 | if (usage->notAfter) { | |
48 | BIO_write(out, "Not After: ", 11); | |
49 | ASN1_GENERALIZEDTIME_print(out, usage->notAfter); | |
50 | } | |
51 | return 1; | |
3d8accc3 | 52 | } |