2015-01-22 03:40:55 +00:00
|
|
|
/*
|
2016-05-17 18:51:26 +00:00
|
|
|
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
1999-02-17 23:21:01 +00:00
|
|
|
*
|
2016-05-17 18:51:26 +00: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-17 23:21:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2015-05-14 14:56:48 +00:00
|
|
|
#include "internal/cryptlib.h"
|
1999-04-23 22:13:45 +00:00
|
|
|
#include <openssl/asn1.h>
|
2000-12-08 19:09:35 +00:00
|
|
|
#include <openssl/asn1t.h>
|
1999-04-23 22:13:45 +00:00
|
|
|
#include <openssl/x509v3.h>
|
2015-09-05 12:32:58 +00:00
|
|
|
#include "ext_dat.h"
|
1999-02-17 23:21:01 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method,
|
|
|
|
PKEY_USAGE_PERIOD *usage, BIO *out,
|
|
|
|
int indent);
|
2017-02-28 14:55:35 +00:00
|
|
|
|
2007-01-21 13:07:17 +00:00
|
|
|
const X509V3_EXT_METHOD v3_pkey_usage_period = {
|
2015-01-22 03:40:55 +00: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-17 23:21:01 +00:00
|
|
|
};
|
|
|
|
|
2000-12-08 19:09:35 +00:00
|
|
|
ASN1_SEQUENCE(PKEY_USAGE_PERIOD) = {
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_IMP_OPT(PKEY_USAGE_PERIOD, notBefore, ASN1_GENERALIZEDTIME, 0),
|
|
|
|
ASN1_IMP_OPT(PKEY_USAGE_PERIOD, notAfter, ASN1_GENERALIZEDTIME, 1)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(PKEY_USAGE_PERIOD)
|
1999-02-17 23:21:01 +00:00
|
|
|
|
2000-12-08 19:09:35 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD)
|
1999-02-17 23:21:01 +00:00
|
|
|
|
1999-04-19 21:31:43 +00:00
|
|
|
static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method,
|
2015-01-22 03:40:55 +00:00
|
|
|
PKEY_USAGE_PERIOD *usage, BIO *out,
|
|
|
|
int indent)
|
1999-02-17 23:21:01 +00:00
|
|
|
{
|
2015-01-22 03:40:55 +00: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-17 23:21:01 +00:00
|
|
|
}
|