2015-01-22 11:40:55 +08:00
|
|
|
/*
|
2016-05-18 02:51:26 +08:00
|
|
|
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
1999-02-18 07:21:01 +08:00
|
|
|
*
|
2016-05-18 02:51:26 +08:00
|
|
|
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
1999-02-18 07:21:01 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2015-05-14 22:56:48 +08:00
|
|
|
#include "internal/cryptlib.h"
|
1999-04-24 06:13:45 +08:00
|
|
|
#include <openssl/asn1.h>
|
2000-12-09 03:09:35 +08:00
|
|
|
#include <openssl/asn1t.h>
|
1999-04-24 06:13:45 +08:00
|
|
|
#include <openssl/x509v3.h>
|
2015-09-05 20:32:58 +08:00
|
|
|
#include "ext_dat.h"
|
1999-02-18 07:21:01 +08:00
|
|
|
|
2015-01-22 11:40:55 +08:00
|
|
|
static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method,
|
|
|
|
PKEY_USAGE_PERIOD *usage, BIO *out,
|
|
|
|
int indent);
|
2017-02-28 22:55:35 +08:00
|
|
|
|
2007-01-21 21:07:17 +08:00
|
|
|
const X509V3_EXT_METHOD v3_pkey_usage_period = {
|
2015-01-22 11:40:55 +08:00
|
|
|
NID_private_key_usage_period, 0, ASN1_ITEM_ref(PKEY_USAGE_PERIOD),
|
|
|
|
0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
(X509V3_EXT_I2R)i2r_PKEY_USAGE_PERIOD, NULL,
|
|
|
|
NULL
|
1999-02-18 07:21:01 +08:00
|
|
|
};
|
|
|
|
|
2000-12-09 03:09:35 +08:00
|
|
|
ASN1_SEQUENCE(PKEY_USAGE_PERIOD) = {
|
2015-01-22 11:40:55 +08:00
|
|
|
ASN1_IMP_OPT(PKEY_USAGE_PERIOD, notBefore, ASN1_GENERALIZEDTIME, 0),
|
|
|
|
ASN1_IMP_OPT(PKEY_USAGE_PERIOD, notAfter, ASN1_GENERALIZEDTIME, 1)
|
2001-02-23 20:47:06 +08:00
|
|
|
} ASN1_SEQUENCE_END(PKEY_USAGE_PERIOD)
|
1999-02-18 07:21:01 +08:00
|
|
|
|
2000-12-09 03:09:35 +08:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD)
|
1999-02-18 07:21:01 +08:00
|
|
|
|
1999-04-20 05:31:43 +08:00
|
|
|
static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method,
|
2015-01-22 11:40:55 +08:00
|
|
|
PKEY_USAGE_PERIOD *usage, BIO *out,
|
|
|
|
int indent)
|
1999-02-18 07:21:01 +08:00
|
|
|
{
|
2015-01-22 11:40:55 +08:00
|
|
|
BIO_printf(out, "%*s", indent, "");
|
|
|
|
if (usage->notBefore) {
|
|
|
|
BIO_write(out, "Not Before: ", 12);
|
|
|
|
ASN1_GENERALIZEDTIME_print(out, usage->notBefore);
|
|
|
|
if (usage->notAfter)
|
|
|
|
BIO_write(out, ", ", 2);
|
|
|
|
}
|
|
|
|
if (usage->notAfter) {
|
|
|
|
BIO_write(out, "Not After: ", 11);
|
|
|
|
ASN1_GENERALIZEDTIME_print(out, usage->notAfter);
|
|
|
|
}
|
|
|
|
return 1;
|
1999-02-18 07:21:01 +08:00
|
|
|
}
|