2011-08-25 23:41:19 +04:00
|
|
|
/* asn.h
|
2011-02-05 22:14:47 +03:00
|
|
|
*
|
2014-04-12 01:58:58 +04:00
|
|
|
* Copyright (C) 2006-2014 wolfSSL Inc.
|
2011-02-05 22:14:47 +03:00
|
|
|
*
|
|
|
|
* This file is part of CyaSSL.
|
|
|
|
*
|
|
|
|
* CyaSSL is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* CyaSSL is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2014-04-12 01:58:58 +04:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2011-02-05 22:14:47 +03:00
|
|
|
*/
|
|
|
|
|
2012-11-02 02:03:29 +04:00
|
|
|
#ifndef NO_ASN
|
2011-02-05 22:14:47 +03:00
|
|
|
|
|
|
|
#ifndef CTAO_CRYPT_ASN_H
|
|
|
|
#define CTAO_CRYPT_ASN_H
|
|
|
|
|
2011-08-25 23:41:19 +04:00
|
|
|
#include <cyassl/ctaocrypt/types.h>
|
|
|
|
#include <cyassl/ctaocrypt/rsa.h>
|
|
|
|
#include <cyassl/ctaocrypt/dh.h>
|
|
|
|
#include <cyassl/ctaocrypt/dsa.h>
|
|
|
|
#include <cyassl/ctaocrypt/sha.h>
|
2012-05-17 04:04:56 +04:00
|
|
|
#include <cyassl/ctaocrypt/md5.h>
|
2011-08-25 23:41:19 +04:00
|
|
|
#include <cyassl/ctaocrypt/asn_public.h> /* public interface */
|
2011-02-05 22:14:47 +03:00
|
|
|
#ifdef HAVE_ECC
|
2011-08-25 23:41:19 +04:00
|
|
|
#include <cyassl/ctaocrypt/ecc.h>
|
2011-02-05 22:14:47 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ISSUER = 0,
|
|
|
|
SUBJECT = 1,
|
|
|
|
|
2011-04-11 23:55:17 +04:00
|
|
|
EXTERNAL_SERIAL_SIZE = 32,
|
2011-03-12 02:22:16 +03:00
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
BEFORE = 0,
|
|
|
|
AFTER = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ASN Tags */
|
|
|
|
enum ASN_Tags {
|
2011-11-03 01:57:14 +04:00
|
|
|
ASN_BOOLEAN = 0x01,
|
2011-02-05 22:14:47 +03:00
|
|
|
ASN_INTEGER = 0x02,
|
|
|
|
ASN_BIT_STRING = 0x03,
|
|
|
|
ASN_OCTET_STRING = 0x04,
|
|
|
|
ASN_TAG_NULL = 0x05,
|
|
|
|
ASN_OBJECT_ID = 0x06,
|
2012-04-27 00:52:48 +04:00
|
|
|
ASN_ENUMERATED = 0x0a,
|
2014-01-10 02:17:55 +04:00
|
|
|
ASN_UTF8STRING = 0x0c,
|
2011-02-05 22:14:47 +03:00
|
|
|
ASN_SEQUENCE = 0x10,
|
|
|
|
ASN_SET = 0x11,
|
|
|
|
ASN_UTC_TIME = 0x17,
|
2013-06-26 03:26:53 +04:00
|
|
|
ASN_OTHER_TYPE = 0x00,
|
2014-04-28 22:03:24 +04:00
|
|
|
ASN_RFC822_TYPE = 0x01,
|
2012-08-01 04:45:48 +04:00
|
|
|
ASN_DNS_TYPE = 0x02,
|
2014-04-29 00:29:44 +04:00
|
|
|
ASN_DIR_TYPE = 0x04,
|
2011-02-05 22:14:47 +03:00
|
|
|
ASN_GENERALIZED_TIME = 0x18,
|
2012-05-18 21:52:32 +04:00
|
|
|
CRL_EXTENSIONS = 0xa0,
|
2011-10-08 03:50:32 +04:00
|
|
|
ASN_EXTENSIONS = 0xa3,
|
2011-02-05 22:14:47 +03:00
|
|
|
ASN_LONG_LENGTH = 0x80
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ASN_Flags{
|
|
|
|
ASN_CONSTRUCTED = 0x20,
|
|
|
|
ASN_CONTEXT_SPECIFIC = 0x80
|
|
|
|
};
|
|
|
|
|
|
|
|
enum DN_Tags {
|
|
|
|
ASN_COMMON_NAME = 0x03, /* CN */
|
|
|
|
ASN_SUR_NAME = 0x04, /* SN */
|
2013-09-16 09:10:58 +04:00
|
|
|
ASN_SERIAL_NUMBER = 0x05, /* serialNumber */
|
2011-02-05 22:14:47 +03:00
|
|
|
ASN_COUNTRY_NAME = 0x06, /* C */
|
|
|
|
ASN_LOCALITY_NAME = 0x07, /* L */
|
|
|
|
ASN_STATE_NAME = 0x08, /* ST */
|
|
|
|
ASN_ORG_NAME = 0x0a, /* O */
|
|
|
|
ASN_ORGUNIT_NAME = 0x0b /* OU */
|
|
|
|
};
|
|
|
|
|
2011-03-22 17:35:18 +03:00
|
|
|
enum PBES {
|
2011-04-14 21:04:24 +04:00
|
|
|
PBE_MD5_DES = 0,
|
|
|
|
PBE_SHA1_DES = 1,
|
|
|
|
PBE_SHA1_DES3 = 2,
|
|
|
|
PBE_SHA1_RC4_128 = 3,
|
|
|
|
PBES2 = 13 /* algo ID */
|
2011-03-22 17:35:18 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
enum ENCRYPTION_TYPES {
|
2011-04-14 21:04:24 +04:00
|
|
|
DES_TYPE = 0,
|
|
|
|
DES3_TYPE = 1,
|
|
|
|
RC4_TYPE = 2
|
2011-03-22 17:35:18 +03:00
|
|
|
};
|
|
|
|
|
2011-12-02 01:10:01 +04:00
|
|
|
enum ECC_TYPES {
|
|
|
|
ECC_PREFIX_0 = 160,
|
|
|
|
ECC_PREFIX_1 = 161
|
|
|
|
};
|
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
enum Misc_ASN {
|
2011-03-22 17:35:18 +03:00
|
|
|
ASN_NAME_MAX = 256,
|
|
|
|
MAX_SALT_SIZE = 64, /* MAX PKCS Salt length */
|
2011-04-14 21:04:24 +04:00
|
|
|
MAX_IV_SIZE = 64, /* MAX PKCS Iv length */
|
2011-03-22 17:35:18 +03:00
|
|
|
MAX_KEY_SIZE = 64, /* MAX PKCS Key length */
|
|
|
|
PKCS5 = 5, /* PKCS oid tag */
|
2011-04-14 21:04:24 +04:00
|
|
|
PKCS5v2 = 6, /* PKCS #5 v2.0 */
|
|
|
|
PKCS12 = 12, /* PKCS #12 */
|
|
|
|
MAX_UNICODE_SZ = 256,
|
2011-12-07 03:17:10 +04:00
|
|
|
ASN_BOOL_SIZE = 2, /* including type */
|
2014-09-08 22:33:06 +04:00
|
|
|
ASN_ECC_HEADER_SZ = 2, /* String type + 1 byte len */
|
|
|
|
ASN_ECC_CONTEXT_SZ = 2, /* Content specific type + 1 byte len */
|
2011-02-05 22:14:47 +03:00
|
|
|
SHA_SIZE = 20,
|
|
|
|
RSA_INTS = 8, /* RSA ints in private key */
|
|
|
|
MIN_DATE_SIZE = 13,
|
|
|
|
MAX_DATE_SIZE = 32,
|
|
|
|
ASN_GEN_TIME_SZ = 15, /* 7 numbers * 2 + Zulu tag */
|
|
|
|
MAX_ENCODED_SIG_SZ = 512,
|
|
|
|
MAX_SIG_SZ = 256,
|
|
|
|
MAX_ALGO_SZ = 20,
|
|
|
|
MAX_SEQ_SZ = 5, /* enum(seq | con) + length(4) */
|
|
|
|
MAX_SET_SZ = 5, /* enum(set | con) + length(4) */
|
2014-01-11 03:13:56 +04:00
|
|
|
MAX_OCTET_STR_SZ = 5, /* enum(set | con) + length(4) */
|
2014-01-16 00:31:51 +04:00
|
|
|
MAX_EXP_SZ = 5, /* enum(contextspec|con|exp) + length(4) */
|
2014-01-10 02:17:55 +04:00
|
|
|
MAX_PRSTR_SZ = 5, /* enum(prstr) + length(4) */
|
2011-02-05 22:14:47 +03:00
|
|
|
MAX_VERSION_SZ = 5, /* enum + id + version(byte) + (header(2))*/
|
2011-04-08 22:00:38 +04:00
|
|
|
MAX_ENCODED_DIG_SZ = 73, /* sha512 + enum(bit or octet) + legnth(4) */
|
2011-02-05 22:14:47 +03:00
|
|
|
MAX_RSA_INT_SZ = 517, /* RSA raw sz 4096 for bits + tag + len(4) */
|
|
|
|
MAX_NTRU_KEY_SZ = 610, /* NTRU 112 bit public key */
|
|
|
|
MAX_NTRU_ENC_SZ = 628, /* NTRU 112 bit DER public encoding */
|
2011-09-07 04:30:57 +04:00
|
|
|
MAX_LENGTH_SZ = 4, /* Max length size for DER encoding */
|
2011-02-05 22:14:47 +03:00
|
|
|
MAX_RSA_E_SZ = 16, /* Max RSA public e size */
|
2011-09-07 04:30:57 +04:00
|
|
|
MAX_CA_SZ = 32, /* Max encoded CA basic constraint length */
|
2012-05-09 06:02:25 +04:00
|
|
|
MAX_SN_SZ = 35, /* Max encoded serial number (INT) length */
|
2011-10-08 03:50:32 +04:00
|
|
|
#ifdef CYASSL_CERT_GEN
|
2014-01-09 04:26:42 +04:00
|
|
|
#ifdef CYASSL_CERT_REQ
|
2014-01-10 02:17:55 +04:00
|
|
|
/* Max encoded cert req attributes length */
|
|
|
|
MAX_ATTRIB_SZ = MAX_SEQ_SZ * 3 + (11 + MAX_SEQ_SZ) * 2 +
|
|
|
|
MAX_PRSTR_SZ + CTC_NAME_SIZE, /* 11 is the OID size */
|
2014-01-09 04:26:42 +04:00
|
|
|
#endif
|
2012-04-05 23:48:28 +04:00
|
|
|
#ifdef CYASSL_ALT_NAMES
|
|
|
|
MAX_EXTENSIONS_SZ = 1 + MAX_LENGTH_SZ + CTC_MAX_ALT_SIZE,
|
|
|
|
#else
|
|
|
|
MAX_EXTENSIONS_SZ = 1 + MAX_LENGTH_SZ + MAX_CA_SZ,
|
|
|
|
#endif
|
2011-09-07 04:30:57 +04:00
|
|
|
/* Max total extensions, id + len + others */
|
2011-10-08 03:50:32 +04:00
|
|
|
#endif
|
2012-05-18 21:18:56 +04:00
|
|
|
MAX_OCSP_EXT_SZ = 58, /* Max OCSP Extension length */
|
|
|
|
MAX_OCSP_NONCE_SZ = 18, /* OCSP Nonce size */
|
2012-10-31 04:35:12 +04:00
|
|
|
EIGHTK_BUF = 8192, /* Tmp buffer size */
|
2011-09-07 04:30:57 +04:00
|
|
|
MAX_PUBLIC_KEY_SZ = MAX_NTRU_ENC_SZ + MAX_ALGO_SZ + MAX_SEQ_SZ * 2
|
2011-02-05 22:14:47 +03:00
|
|
|
/* use bigger NTRU size */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum Oid_Types {
|
2013-11-15 08:34:39 +04:00
|
|
|
hashType = 0,
|
|
|
|
sigType = 1,
|
|
|
|
keyType = 2,
|
2014-01-11 03:13:56 +04:00
|
|
|
curveType = 3,
|
|
|
|
blkType = 4
|
2011-02-05 22:14:47 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum Hash_Sum {
|
2011-04-08 22:00:38 +04:00
|
|
|
MD2h = 646,
|
|
|
|
MD5h = 649,
|
|
|
|
SHAh = 88,
|
2012-04-28 00:49:35 +04:00
|
|
|
SHA256h = 414,
|
|
|
|
SHA384h = 415,
|
|
|
|
SHA512h = 416
|
2011-02-05 22:14:47 +03:00
|
|
|
};
|
|
|
|
|
2011-10-27 00:23:03 +04:00
|
|
|
|
2014-01-11 03:13:56 +04:00
|
|
|
enum Block_Sum {
|
|
|
|
DESb = 69,
|
|
|
|
DES3b = 652
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
enum Key_Sum {
|
|
|
|
DSAk = 515,
|
|
|
|
RSAk = 645,
|
2014-06-06 00:42:15 +04:00
|
|
|
NTRUk = 274,
|
2011-02-05 22:14:47 +03:00
|
|
|
ECDSAk = 518
|
|
|
|
};
|
|
|
|
|
2011-10-27 00:23:03 +04:00
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
enum Ecc_Sum {
|
|
|
|
ECC_256R1 = 526,
|
|
|
|
ECC_384R1 = 210,
|
|
|
|
ECC_521R1 = 211,
|
|
|
|
ECC_160R1 = 184,
|
|
|
|
ECC_192R1 = 520,
|
|
|
|
ECC_224R1 = 209
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-04-14 21:04:24 +04:00
|
|
|
enum KDF_Sum {
|
|
|
|
PBKDF2_OID = 660
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-10-08 03:50:32 +04:00
|
|
|
enum Extensions_Sum {
|
2013-06-26 03:26:53 +04:00
|
|
|
BASIC_CA_OID = 133,
|
|
|
|
ALT_NAMES_OID = 131,
|
|
|
|
CRL_DIST_OID = 145,
|
|
|
|
AUTH_INFO_OID = 69,
|
|
|
|
CA_ISSUER_OID = 117,
|
|
|
|
AUTH_KEY_OID = 149,
|
|
|
|
SUBJ_KEY_OID = 128,
|
2013-11-20 02:44:55 +04:00
|
|
|
CERT_POLICY_OID = 146,
|
2014-03-15 02:48:33 +04:00
|
|
|
KEY_USAGE_OID = 129, /* 2.5.29.15 */
|
|
|
|
INHIBIT_ANY_OID = 168, /* 2.5.29.54 */
|
|
|
|
EXT_KEY_USAGE_OID = 151, /* 2.5.29.37 */
|
2014-04-28 22:03:24 +04:00
|
|
|
NAME_CONS_OID = 144 /* 2.5.29.30 */
|
2013-06-26 03:26:53 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum CertificatePolicy_Sum {
|
|
|
|
CP_ANY_OID = 146 /* id-ce 32 0 */
|
|
|
|
};
|
|
|
|
|
|
|
|
enum SepHardwareName_Sum {
|
|
|
|
HW_NAME_OID = 79 /* 1.3.6.1.5.5.7.8.4 from RFC 4108*/
|
2011-10-08 03:50:32 +04:00
|
|
|
};
|
|
|
|
|
2014-02-04 02:39:41 +04:00
|
|
|
enum AuthInfo_Sum {
|
|
|
|
AIA_OCSP_OID = 116, /* 1.3.6.1.5.5.7.48.1 */
|
|
|
|
AIA_CA_ISSUER_OID = 117 /* 1.3.6.1.5.5.7.48.2 */
|
|
|
|
};
|
|
|
|
|
2014-03-20 21:07:47 +04:00
|
|
|
enum ExtKeyUsage_Sum { /* From RFC 5280 */
|
|
|
|
EKU_ANY_OID = 151, /* 2.5.29.37.0, anyExtendedKeyUsage */
|
|
|
|
EKU_SERVER_AUTH_OID = 71, /* 1.3.6.1.5.5.7.3.1, id-kp-serverAuth */
|
|
|
|
EKU_CLIENT_AUTH_OID = 72, /* 1.3.6.1.5.5.7.3.2, id-kp-clientAuth */
|
2014-05-09 02:50:55 +04:00
|
|
|
EKU_OCSP_SIGN_OID = 79 /* 1.3.6.1.5.5.7.3.9, OCSPSigning */
|
2014-03-20 21:07:47 +04:00
|
|
|
};
|
|
|
|
|
2011-10-08 03:50:32 +04:00
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
enum VerifyType {
|
|
|
|
NO_VERIFY = 0,
|
|
|
|
VERIFY = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-11-20 02:44:55 +04:00
|
|
|
/* Key usage extension bits */
|
|
|
|
#define KEYUSE_DIGITAL_SIG 0x0100
|
|
|
|
#define KEYUSE_CONTENT_COMMIT 0x0080
|
|
|
|
#define KEYUSE_KEY_ENCIPHER 0x0040
|
|
|
|
#define KEYUSE_DATA_ENCIPHER 0x0020
|
|
|
|
#define KEYUSE_KEY_AGREE 0x0010
|
|
|
|
#define KEYUSE_KEY_CERT_SIGN 0x0008
|
|
|
|
#define KEYUSE_CRL_SIGN 0x0004
|
|
|
|
#define KEYUSE_ENCIPHER_ONLY 0x0002
|
|
|
|
#define KEYUSE_DECIPHER_ONLY 0x0001
|
|
|
|
|
2014-03-21 20:37:10 +04:00
|
|
|
#define EXTKEYUSE_ANY 0x08
|
2014-03-20 21:07:47 +04:00
|
|
|
#define EXTKEYUSE_OCSP_SIGN 0x04
|
|
|
|
#define EXTKEYUSE_CLIENT_AUTH 0x02
|
|
|
|
#define EXTKEYUSE_SERVER_AUTH 0x01
|
2013-11-20 02:44:55 +04:00
|
|
|
|
2012-08-01 04:45:48 +04:00
|
|
|
typedef struct DNS_entry DNS_entry;
|
|
|
|
|
|
|
|
struct DNS_entry {
|
|
|
|
DNS_entry* next; /* next on DNS list */
|
|
|
|
char* name; /* actual DNS name */
|
|
|
|
};
|
|
|
|
|
2013-10-18 01:31:20 +04:00
|
|
|
|
2014-04-28 22:03:24 +04:00
|
|
|
typedef struct Base_entry Base_entry;
|
|
|
|
|
|
|
|
struct Base_entry {
|
|
|
|
Base_entry* next; /* next on name base list */
|
|
|
|
char* name; /* actual name base */
|
2014-04-29 00:29:44 +04:00
|
|
|
int nameSz; /* name length */
|
2014-04-28 22:03:24 +04:00
|
|
|
byte type; /* Name base type (DNS or RFC822) */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-10-18 01:31:20 +04:00
|
|
|
struct DecodedName {
|
|
|
|
char* fullName;
|
|
|
|
int fullNameLen;
|
|
|
|
int entryCount;
|
|
|
|
int cnIdx;
|
|
|
|
int cnLen;
|
|
|
|
int snIdx;
|
|
|
|
int snLen;
|
|
|
|
int cIdx;
|
|
|
|
int cLen;
|
|
|
|
int lIdx;
|
|
|
|
int lLen;
|
|
|
|
int stIdx;
|
|
|
|
int stLen;
|
|
|
|
int oIdx;
|
|
|
|
int oLen;
|
|
|
|
int ouIdx;
|
|
|
|
int ouLen;
|
|
|
|
int emailIdx;
|
|
|
|
int emailLen;
|
|
|
|
int uidIdx;
|
|
|
|
int uidLen;
|
|
|
|
int serialIdx;
|
|
|
|
int serialLen;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-06-04 00:01:45 +04:00
|
|
|
typedef struct DecodedCert DecodedCert;
|
2013-10-18 01:31:20 +04:00
|
|
|
typedef struct DecodedName DecodedName;
|
2011-06-04 00:01:45 +04:00
|
|
|
typedef struct Signer Signer;
|
|
|
|
|
|
|
|
|
2011-06-03 02:43:27 +04:00
|
|
|
struct DecodedCert {
|
2011-02-05 22:14:47 +03:00
|
|
|
byte* publicKey;
|
|
|
|
word32 pubKeySize;
|
|
|
|
int pubKeyStored;
|
|
|
|
word32 certBegin; /* offset to start of cert */
|
|
|
|
word32 sigIndex; /* offset to start of signature */
|
|
|
|
word32 sigLength; /* length of signature */
|
|
|
|
word32 signatureOID; /* sum of algorithm object id */
|
|
|
|
word32 keyOID; /* sum of key algo object id */
|
2013-10-18 01:31:20 +04:00
|
|
|
int version; /* cert version, 1 or 3 */
|
2012-08-01 04:45:48 +04:00
|
|
|
DNS_entry* altNames; /* alt names list of dns entries */
|
2014-04-28 22:03:24 +04:00
|
|
|
#ifndef IGNORE_NAME_CONSTRAINTS
|
|
|
|
DNS_entry* altEmailNames; /* alt names list of RFC822 entries */
|
|
|
|
Base_entry* permittedNames; /* Permitted name bases */
|
|
|
|
Base_entry* excludedNames; /* Excluded name bases */
|
|
|
|
#endif /* IGNORE_NAME_CONSTRAINTS */
|
2011-02-05 22:14:47 +03:00
|
|
|
byte subjectHash[SHA_SIZE]; /* hash of all Names */
|
|
|
|
byte issuerHash[SHA_SIZE]; /* hash of all Names */
|
2012-05-09 02:12:33 +04:00
|
|
|
#ifdef HAVE_OCSP
|
|
|
|
byte issuerKeyHash[SHA_SIZE]; /* hash of the public Key */
|
|
|
|
#endif /* HAVE_OCSP */
|
2011-02-05 22:14:47 +03:00
|
|
|
byte* signature; /* not owned, points into raw cert */
|
|
|
|
char* subjectCN; /* CommonName */
|
2014-05-23 18:42:37 +04:00
|
|
|
int subjectCNLen; /* CommonName Length */
|
|
|
|
char subjectCNEnc; /* CommonName Encoding */
|
2012-07-28 03:51:46 +04:00
|
|
|
int subjectCNStored; /* have we saved a copy we own */
|
2011-02-05 22:14:47 +03:00
|
|
|
char issuer[ASN_NAME_MAX]; /* full name including common name */
|
|
|
|
char subject[ASN_NAME_MAX]; /* full name including common name */
|
|
|
|
int verify; /* Default to yes, but could be off */
|
|
|
|
byte* source; /* byte buffer holder cert, NOT owner */
|
|
|
|
word32 srcIdx; /* current offset into buffer */
|
2011-06-16 22:46:45 +04:00
|
|
|
word32 maxIdx; /* max offset based on init size */
|
2011-02-05 22:14:47 +03:00
|
|
|
void* heap; /* for user memory overrides */
|
2011-04-11 23:55:17 +04:00
|
|
|
byte serial[EXTERNAL_SERIAL_SIZE]; /* raw serial number */
|
|
|
|
int serialSz; /* raw serial bytes stored */
|
2011-10-08 03:50:32 +04:00
|
|
|
byte* extensions; /* not owned, points into raw cert */
|
|
|
|
int extensionsSz; /* length of cert extensions */
|
|
|
|
word32 extensionsIdx; /* if want to go back and parse later */
|
2012-05-15 02:38:59 +04:00
|
|
|
byte* extAuthInfo; /* Authority Information Access URI */
|
|
|
|
int extAuthInfoSz; /* length of the URI */
|
|
|
|
byte* extCrlInfo; /* CRL Distribution Points */
|
|
|
|
int extCrlInfoSz; /* length of the URI */
|
2013-04-29 23:08:16 +04:00
|
|
|
byte extSubjKeyId[SHA_SIZE]; /* Subject Key ID */
|
2013-04-30 04:09:15 +04:00
|
|
|
byte extSubjKeyIdSet; /* Set when the SKID was read from cert */
|
|
|
|
byte extAuthKeyId[SHA_SIZE]; /* Authority Key ID */
|
|
|
|
byte extAuthKeyIdSet; /* Set when the AKID was read from cert */
|
2014-04-28 22:03:24 +04:00
|
|
|
#ifndef IGNORE_NAME_CONSTRAINTS
|
|
|
|
byte extNameConstraintSet;
|
|
|
|
#endif /* IGNORE_NAME_CONSTRAINTS */
|
2013-11-20 02:44:55 +04:00
|
|
|
byte isCA; /* CA basic constraint true */
|
2014-03-15 02:48:33 +04:00
|
|
|
byte extKeyUsageSet;
|
|
|
|
word16 extKeyUsage; /* Key usage bitfield */
|
2014-03-20 21:07:47 +04:00
|
|
|
byte extExtKeyUsageSet; /* Extended Key Usage */
|
|
|
|
byte extExtKeyUsage; /* Extended Key usage bitfield */
|
2013-11-20 02:44:55 +04:00
|
|
|
#ifdef OPENSSL_EXTRA
|
|
|
|
byte extBasicConstSet;
|
|
|
|
byte extBasicConstCrit;
|
|
|
|
byte extBasicConstPlSet;
|
|
|
|
word32 pathLength; /* CA basic constraint path length, opt */
|
|
|
|
byte extSubjAltNameSet;
|
|
|
|
byte extSubjAltNameCrit;
|
|
|
|
byte extAuthKeyIdCrit;
|
2014-04-28 22:03:24 +04:00
|
|
|
#ifndef IGNORE_NAME_CONSTRAINTS
|
|
|
|
byte extNameConstraintCrit;
|
|
|
|
#endif /* IGNORE_NAME_CONSTRAINTS */
|
2013-11-20 02:44:55 +04:00
|
|
|
byte extSubjKeyIdCrit;
|
|
|
|
byte extKeyUsageCrit;
|
2014-03-20 21:07:47 +04:00
|
|
|
byte extExtKeyUsageCrit;
|
2014-03-21 20:37:10 +04:00
|
|
|
byte* extExtKeyUsageSrc;
|
|
|
|
word32 extExtKeyUsageSz;
|
|
|
|
word32 extExtKeyUsageCount;
|
2013-11-20 04:20:18 +04:00
|
|
|
byte* extAuthKeyIdSrc;
|
|
|
|
word32 extAuthKeyIdSz;
|
|
|
|
byte* extSubjKeyIdSrc;
|
|
|
|
word32 extSubjKeyIdSz;
|
2013-11-20 02:44:55 +04:00
|
|
|
#endif
|
2014-02-01 23:37:08 +04:00
|
|
|
#ifdef HAVE_ECC
|
|
|
|
word32 pkCurveOID; /* Public Key's curve OID */
|
|
|
|
#endif /* HAVE_ECC */
|
2013-10-18 01:31:20 +04:00
|
|
|
byte* beforeDate;
|
|
|
|
int beforeDateLen;
|
|
|
|
byte* afterDate;
|
|
|
|
int afterDateLen;
|
2014-01-11 03:13:56 +04:00
|
|
|
#ifdef HAVE_PKCS7
|
|
|
|
byte* issuerRaw; /* pointer to issuer inside source */
|
|
|
|
int issuerRawLen;
|
|
|
|
#endif
|
2014-04-29 00:29:44 +04:00
|
|
|
#ifndef IGNORE_NAME_CONSTRAINT
|
|
|
|
byte* subjectRaw; /* pointer to subject inside source */
|
|
|
|
int subjectRawLen;
|
|
|
|
#endif
|
2013-10-18 01:31:20 +04:00
|
|
|
#if defined(CYASSL_CERT_GEN)
|
2011-08-05 02:42:55 +04:00
|
|
|
/* easy access to subject info for other sign */
|
2011-02-05 22:14:47 +03:00
|
|
|
char* subjectSN;
|
|
|
|
int subjectSNLen;
|
2014-05-23 18:42:37 +04:00
|
|
|
char subjectSNEnc;
|
2011-02-05 22:14:47 +03:00
|
|
|
char* subjectC;
|
|
|
|
int subjectCLen;
|
2014-05-23 18:42:37 +04:00
|
|
|
char subjectCEnc;
|
2011-02-05 22:14:47 +03:00
|
|
|
char* subjectL;
|
|
|
|
int subjectLLen;
|
2014-05-23 18:42:37 +04:00
|
|
|
char subjectLEnc;
|
2011-02-05 22:14:47 +03:00
|
|
|
char* subjectST;
|
|
|
|
int subjectSTLen;
|
2014-05-23 18:42:37 +04:00
|
|
|
char subjectSTEnc;
|
2011-02-05 22:14:47 +03:00
|
|
|
char* subjectO;
|
|
|
|
int subjectOLen;
|
2014-05-23 18:42:37 +04:00
|
|
|
char subjectOEnc;
|
2011-02-05 22:14:47 +03:00
|
|
|
char* subjectOU;
|
|
|
|
int subjectOULen;
|
2014-05-23 18:42:37 +04:00
|
|
|
char subjectOUEnc;
|
2011-02-05 22:14:47 +03:00
|
|
|
char* subjectEmail;
|
|
|
|
int subjectEmailLen;
|
|
|
|
#endif /* CYASSL_CERT_GEN */
|
2013-10-18 01:31:20 +04:00
|
|
|
#ifdef OPENSSL_EXTRA
|
|
|
|
DecodedName issuerName;
|
|
|
|
DecodedName subjectName;
|
|
|
|
#endif /* OPENSSL_EXTRA */
|
2013-06-26 03:26:53 +04:00
|
|
|
#ifdef CYASSL_SEP
|
|
|
|
int deviceTypeSz;
|
|
|
|
byte* deviceType;
|
|
|
|
int hwTypeSz;
|
|
|
|
byte* hwType;
|
|
|
|
int hwSerialNumSz;
|
|
|
|
byte* hwSerialNum;
|
2013-11-20 02:44:55 +04:00
|
|
|
#ifdef OPENSSL_EXTRA
|
|
|
|
byte extCertPolicySet;
|
|
|
|
byte extCertPolicyCrit;
|
|
|
|
#endif /* OPENSSL_EXTRA */
|
2013-06-26 03:26:53 +04:00
|
|
|
#endif /* CYASSL_SEP */
|
2011-06-03 02:43:27 +04:00
|
|
|
};
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2013-10-18 01:31:20 +04:00
|
|
|
|
2013-03-08 05:44:40 +04:00
|
|
|
#ifdef SHA_DIGEST_SIZE
|
2013-05-02 22:34:26 +04:00
|
|
|
#define SIGNER_DIGEST_SIZE SHA_DIGEST_SIZE
|
2013-03-08 05:44:40 +04:00
|
|
|
#else
|
2013-05-02 22:34:26 +04:00
|
|
|
#define SIGNER_DIGEST_SIZE 20
|
2013-03-08 05:44:40 +04:00
|
|
|
#endif
|
2011-02-05 22:14:47 +03:00
|
|
|
|
|
|
|
/* CA Signers */
|
2013-05-02 22:34:26 +04:00
|
|
|
/* if change layout change PERSIST_CERT_CACHE functions too */
|
2011-02-05 22:14:47 +03:00
|
|
|
struct Signer {
|
|
|
|
word32 pubKeySize;
|
|
|
|
word32 keyOID; /* key type */
|
2014-04-11 03:50:14 +04:00
|
|
|
word16 keyUsage;
|
2013-05-02 22:34:26 +04:00
|
|
|
byte* publicKey;
|
|
|
|
int nameLen;
|
2011-02-05 22:14:47 +03:00
|
|
|
char* name; /* common name */
|
2014-04-28 22:03:24 +04:00
|
|
|
#ifndef IGNORE_NAME_CONSTRAINTS
|
|
|
|
Base_entry* permittedNames;
|
|
|
|
Base_entry* excludedNames;
|
|
|
|
#endif /* IGNORE_NAME_CONSTRAINTS */
|
2013-04-29 23:08:16 +04:00
|
|
|
byte subjectNameHash[SIGNER_DIGEST_SIZE];
|
|
|
|
/* sha hash of names in certificate */
|
|
|
|
#ifndef NO_SKID
|
|
|
|
byte subjectKeyIdHash[SIGNER_DIGEST_SIZE];
|
|
|
|
/* sha hash of names in certificate */
|
|
|
|
#endif
|
2011-02-05 22:14:47 +03:00
|
|
|
Signer* next;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-06-04 00:01:45 +04:00
|
|
|
/* not for public consumption but may use for testing sometimes */
|
|
|
|
#ifdef CYASSL_TEST_CERT
|
|
|
|
#define CYASSL_TEST_API CYASSL_API
|
|
|
|
#else
|
|
|
|
#define CYASSL_TEST_API CYASSL_LOCAL
|
|
|
|
#endif
|
|
|
|
|
2012-08-01 04:45:48 +04:00
|
|
|
CYASSL_TEST_API void FreeAltNames(DNS_entry*, void*);
|
2014-04-28 22:03:24 +04:00
|
|
|
#ifndef IGNORE_NAME_CONSTRAINTS
|
|
|
|
CYASSL_TEST_API void FreeNameSubtrees(Base_entry*, void*);
|
|
|
|
#endif /* IGNORE_NAME_CONSTRAINTS */
|
2011-06-16 22:46:45 +04:00
|
|
|
CYASSL_TEST_API void InitDecodedCert(DecodedCert*, byte*, word32, void*);
|
2011-06-04 00:01:45 +04:00
|
|
|
CYASSL_TEST_API void FreeDecodedCert(DecodedCert*);
|
2012-05-04 05:07:31 +04:00
|
|
|
CYASSL_TEST_API int ParseCert(DecodedCert*, int type, int verify, void* cm);
|
2011-06-04 00:01:45 +04:00
|
|
|
|
2012-05-04 05:07:31 +04:00
|
|
|
CYASSL_LOCAL int ParseCertRelative(DecodedCert*, int type, int verify,void* cm);
|
2012-05-03 19:18:59 +04:00
|
|
|
CYASSL_LOCAL int DecodeToKey(DecodedCert*, int verify);
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2011-04-27 02:41:16 +04:00
|
|
|
CYASSL_LOCAL Signer* MakeSigner(void*);
|
2013-04-26 02:36:33 +04:00
|
|
|
CYASSL_LOCAL void FreeSigner(Signer*, void*);
|
|
|
|
CYASSL_LOCAL void FreeSignerTable(Signer**, int, void*);
|
2011-02-05 22:14:47 +03:00
|
|
|
|
|
|
|
|
2011-04-27 02:41:16 +04:00
|
|
|
CYASSL_LOCAL int ToTraditional(byte* buffer, word32 length);
|
|
|
|
CYASSL_LOCAL int ToTraditionalEnc(byte* buffer, word32 length,const char*, int);
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2012-05-25 01:07:59 +04:00
|
|
|
CYASSL_LOCAL int ValidateDate(const byte* date, byte format, int dateType);
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2014-01-11 03:13:56 +04:00
|
|
|
/* ASN.1 helper functions */
|
|
|
|
CYASSL_LOCAL int GetLength(const byte* input, word32* inOutIdx, int* len,
|
|
|
|
word32 maxIdx);
|
2014-01-15 09:48:55 +04:00
|
|
|
CYASSL_LOCAL int GetSequence(const byte* input, word32* inOutIdx, int* len,
|
|
|
|
word32 maxIdx);
|
|
|
|
CYASSL_LOCAL int GetSet(const byte* input, word32* inOutIdx, int* len,
|
|
|
|
word32 maxIdx);
|
|
|
|
CYASSL_LOCAL int GetMyVersion(const byte* input, word32* inOutIdx,
|
|
|
|
int* version);
|
|
|
|
CYASSL_LOCAL int GetInt(mp_int* mpi, const byte* input, word32* inOutIdx,
|
|
|
|
word32 maxIdx);
|
|
|
|
CYASSL_LOCAL int GetAlgoId(const byte* input, word32* inOutIdx, word32* oid,
|
|
|
|
word32 maxIdx);
|
2014-01-11 03:13:56 +04:00
|
|
|
CYASSL_LOCAL word32 SetLength(word32 length, byte* output);
|
|
|
|
CYASSL_LOCAL word32 SetSequence(word32 len, byte* output);
|
|
|
|
CYASSL_LOCAL word32 SetOctetString(word32 len, byte* output);
|
2014-01-17 04:17:17 +04:00
|
|
|
CYASSL_LOCAL word32 SetImplicit(byte tag, byte number, word32 len,byte* output);
|
|
|
|
CYASSL_LOCAL word32 SetExplicit(byte number, word32 len, byte* output);
|
2014-01-11 03:13:56 +04:00
|
|
|
CYASSL_LOCAL word32 SetSet(word32 len, byte* output);
|
|
|
|
CYASSL_LOCAL word32 SetAlgoID(int algoOID, byte* output, int type, int curveSz);
|
|
|
|
CYASSL_LOCAL int SetMyVersion(word32 version, byte* output, int header);
|
|
|
|
CYASSL_LOCAL int SetSerialNumber(const byte* sn, word32 snSz, byte* output);
|
2014-01-15 09:48:55 +04:00
|
|
|
CYASSL_LOCAL int GetNameHash(const byte* source, word32* idx, byte* hash,
|
|
|
|
int maxIdx);
|
2014-01-11 03:13:56 +04:00
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
#ifdef HAVE_ECC
|
|
|
|
/* ASN sig helpers */
|
2011-04-27 02:41:16 +04:00
|
|
|
CYASSL_LOCAL int StoreECC_DSA_Sig(byte* out, word32* outLen, mp_int* r,
|
|
|
|
mp_int* s);
|
|
|
|
CYASSL_LOCAL int DecodeECC_DSA_Sig(const byte* sig, word32 sigLen,
|
|
|
|
mp_int* r, mp_int* s);
|
2011-02-05 22:14:47 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CYASSL_CERT_GEN
|
|
|
|
|
|
|
|
enum cert_enums {
|
|
|
|
NAME_ENTRIES = 8,
|
|
|
|
JOINT_LEN = 2,
|
|
|
|
EMAIL_JOINT_LEN = 9,
|
|
|
|
RSA_KEY = 10,
|
2013-11-15 08:34:39 +04:00
|
|
|
NTRU_KEY = 11,
|
|
|
|
ECC_KEY = 12
|
2011-02-05 22:14:47 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* CYASSL_CERT_GEN */
|
|
|
|
|
|
|
|
|
2012-05-29 20:11:37 +04:00
|
|
|
|
|
|
|
/* for pointer use */
|
|
|
|
typedef struct CertStatus CertStatus;
|
|
|
|
|
2012-04-27 00:52:48 +04:00
|
|
|
#ifdef HAVE_OCSP
|
|
|
|
|
|
|
|
enum Ocsp_Response_Status {
|
|
|
|
OCSP_SUCCESSFUL = 0, /* Response has valid confirmations */
|
|
|
|
OCSP_MALFORMED_REQUEST = 1, /* Illegal confirmation request */
|
|
|
|
OCSP_INTERNAL_ERROR = 2, /* Internal error in issuer */
|
|
|
|
OCSP_TRY_LATER = 3, /* Try again later */
|
|
|
|
OCSP_SIG_REQUIRED = 5, /* Must sign the request (4 is skipped) */
|
|
|
|
OCSP_UNAUTHROIZED = 6 /* Request unauthorized */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum Ocsp_Cert_Status {
|
|
|
|
CERT_GOOD = 0,
|
|
|
|
CERT_REVOKED = 1,
|
|
|
|
CERT_UNKNOWN = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum Ocsp_Sums {
|
2012-05-18 21:18:56 +04:00
|
|
|
OCSP_BASIC_OID = 117,
|
|
|
|
OCSP_NONCE_OID = 118
|
2012-04-27 00:52:48 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-05-18 21:18:56 +04:00
|
|
|
typedef struct OcspRequest OcspRequest;
|
2012-04-27 00:52:48 +04:00
|
|
|
typedef struct OcspResponse OcspResponse;
|
2012-05-03 01:45:30 +04:00
|
|
|
|
2012-04-27 00:52:48 +04:00
|
|
|
|
2012-05-29 20:11:37 +04:00
|
|
|
struct CertStatus {
|
2012-06-01 04:29:32 +04:00
|
|
|
CertStatus* next;
|
2012-05-29 20:11:37 +04:00
|
|
|
|
2012-06-01 04:29:32 +04:00
|
|
|
byte serial[EXTERNAL_SERIAL_SIZE];
|
|
|
|
int serialSz;
|
2012-05-29 20:11:37 +04:00
|
|
|
|
|
|
|
int status;
|
|
|
|
|
2012-06-01 04:29:32 +04:00
|
|
|
byte thisDate[MAX_DATE_SIZE];
|
|
|
|
byte nextDate[MAX_DATE_SIZE];
|
|
|
|
byte thisDateFormat;
|
|
|
|
byte nextDateFormat;
|
2012-05-29 20:11:37 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-04-27 00:52:48 +04:00
|
|
|
struct OcspResponse {
|
|
|
|
int responseStatus; /* return code from Responder */
|
|
|
|
|
2012-06-01 04:29:32 +04:00
|
|
|
byte* response; /* Pointer to beginning of OCSP Response */
|
|
|
|
word32 responseSz; /* length of the OCSP Response */
|
2012-04-27 00:52:48 +04:00
|
|
|
|
2012-06-01 22:57:03 +04:00
|
|
|
byte producedDate[MAX_DATE_SIZE];
|
|
|
|
/* Date at which this response was signed */
|
|
|
|
byte producedDateFormat; /* format of the producedDate */
|
2012-06-01 04:29:32 +04:00
|
|
|
byte* issuerHash;
|
|
|
|
byte* issuerKeyHash;
|
|
|
|
|
|
|
|
byte* cert;
|
|
|
|
word32 certSz;
|
2012-05-18 21:18:56 +04:00
|
|
|
|
2012-06-01 04:29:32 +04:00
|
|
|
byte* sig; /* Pointer to sig in source */
|
|
|
|
word32 sigSz; /* Length in octets for the sig */
|
2012-04-27 00:52:48 +04:00
|
|
|
word32 sigOID; /* OID for hash used for sig */
|
|
|
|
|
2012-06-01 04:29:32 +04:00
|
|
|
CertStatus* status; /* certificate status to fill out */
|
2012-04-27 00:52:48 +04:00
|
|
|
|
2012-05-29 20:11:37 +04:00
|
|
|
byte* nonce; /* pointer to nonce inside ASN.1 response */
|
|
|
|
int nonceSz; /* length of the nonce string */
|
2012-05-18 21:18:56 +04:00
|
|
|
|
2012-04-27 00:52:48 +04:00
|
|
|
byte* source; /* pointer to source buffer, not owned */
|
|
|
|
word32 maxIdx; /* max offset based on init size */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-05-18 21:18:56 +04:00
|
|
|
struct OcspRequest {
|
2012-06-01 04:29:32 +04:00
|
|
|
DecodedCert* cert;
|
|
|
|
|
2012-12-19 22:18:11 +04:00
|
|
|
byte useNonce;
|
2012-06-01 04:29:32 +04:00
|
|
|
byte nonce[MAX_OCSP_NONCE_SZ];
|
2012-05-18 21:18:56 +04:00
|
|
|
int nonceSz;
|
|
|
|
|
2012-06-01 04:29:32 +04:00
|
|
|
byte* issuerHash; /* pointer to issuerHash in source cert */
|
|
|
|
byte* issuerKeyHash; /* pointer to issuerKeyHash in source cert */
|
|
|
|
byte* serial; /* pointer to serial number in source cert */
|
|
|
|
int serialSz; /* length of the serial number */
|
2012-05-29 20:11:37 +04:00
|
|
|
|
|
|
|
byte* dest; /* pointer to the destination ASN.1 buffer */
|
|
|
|
word32 destSz; /* length of the destination buffer */
|
2012-05-18 21:18:56 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-06-01 04:29:32 +04:00
|
|
|
CYASSL_LOCAL void InitOcspResponse(OcspResponse*, CertStatus*, byte*, word32);
|
2012-04-27 01:16:34 +04:00
|
|
|
CYASSL_LOCAL int OcspResponseDecode(OcspResponse*);
|
2012-05-18 21:18:56 +04:00
|
|
|
|
2012-12-19 22:18:11 +04:00
|
|
|
CYASSL_LOCAL void InitOcspRequest(OcspRequest*, DecodedCert*,
|
|
|
|
byte, byte*, word32);
|
2012-06-01 04:29:32 +04:00
|
|
|
CYASSL_LOCAL int EncodeOcspRequest(OcspRequest*);
|
2012-04-27 00:52:48 +04:00
|
|
|
|
2012-05-18 21:18:56 +04:00
|
|
|
CYASSL_LOCAL int CompareOcspReqResp(OcspRequest*, OcspResponse*);
|
|
|
|
|
2012-04-27 00:52:48 +04:00
|
|
|
|
|
|
|
#endif /* HAVE_OCSP */
|
|
|
|
|
|
|
|
|
2012-05-17 04:35:51 +04:00
|
|
|
/* for pointer use */
|
2012-05-17 04:04:56 +04:00
|
|
|
typedef struct RevokedCert RevokedCert;
|
|
|
|
|
2012-05-17 04:35:51 +04:00
|
|
|
#ifdef HAVE_CRL
|
|
|
|
|
2012-05-17 04:04:56 +04:00
|
|
|
struct RevokedCert {
|
|
|
|
byte serialNumber[EXTERNAL_SERIAL_SIZE];
|
|
|
|
int serialSz;
|
|
|
|
RevokedCert* next;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct DecodedCRL DecodedCRL;
|
|
|
|
|
|
|
|
struct DecodedCRL {
|
|
|
|
word32 certBegin; /* offset to start of cert */
|
|
|
|
word32 sigIndex; /* offset to start of signature */
|
|
|
|
word32 sigLength; /* length of signature */
|
|
|
|
word32 signatureOID; /* sum of algorithm object id */
|
|
|
|
byte* signature; /* pointer into raw source, not owned */
|
|
|
|
byte issuerHash[SHA_DIGEST_SIZE]; /* issuer hash */
|
2012-11-27 06:40:43 +04:00
|
|
|
byte crlHash[SHA_DIGEST_SIZE]; /* raw crl data hash */
|
2012-05-17 04:04:56 +04:00
|
|
|
byte lastDate[MAX_DATE_SIZE]; /* last date updated */
|
|
|
|
byte nextDate[MAX_DATE_SIZE]; /* next update date */
|
2012-05-25 01:07:59 +04:00
|
|
|
byte lastDateFormat; /* format of last date */
|
|
|
|
byte nextDateFormat; /* format of next date */
|
2012-05-17 04:04:56 +04:00
|
|
|
RevokedCert* certs; /* revoked cert list */
|
|
|
|
int totalCerts; /* number on list */
|
|
|
|
};
|
|
|
|
|
|
|
|
CYASSL_LOCAL void InitDecodedCRL(DecodedCRL*);
|
2012-11-02 01:14:40 +04:00
|
|
|
CYASSL_LOCAL int ParseCRL(DecodedCRL*, const byte* buff, word32 sz, void* cm);
|
2012-05-17 04:04:56 +04:00
|
|
|
CYASSL_LOCAL void FreeDecodedCRL(DecodedCRL*);
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* HAVE_CRL */
|
|
|
|
|
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* CTAO_CRYPT_ASN_H */
|
|
|
|
|
2012-11-02 02:03:29 +04:00
|
|
|
#endif /* !NO_ASN */
|