Example program to test AES-GCM functionality. Used for a workshop

Dependencies:   mbed

Committer:
HannesTschofenig
Date:
Thu Sep 27 06:34:22 2018 +0000
Revision:
0:796d0f61a05b
Example AES-GCM test program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
HannesTschofenig 0:796d0f61a05b 1 /**
HannesTschofenig 0:796d0f61a05b 2 * \file oid.h
HannesTschofenig 0:796d0f61a05b 3 *
HannesTschofenig 0:796d0f61a05b 4 * \brief Object Identifier (OID) database
HannesTschofenig 0:796d0f61a05b 5 *
HannesTschofenig 0:796d0f61a05b 6 * Copyright (C) 2006-2014, Brainspark B.V.
HannesTschofenig 0:796d0f61a05b 7 *
HannesTschofenig 0:796d0f61a05b 8 * This file is part of PolarSSL (http://www.polarssl.org)
HannesTschofenig 0:796d0f61a05b 9 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
HannesTschofenig 0:796d0f61a05b 10 *
HannesTschofenig 0:796d0f61a05b 11 * All rights reserved.
HannesTschofenig 0:796d0f61a05b 12 *
HannesTschofenig 0:796d0f61a05b 13 * This program is free software; you can redistribute it and/or modify
HannesTschofenig 0:796d0f61a05b 14 * it under the terms of the GNU General Public License as published by
HannesTschofenig 0:796d0f61a05b 15 * the Free Software Foundation; either version 2 of the License, or
HannesTschofenig 0:796d0f61a05b 16 * (at your option) any later version.
HannesTschofenig 0:796d0f61a05b 17 *
HannesTschofenig 0:796d0f61a05b 18 * This program is distributed in the hope that it will be useful,
HannesTschofenig 0:796d0f61a05b 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
HannesTschofenig 0:796d0f61a05b 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
HannesTschofenig 0:796d0f61a05b 21 * GNU General Public License for more details.
HannesTschofenig 0:796d0f61a05b 22 *
HannesTschofenig 0:796d0f61a05b 23 * You should have received a copy of the GNU General Public License along
HannesTschofenig 0:796d0f61a05b 24 * with this program; if not, write to the Free Software Foundation, Inc.,
HannesTschofenig 0:796d0f61a05b 25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
HannesTschofenig 0:796d0f61a05b 26 */
HannesTschofenig 0:796d0f61a05b 27 #ifndef POLARSSL_OID_H
HannesTschofenig 0:796d0f61a05b 28 #define POLARSSL_OID_H
HannesTschofenig 0:796d0f61a05b 29
HannesTschofenig 0:796d0f61a05b 30 #include <string.h>
HannesTschofenig 0:796d0f61a05b 31 #if !defined(POLARSSL_CONFIG_FILE)
HannesTschofenig 0:796d0f61a05b 32 #include "config.h"
HannesTschofenig 0:796d0f61a05b 33 #else
HannesTschofenig 0:796d0f61a05b 34 #include POLARSSL_CONFIG_FILE
HannesTschofenig 0:796d0f61a05b 35 #endif
HannesTschofenig 0:796d0f61a05b 36 #include "asn1.h"
HannesTschofenig 0:796d0f61a05b 37 #include "pk.h"
HannesTschofenig 0:796d0f61a05b 38 #if defined(POLARSSL_CIPHER_C)
HannesTschofenig 0:796d0f61a05b 39 #include "cipher.h"
HannesTschofenig 0:796d0f61a05b 40 #endif
HannesTschofenig 0:796d0f61a05b 41
HannesTschofenig 0:796d0f61a05b 42 #if defined(POLARSSL_MD_C)
HannesTschofenig 0:796d0f61a05b 43 #include "md.h"
HannesTschofenig 0:796d0f61a05b 44 #endif
HannesTschofenig 0:796d0f61a05b 45
HannesTschofenig 0:796d0f61a05b 46 #if defined(POLARSSL_X509_USE_C) || defined(POLARSSL_X509_CREATE_C)
HannesTschofenig 0:796d0f61a05b 47 #include "x509.h"
HannesTschofenig 0:796d0f61a05b 48 #endif
HannesTschofenig 0:796d0f61a05b 49
HannesTschofenig 0:796d0f61a05b 50 #define POLARSSL_ERR_OID_NOT_FOUND -0x002E /**< OID is not found. */
HannesTschofenig 0:796d0f61a05b 51 #define POLARSSL_ERR_OID_BUF_TOO_SMALL -0x000B /**< output buffer is too small */
HannesTschofenig 0:796d0f61a05b 52
HannesTschofenig 0:796d0f61a05b 53 /*
HannesTschofenig 0:796d0f61a05b 54 * Top level OID tuples
HannesTschofenig 0:796d0f61a05b 55 */
HannesTschofenig 0:796d0f61a05b 56 #define OID_ISO_MEMBER_BODIES "\x2a" /* {iso(1) member-body(2)} */
HannesTschofenig 0:796d0f61a05b 57 #define OID_ISO_IDENTIFIED_ORG "\x2b" /* {iso(1) identified-organization(3)} */
HannesTschofenig 0:796d0f61a05b 58 #define OID_ISO_CCITT_DS "\x55" /* {joint-iso-ccitt(2) ds(5)} */
HannesTschofenig 0:796d0f61a05b 59 #define OID_ISO_ITU_COUNTRY "\x60" /* {joint-iso-itu-t(2) country(16)} */
HannesTschofenig 0:796d0f61a05b 60
HannesTschofenig 0:796d0f61a05b 61 /*
HannesTschofenig 0:796d0f61a05b 62 * ISO Member bodies OID parts
HannesTschofenig 0:796d0f61a05b 63 */
HannesTschofenig 0:796d0f61a05b 64 #define OID_COUNTRY_US "\x86\x48" /* {us(840)} */
HannesTschofenig 0:796d0f61a05b 65 #define OID_ORG_RSA_DATA_SECURITY "\x86\xf7\x0d" /* {rsadsi(113549)} */
HannesTschofenig 0:796d0f61a05b 66 #define OID_RSA_COMPANY OID_ISO_MEMBER_BODIES OID_COUNTRY_US \
HannesTschofenig 0:796d0f61a05b 67 OID_ORG_RSA_DATA_SECURITY /* {iso(1) member-body(2) us(840) rsadsi(113549)} */
HannesTschofenig 0:796d0f61a05b 68 #define OID_ORG_ANSI_X9_62 "\xce\x3d" /* ansi-X9-62(10045) */
HannesTschofenig 0:796d0f61a05b 69 #define OID_ANSI_X9_62 OID_ISO_MEMBER_BODIES OID_COUNTRY_US \
HannesTschofenig 0:796d0f61a05b 70 OID_ORG_ANSI_X9_62
HannesTschofenig 0:796d0f61a05b 71
HannesTschofenig 0:796d0f61a05b 72 /*
HannesTschofenig 0:796d0f61a05b 73 * ISO Identified organization OID parts
HannesTschofenig 0:796d0f61a05b 74 */
HannesTschofenig 0:796d0f61a05b 75 #define OID_ORG_DOD "\x06" /* {dod(6)} */
HannesTschofenig 0:796d0f61a05b 76 #define OID_ORG_OIW "\x0e"
HannesTschofenig 0:796d0f61a05b 77 #define OID_OIW_SECSIG OID_ORG_OIW "\x03"
HannesTschofenig 0:796d0f61a05b 78 #define OID_OIW_SECSIG_ALG OID_OIW_SECSIG "\x02"
HannesTschofenig 0:796d0f61a05b 79 #define OID_OIW_SECSIG_SHA1 OID_OIW_SECSIG_ALG "\x1a"
HannesTschofenig 0:796d0f61a05b 80 #define OID_ORG_CERTICOM "\x81\x04" /* certicom(132) */
HannesTschofenig 0:796d0f61a05b 81 #define OID_CERTICOM OID_ISO_IDENTIFIED_ORG OID_ORG_CERTICOM
HannesTschofenig 0:796d0f61a05b 82 #define OID_ORG_TELETRUST "\x24" /* teletrust(36) */
HannesTschofenig 0:796d0f61a05b 83 #define OID_TELETRUST OID_ISO_IDENTIFIED_ORG OID_ORG_TELETRUST
HannesTschofenig 0:796d0f61a05b 84
HannesTschofenig 0:796d0f61a05b 85 /*
HannesTschofenig 0:796d0f61a05b 86 * ISO ITU OID parts
HannesTschofenig 0:796d0f61a05b 87 */
HannesTschofenig 0:796d0f61a05b 88 #define OID_ORGANIZATION "\x01" /* {organization(1)} */
HannesTschofenig 0:796d0f61a05b 89 #define OID_ISO_ITU_US_ORG OID_ISO_ITU_COUNTRY OID_COUNTRY_US OID_ORGANIZATION /* {joint-iso-itu-t(2) country(16) us(840) organization(1)} */
HannesTschofenig 0:796d0f61a05b 90
HannesTschofenig 0:796d0f61a05b 91 #define OID_ORG_GOV "\x65" /* {gov(101)} */
HannesTschofenig 0:796d0f61a05b 92 #define OID_GOV OID_ISO_ITU_US_ORG OID_ORG_GOV /* {joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101)} */
HannesTschofenig 0:796d0f61a05b 93
HannesTschofenig 0:796d0f61a05b 94 #define OID_ORG_NETSCAPE "\x86\xF8\x42" /* {netscape(113730)} */
HannesTschofenig 0:796d0f61a05b 95 #define OID_NETSCAPE OID_ISO_ITU_US_ORG OID_ORG_NETSCAPE /* Netscape OID {joint-iso-itu-t(2) country(16) us(840) organization(1) netscape(113730)} */
HannesTschofenig 0:796d0f61a05b 96
HannesTschofenig 0:796d0f61a05b 97 /* ISO arc for standard certificate and CRL extensions */
HannesTschofenig 0:796d0f61a05b 98 #define OID_ID_CE OID_ISO_CCITT_DS "\x1D" /**< id-ce OBJECT IDENTIFIER ::= {joint-iso-ccitt(2) ds(5) 29} */
HannesTschofenig 0:796d0f61a05b 99
HannesTschofenig 0:796d0f61a05b 100 /**
HannesTschofenig 0:796d0f61a05b 101 * Private Internet Extensions
HannesTschofenig 0:796d0f61a05b 102 * { iso(1) identified-organization(3) dod(6) internet(1)
HannesTschofenig 0:796d0f61a05b 103 * security(5) mechanisms(5) pkix(7) }
HannesTschofenig 0:796d0f61a05b 104 */
HannesTschofenig 0:796d0f61a05b 105 #define OID_PKIX OID_ISO_IDENTIFIED_ORG OID_ORG_DOD "\x01\x05\x05\x07"
HannesTschofenig 0:796d0f61a05b 106
HannesTschofenig 0:796d0f61a05b 107 /*
HannesTschofenig 0:796d0f61a05b 108 * Arc for standard naming attributes
HannesTschofenig 0:796d0f61a05b 109 */
HannesTschofenig 0:796d0f61a05b 110 #define OID_AT OID_ISO_CCITT_DS "\x04" /**< id-at OBJECT IDENTIFIER ::= {joint-iso-ccitt(2) ds(5) 4} */
HannesTschofenig 0:796d0f61a05b 111 #define OID_AT_CN OID_AT "\x03" /**< id-at-commonName AttributeType:= {id-at 3} */
HannesTschofenig 0:796d0f61a05b 112 #define OID_AT_SUR_NAME OID_AT "\x04" /**< id-at-surName AttributeType:= {id-at 4} */
HannesTschofenig 0:796d0f61a05b 113 #define OID_AT_SERIAL_NUMBER OID_AT "\x05" /**< id-at-serialNumber AttributeType:= {id-at 5} */
HannesTschofenig 0:796d0f61a05b 114 #define OID_AT_COUNTRY OID_AT "\x06" /**< id-at-countryName AttributeType:= {id-at 6} */
HannesTschofenig 0:796d0f61a05b 115 #define OID_AT_LOCALITY OID_AT "\x07" /**< id-at-locality AttributeType:= {id-at 7} */
HannesTschofenig 0:796d0f61a05b 116 #define OID_AT_STATE OID_AT "\x08" /**< id-at-state AttributeType:= {id-at 8} */
HannesTschofenig 0:796d0f61a05b 117 #define OID_AT_ORGANIZATION OID_AT "\x0A" /**< id-at-organizationName AttributeType:= {id-at 10} */
HannesTschofenig 0:796d0f61a05b 118 #define OID_AT_ORG_UNIT OID_AT "\x0B" /**< id-at-organizationalUnitName AttributeType:= {id-at 11} */
HannesTschofenig 0:796d0f61a05b 119 #define OID_AT_TITLE OID_AT "\x0C" /**< id-at-title AttributeType:= {id-at 12} */
HannesTschofenig 0:796d0f61a05b 120 #define OID_AT_POSTAL_ADDRESS OID_AT "\x10" /**< id-at-postalAddress AttributeType:= {id-at 16} */
HannesTschofenig 0:796d0f61a05b 121 #define OID_AT_POSTAL_CODE OID_AT "\x11" /**< id-at-postalCode AttributeType:= {id-at 17} */
HannesTschofenig 0:796d0f61a05b 122 #define OID_AT_GIVEN_NAME OID_AT "\x2A" /**< id-at-givenName AttributeType:= {id-at 42} */
HannesTschofenig 0:796d0f61a05b 123 #define OID_AT_INITIALS OID_AT "\x2B" /**< id-at-initials AttributeType:= {id-at 43} */
HannesTschofenig 0:796d0f61a05b 124 #define OID_AT_GENERATION_QUALIFIER OID_AT "\x2C" /**< id-at-generationQualifier AttributeType:= {id-at 44} */
HannesTschofenig 0:796d0f61a05b 125 #define OID_AT_DN_QUALIFIER OID_AT "\x2E" /**< id-at-dnQualifier AttributeType:= {id-at 46} */
HannesTschofenig 0:796d0f61a05b 126 #define OID_AT_PSEUDONYM OID_AT "\x41" /**< id-at-pseudonym AttributeType:= {id-at 65} */
HannesTschofenig 0:796d0f61a05b 127
HannesTschofenig 0:796d0f61a05b 128 #define OID_DOMAIN_COMPONENT "\x09\x92\x26\x89\x93\xF2\x2C\x64\x01\x19" /** id-domainComponent AttributeType:= {itu-t(0) data(9) pss(2342) ucl(19200300) pilot(100) pilotAttributeType(1) domainComponent(25)} */
HannesTschofenig 0:796d0f61a05b 129
HannesTschofenig 0:796d0f61a05b 130 /*
HannesTschofenig 0:796d0f61a05b 131 * OIDs for standard certificate extensions
HannesTschofenig 0:796d0f61a05b 132 */
HannesTschofenig 0:796d0f61a05b 133 #define OID_AUTHORITY_KEY_IDENTIFIER OID_ID_CE "\x23" /**< id-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 35 } */
HannesTschofenig 0:796d0f61a05b 134 #define OID_SUBJECT_KEY_IDENTIFIER OID_ID_CE "\x0E" /**< id-ce-subjectKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 14 } */
HannesTschofenig 0:796d0f61a05b 135 #define OID_KEY_USAGE OID_ID_CE "\x0F" /**< id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 } */
HannesTschofenig 0:796d0f61a05b 136 #define OID_CERTIFICATE_POLICIES OID_ID_CE "\x20" /**< id-ce-certificatePolicies OBJECT IDENTIFIER ::= { id-ce 32 } */
HannesTschofenig 0:796d0f61a05b 137 #define OID_POLICY_MAPPINGS OID_ID_CE "\x21" /**< id-ce-policyMappings OBJECT IDENTIFIER ::= { id-ce 33 } */
HannesTschofenig 0:796d0f61a05b 138 #define OID_SUBJECT_ALT_NAME OID_ID_CE "\x11" /**< id-ce-subjectAltName OBJECT IDENTIFIER ::= { id-ce 17 } */
HannesTschofenig 0:796d0f61a05b 139 #define OID_ISSUER_ALT_NAME OID_ID_CE "\x12" /**< id-ce-issuerAltName OBJECT IDENTIFIER ::= { id-ce 18 } */
HannesTschofenig 0:796d0f61a05b 140 #define OID_SUBJECT_DIRECTORY_ATTRS OID_ID_CE "\x09" /**< id-ce-subjectDirectoryAttributes OBJECT IDENTIFIER ::= { id-ce 9 } */
HannesTschofenig 0:796d0f61a05b 141 #define OID_BASIC_CONSTRAINTS OID_ID_CE "\x13" /**< id-ce-basicConstraints OBJECT IDENTIFIER ::= { id-ce 19 } */
HannesTschofenig 0:796d0f61a05b 142 #define OID_NAME_CONSTRAINTS OID_ID_CE "\x1E" /**< id-ce-nameConstraints OBJECT IDENTIFIER ::= { id-ce 30 } */
HannesTschofenig 0:796d0f61a05b 143 #define OID_POLICY_CONSTRAINTS OID_ID_CE "\x24" /**< id-ce-policyConstraints OBJECT IDENTIFIER ::= { id-ce 36 } */
HannesTschofenig 0:796d0f61a05b 144 #define OID_EXTENDED_KEY_USAGE OID_ID_CE "\x25" /**< id-ce-extKeyUsage OBJECT IDENTIFIER ::= { id-ce 37 } */
HannesTschofenig 0:796d0f61a05b 145 #define OID_CRL_DISTRIBUTION_POINTS OID_ID_CE "\x1F" /**< id-ce-cRLDistributionPoints OBJECT IDENTIFIER ::= { id-ce 31 } */
HannesTschofenig 0:796d0f61a05b 146 #define OID_INIHIBIT_ANYPOLICY OID_ID_CE "\x36" /**< id-ce-inhibitAnyPolicy OBJECT IDENTIFIER ::= { id-ce 54 } */
HannesTschofenig 0:796d0f61a05b 147 #define OID_FRESHEST_CRL OID_ID_CE "\x2E" /**< id-ce-freshestCRL OBJECT IDENTIFIER ::= { id-ce 46 } */
HannesTschofenig 0:796d0f61a05b 148
HannesTschofenig 0:796d0f61a05b 149 /*
HannesTschofenig 0:796d0f61a05b 150 * Netscape certificate extensions
HannesTschofenig 0:796d0f61a05b 151 */
HannesTschofenig 0:796d0f61a05b 152 #define OID_NS_CERT OID_NETSCAPE "\x01"
HannesTschofenig 0:796d0f61a05b 153 #define OID_NS_CERT_TYPE OID_NS_CERT "\x01"
HannesTschofenig 0:796d0f61a05b 154 #define OID_NS_BASE_URL OID_NS_CERT "\x02"
HannesTschofenig 0:796d0f61a05b 155 #define OID_NS_REVOCATION_URL OID_NS_CERT "\x03"
HannesTschofenig 0:796d0f61a05b 156 #define OID_NS_CA_REVOCATION_URL OID_NS_CERT "\x04"
HannesTschofenig 0:796d0f61a05b 157 #define OID_NS_RENEWAL_URL OID_NS_CERT "\x07"
HannesTschofenig 0:796d0f61a05b 158 #define OID_NS_CA_POLICY_URL OID_NS_CERT "\x08"
HannesTschofenig 0:796d0f61a05b 159 #define OID_NS_SSL_SERVER_NAME OID_NS_CERT "\x0C"
HannesTschofenig 0:796d0f61a05b 160 #define OID_NS_COMMENT OID_NS_CERT "\x0D"
HannesTschofenig 0:796d0f61a05b 161 #define OID_NS_DATA_TYPE OID_NETSCAPE "\x02"
HannesTschofenig 0:796d0f61a05b 162 #define OID_NS_CERT_SEQUENCE OID_NS_DATA_TYPE "\x05"
HannesTschofenig 0:796d0f61a05b 163
HannesTschofenig 0:796d0f61a05b 164 /*
HannesTschofenig 0:796d0f61a05b 165 * OIDs for CRL extensions
HannesTschofenig 0:796d0f61a05b 166 */
HannesTschofenig 0:796d0f61a05b 167 #define OID_PRIVATE_KEY_USAGE_PERIOD OID_ID_CE "\x10"
HannesTschofenig 0:796d0f61a05b 168 #define OID_CRL_NUMBER OID_ID_CE "\x14" /**< id-ce-cRLNumber OBJECT IDENTIFIER ::= { id-ce 20 } */
HannesTschofenig 0:796d0f61a05b 169
HannesTschofenig 0:796d0f61a05b 170 /*
HannesTschofenig 0:796d0f61a05b 171 * X.509 v3 Extended key usage OIDs
HannesTschofenig 0:796d0f61a05b 172 */
HannesTschofenig 0:796d0f61a05b 173 #define OID_ANY_EXTENDED_KEY_USAGE OID_EXTENDED_KEY_USAGE "\x00" /**< anyExtendedKeyUsage OBJECT IDENTIFIER ::= { id-ce-extKeyUsage 0 } */
HannesTschofenig 0:796d0f61a05b 174
HannesTschofenig 0:796d0f61a05b 175 #define OID_KP OID_PKIX "\x03" /**< id-kp OBJECT IDENTIFIER ::= { id-pkix 3 } */
HannesTschofenig 0:796d0f61a05b 176 #define OID_SERVER_AUTH OID_KP "\x01" /**< id-kp-serverAuth OBJECT IDENTIFIER ::= { id-kp 1 } */
HannesTschofenig 0:796d0f61a05b 177 #define OID_CLIENT_AUTH OID_KP "\x02" /**< id-kp-clientAuth OBJECT IDENTIFIER ::= { id-kp 2 } */
HannesTschofenig 0:796d0f61a05b 178 #define OID_CODE_SIGNING OID_KP "\x03" /**< id-kp-codeSigning OBJECT IDENTIFIER ::= { id-kp 3 } */
HannesTschofenig 0:796d0f61a05b 179 #define OID_EMAIL_PROTECTION OID_KP "\x04" /**< id-kp-emailProtection OBJECT IDENTIFIER ::= { id-kp 4 } */
HannesTschofenig 0:796d0f61a05b 180 #define OID_TIME_STAMPING OID_KP "\x08" /**< id-kp-timeStamping OBJECT IDENTIFIER ::= { id-kp 8 } */
HannesTschofenig 0:796d0f61a05b 181 #define OID_OCSP_SIGNING OID_KP "\x09" /**< id-kp-OCSPSigning OBJECT IDENTIFIER ::= { id-kp 9 } */
HannesTschofenig 0:796d0f61a05b 182
HannesTschofenig 0:796d0f61a05b 183 /*
HannesTschofenig 0:796d0f61a05b 184 * PKCS definition OIDs
HannesTschofenig 0:796d0f61a05b 185 */
HannesTschofenig 0:796d0f61a05b 186
HannesTschofenig 0:796d0f61a05b 187 #define OID_PKCS OID_RSA_COMPANY "\x01" /**< pkcs OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) 1 } */
HannesTschofenig 0:796d0f61a05b 188 #define OID_PKCS1 OID_PKCS "\x01" /**< pkcs-1 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 1 } */
HannesTschofenig 0:796d0f61a05b 189 #define OID_PKCS5 OID_PKCS "\x05" /**< pkcs-5 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 5 } */
HannesTschofenig 0:796d0f61a05b 190 #define OID_PKCS9 OID_PKCS "\x09" /**< pkcs-9 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 9 } */
HannesTschofenig 0:796d0f61a05b 191 #define OID_PKCS12 OID_PKCS "\x0c" /**< pkcs-12 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 12 } */
HannesTschofenig 0:796d0f61a05b 192
HannesTschofenig 0:796d0f61a05b 193 /*
HannesTschofenig 0:796d0f61a05b 194 * PKCS#1 OIDs
HannesTschofenig 0:796d0f61a05b 195 */
HannesTschofenig 0:796d0f61a05b 196 #define OID_PKCS1_RSA OID_PKCS1 "\x01" /**< rsaEncryption OBJECT IDENTIFIER ::= { pkcs-1 1 } */
HannesTschofenig 0:796d0f61a05b 197 #define OID_PKCS1_MD2 OID_PKCS1 "\x02" /**< md2WithRSAEncryption ::= { pkcs-1 2 } */
HannesTschofenig 0:796d0f61a05b 198 #define OID_PKCS1_MD4 OID_PKCS1 "\x03" /**< md4WithRSAEncryption ::= { pkcs-1 3 } */
HannesTschofenig 0:796d0f61a05b 199 #define OID_PKCS1_MD5 OID_PKCS1 "\x04" /**< md5WithRSAEncryption ::= { pkcs-1 4 } */
HannesTschofenig 0:796d0f61a05b 200 #define OID_PKCS1_SHA1 OID_PKCS1 "\x05" /**< sha1WithRSAEncryption ::= { pkcs-1 5 } */
HannesTschofenig 0:796d0f61a05b 201 #define OID_PKCS1_SHA224 OID_PKCS1 "\x0e" /**< sha224WithRSAEncryption ::= { pkcs-1 14 } */
HannesTschofenig 0:796d0f61a05b 202 #define OID_PKCS1_SHA256 OID_PKCS1 "\x0b" /**< sha256WithRSAEncryption ::= { pkcs-1 11 } */
HannesTschofenig 0:796d0f61a05b 203 #define OID_PKCS1_SHA384 OID_PKCS1 "\x0c" /**< sha384WithRSAEncryption ::= { pkcs-1 12 } */
HannesTschofenig 0:796d0f61a05b 204 #define OID_PKCS1_SHA512 OID_PKCS1 "\x0d" /**< sha512WithRSAEncryption ::= { pkcs-1 13 } */
HannesTschofenig 0:796d0f61a05b 205
HannesTschofenig 0:796d0f61a05b 206 #define OID_RSA_SHA_OBS "\x2B\x0E\x03\x02\x1D"
HannesTschofenig 0:796d0f61a05b 207
HannesTschofenig 0:796d0f61a05b 208 #define OID_PKCS9_EMAIL OID_PKCS9 "\x01" /**< emailAddress AttributeType ::= { pkcs-9 1 } */
HannesTschofenig 0:796d0f61a05b 209
HannesTschofenig 0:796d0f61a05b 210 /*
HannesTschofenig 0:796d0f61a05b 211 * Digest algorithms
HannesTschofenig 0:796d0f61a05b 212 */
HannesTschofenig 0:796d0f61a05b 213 #define OID_DIGEST_ALG_MD2 OID_RSA_COMPANY "\x02\x02" /**< id-md2 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 2 } */
HannesTschofenig 0:796d0f61a05b 214 #define OID_DIGEST_ALG_MD4 OID_RSA_COMPANY "\x02\x04" /**< id-md4 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 4 } */
HannesTschofenig 0:796d0f61a05b 215 #define OID_DIGEST_ALG_MD5 OID_RSA_COMPANY "\x02\x05" /**< id-md5 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 5 } */
HannesTschofenig 0:796d0f61a05b 216 #define OID_DIGEST_ALG_SHA1 OID_ISO_IDENTIFIED_ORG OID_OIW_SECSIG_SHA1 /**< id-sha1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3) oiw(14) secsig(3) algorithms(2) 26 } */
HannesTschofenig 0:796d0f61a05b 217 #define OID_DIGEST_ALG_SHA224 OID_GOV "\x03\x04\x02\x04" /**< id-sha224 OBJECT IDENTIFIER ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistalgorithm(4) hashalgs(2) 4 } */
HannesTschofenig 0:796d0f61a05b 218 #define OID_DIGEST_ALG_SHA256 OID_GOV "\x03\x04\x02\x01" /**< id-sha256 OBJECT IDENTIFIER ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistalgorithm(4) hashalgs(2) 1 } */
HannesTschofenig 0:796d0f61a05b 219
HannesTschofenig 0:796d0f61a05b 220 #define OID_DIGEST_ALG_SHA384 OID_GOV "\x03\x04\x02\x02" /**< id-sha384 OBJECT IDENTIFIER ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistalgorithm(4) hashalgs(2) 2 } */
HannesTschofenig 0:796d0f61a05b 221
HannesTschofenig 0:796d0f61a05b 222 #define OID_DIGEST_ALG_SHA512 OID_GOV "\x03\x04\x02\x03" /**< id-sha512 OBJECT IDENTIFIER ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistalgorithm(4) hashalgs(2) 3 } */
HannesTschofenig 0:796d0f61a05b 223
HannesTschofenig 0:796d0f61a05b 224 #define OID_HMAC_SHA1 OID_RSA_COMPANY "\x02\x07" /**< id-hmacWithSHA1 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 7 } */
HannesTschofenig 0:796d0f61a05b 225
HannesTschofenig 0:796d0f61a05b 226 /*
HannesTschofenig 0:796d0f61a05b 227 * Encryption algorithms
HannesTschofenig 0:796d0f61a05b 228 */
HannesTschofenig 0:796d0f61a05b 229 #define OID_DES_CBC OID_ISO_IDENTIFIED_ORG OID_OIW_SECSIG_ALG "\x07" /**< desCBC OBJECT IDENTIFIER ::= { iso(1) identified-organization(3) oiw(14) secsig(3) algorithms(2) 7 } */
HannesTschofenig 0:796d0f61a05b 230 #define OID_DES_EDE3_CBC OID_RSA_COMPANY "\x03\x07" /**< des-ede3-cbc OBJECT IDENTIFIER ::= { iso(1) member-body(2) -- us(840) rsadsi(113549) encryptionAlgorithm(3) 7 } */
HannesTschofenig 0:796d0f61a05b 231
HannesTschofenig 0:796d0f61a05b 232 /*
HannesTschofenig 0:796d0f61a05b 233 * PKCS#5 OIDs
HannesTschofenig 0:796d0f61a05b 234 */
HannesTschofenig 0:796d0f61a05b 235 #define OID_PKCS5_PBKDF2 OID_PKCS5 "\x0c" /**< id-PBKDF2 OBJECT IDENTIFIER ::= {pkcs-5 12} */
HannesTschofenig 0:796d0f61a05b 236 #define OID_PKCS5_PBES2 OID_PKCS5 "\x0d" /**< id-PBES2 OBJECT IDENTIFIER ::= {pkcs-5 13} */
HannesTschofenig 0:796d0f61a05b 237 #define OID_PKCS5_PBMAC1 OID_PKCS5 "\x0e" /**< id-PBMAC1 OBJECT IDENTIFIER ::= {pkcs-5 14} */
HannesTschofenig 0:796d0f61a05b 238
HannesTschofenig 0:796d0f61a05b 239 /*
HannesTschofenig 0:796d0f61a05b 240 * PKCS#5 PBES1 algorithms
HannesTschofenig 0:796d0f61a05b 241 */
HannesTschofenig 0:796d0f61a05b 242 #define OID_PKCS5_PBE_MD2_DES_CBC OID_PKCS5 "\x01" /**< pbeWithMD2AndDES-CBC OBJECT IDENTIFIER ::= {pkcs-5 1} */
HannesTschofenig 0:796d0f61a05b 243 #define OID_PKCS5_PBE_MD2_RC2_CBC OID_PKCS5 "\x04" /**< pbeWithMD2AndRC2-CBC OBJECT IDENTIFIER ::= {pkcs-5 4} */
HannesTschofenig 0:796d0f61a05b 244 #define OID_PKCS5_PBE_MD5_DES_CBC OID_PKCS5 "\x03" /**< pbeWithMD5AndDES-CBC OBJECT IDENTIFIER ::= {pkcs-5 3} */
HannesTschofenig 0:796d0f61a05b 245 #define OID_PKCS5_PBE_MD5_RC2_CBC OID_PKCS5 "\x06" /**< pbeWithMD5AndRC2-CBC OBJECT IDENTIFIER ::= {pkcs-5 6} */
HannesTschofenig 0:796d0f61a05b 246 #define OID_PKCS5_PBE_SHA1_DES_CBC OID_PKCS5 "\x0a" /**< pbeWithSHA1AndDES-CBC OBJECT IDENTIFIER ::= {pkcs-5 10} */
HannesTschofenig 0:796d0f61a05b 247 #define OID_PKCS5_PBE_SHA1_RC2_CBC OID_PKCS5 "\x0b" /**< pbeWithSHA1AndRC2-CBC OBJECT IDENTIFIER ::= {pkcs-5 11} */
HannesTschofenig 0:796d0f61a05b 248
HannesTschofenig 0:796d0f61a05b 249 /*
HannesTschofenig 0:796d0f61a05b 250 * PKCS#8 OIDs
HannesTschofenig 0:796d0f61a05b 251 */
HannesTschofenig 0:796d0f61a05b 252 #define OID_PKCS9_CSR_EXT_REQ OID_PKCS9 "\x0e" /**< extensionRequest OBJECT IDENTIFIER ::= {pkcs-9 14} */
HannesTschofenig 0:796d0f61a05b 253
HannesTschofenig 0:796d0f61a05b 254 /*
HannesTschofenig 0:796d0f61a05b 255 * PKCS#12 PBE OIDs
HannesTschofenig 0:796d0f61a05b 256 */
HannesTschofenig 0:796d0f61a05b 257 #define OID_PKCS12_PBE OID_PKCS12 "\x01" /**< pkcs-12PbeIds OBJECT IDENTIFIER ::= {pkcs-12 1} */
HannesTschofenig 0:796d0f61a05b 258
HannesTschofenig 0:796d0f61a05b 259 #define OID_PKCS12_PBE_SHA1_RC4_128 OID_PKCS12_PBE "\x01" /**< pbeWithSHAAnd128BitRC4 OBJECT IDENTIFIER ::= {pkcs-12PbeIds 1} */
HannesTschofenig 0:796d0f61a05b 260 #define OID_PKCS12_PBE_SHA1_RC4_40 OID_PKCS12_PBE "\x02" /**< pbeWithSHAAnd40BitRC4 OBJECT IDENTIFIER ::= {pkcs-12PbeIds 2} */
HannesTschofenig 0:796d0f61a05b 261 #define OID_PKCS12_PBE_SHA1_DES3_EDE_CBC OID_PKCS12_PBE "\x03" /**< pbeWithSHAAnd3-KeyTripleDES-CBC OBJECT IDENTIFIER ::= {pkcs-12PbeIds 3} */
HannesTschofenig 0:796d0f61a05b 262 #define OID_PKCS12_PBE_SHA1_DES2_EDE_CBC OID_PKCS12_PBE "\x04" /**< pbeWithSHAAnd2-KeyTripleDES-CBC OBJECT IDENTIFIER ::= {pkcs-12PbeIds 4} */
HannesTschofenig 0:796d0f61a05b 263 #define OID_PKCS12_PBE_SHA1_RC2_128_CBC OID_PKCS12_PBE "\x05" /**< pbeWithSHAAnd128BitRC2-CBC OBJECT IDENTIFIER ::= {pkcs-12PbeIds 5} */
HannesTschofenig 0:796d0f61a05b 264 #define OID_PKCS12_PBE_SHA1_RC2_40_CBC OID_PKCS12_PBE "\x06" /**< pbeWithSHAAnd40BitRC2-CBC OBJECT IDENTIFIER ::= {pkcs-12PbeIds 6} */
HannesTschofenig 0:796d0f61a05b 265
HannesTschofenig 0:796d0f61a05b 266 /*
HannesTschofenig 0:796d0f61a05b 267 * EC key algorithms from RFC 5480
HannesTschofenig 0:796d0f61a05b 268 */
HannesTschofenig 0:796d0f61a05b 269
HannesTschofenig 0:796d0f61a05b 270 /* id-ecPublicKey OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 271 * iso(1) member-body(2) us(840) ansi-X9-62(10045) keyType(2) 1 } */
HannesTschofenig 0:796d0f61a05b 272 #define OID_EC_ALG_UNRESTRICTED OID_ANSI_X9_62 "\x02\01"
HannesTschofenig 0:796d0f61a05b 273
HannesTschofenig 0:796d0f61a05b 274 /* id-ecDH OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 275 * iso(1) identified-organization(3) certicom(132)
HannesTschofenig 0:796d0f61a05b 276 * schemes(1) ecdh(12) } */
HannesTschofenig 0:796d0f61a05b 277 #define OID_EC_ALG_ECDH OID_CERTICOM "\x01\x0c"
HannesTschofenig 0:796d0f61a05b 278
HannesTschofenig 0:796d0f61a05b 279 /*
HannesTschofenig 0:796d0f61a05b 280 * ECParameters namedCurve identifiers, from RFC 5480, RFC 5639, and SEC2
HannesTschofenig 0:796d0f61a05b 281 */
HannesTschofenig 0:796d0f61a05b 282
HannesTschofenig 0:796d0f61a05b 283 /* secp192r1 OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 284 * iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3) prime(1) 1 } */
HannesTschofenig 0:796d0f61a05b 285 #define OID_EC_GRP_SECP192R1 OID_ANSI_X9_62 "\x03\x01\x01"
HannesTschofenig 0:796d0f61a05b 286
HannesTschofenig 0:796d0f61a05b 287 /* secp224r1 OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 288 * iso(1) identified-organization(3) certicom(132) curve(0) 33 } */
HannesTschofenig 0:796d0f61a05b 289 #define OID_EC_GRP_SECP224R1 OID_CERTICOM "\x00\x21"
HannesTschofenig 0:796d0f61a05b 290
HannesTschofenig 0:796d0f61a05b 291 /* secp256r1 OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 292 * iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3) prime(1) 7 } */
HannesTschofenig 0:796d0f61a05b 293 #define OID_EC_GRP_SECP256R1 OID_ANSI_X9_62 "\x03\x01\x07"
HannesTschofenig 0:796d0f61a05b 294
HannesTschofenig 0:796d0f61a05b 295 /* secp384r1 OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 296 * iso(1) identified-organization(3) certicom(132) curve(0) 34 } */
HannesTschofenig 0:796d0f61a05b 297 #define OID_EC_GRP_SECP384R1 OID_CERTICOM "\x00\x22"
HannesTschofenig 0:796d0f61a05b 298
HannesTschofenig 0:796d0f61a05b 299 /* secp521r1 OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 300 * iso(1) identified-organization(3) certicom(132) curve(0) 35 } */
HannesTschofenig 0:796d0f61a05b 301 #define OID_EC_GRP_SECP521R1 OID_CERTICOM "\x00\x23"
HannesTschofenig 0:796d0f61a05b 302
HannesTschofenig 0:796d0f61a05b 303 /* secp192k1 OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 304 * iso(1) identified-organization(3) certicom(132) curve(0) 31 } */
HannesTschofenig 0:796d0f61a05b 305 #define OID_EC_GRP_SECP192K1 OID_CERTICOM "\x00\x1f"
HannesTschofenig 0:796d0f61a05b 306
HannesTschofenig 0:796d0f61a05b 307 /* secp224k1 OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 308 * iso(1) identified-organization(3) certicom(132) curve(0) 32 } */
HannesTschofenig 0:796d0f61a05b 309 #define OID_EC_GRP_SECP224K1 OID_CERTICOM "\x00\x20"
HannesTschofenig 0:796d0f61a05b 310
HannesTschofenig 0:796d0f61a05b 311 /* secp256k1 OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 312 * iso(1) identified-organization(3) certicom(132) curve(0) 10 } */
HannesTschofenig 0:796d0f61a05b 313 #define OID_EC_GRP_SECP256K1 OID_CERTICOM "\x00\x0a"
HannesTschofenig 0:796d0f61a05b 314
HannesTschofenig 0:796d0f61a05b 315 /* RFC 5639 4.1
HannesTschofenig 0:796d0f61a05b 316 * ecStdCurvesAndGeneration OBJECT IDENTIFIER::= {iso(1)
HannesTschofenig 0:796d0f61a05b 317 * identified-organization(3) teletrust(36) algorithm(3) signature-
HannesTschofenig 0:796d0f61a05b 318 * algorithm(3) ecSign(2) 8}
HannesTschofenig 0:796d0f61a05b 319 * ellipticCurve OBJECT IDENTIFIER ::= {ecStdCurvesAndGeneration 1}
HannesTschofenig 0:796d0f61a05b 320 * versionOne OBJECT IDENTIFIER ::= {ellipticCurve 1} */
HannesTschofenig 0:796d0f61a05b 321 #define OID_EC_BRAINPOOL_V1 OID_TELETRUST "\x03\x03\x02\x08\x01\x01"
HannesTschofenig 0:796d0f61a05b 322
HannesTschofenig 0:796d0f61a05b 323 /* brainpoolP256r1 OBJECT IDENTIFIER ::= {versionOne 7} */
HannesTschofenig 0:796d0f61a05b 324 #define OID_EC_GRP_BP256R1 OID_EC_BRAINPOOL_V1 "\x07"
HannesTschofenig 0:796d0f61a05b 325
HannesTschofenig 0:796d0f61a05b 326 /* brainpoolP384r1 OBJECT IDENTIFIER ::= {versionOne 11} */
HannesTschofenig 0:796d0f61a05b 327 #define OID_EC_GRP_BP384R1 OID_EC_BRAINPOOL_V1 "\x0B"
HannesTschofenig 0:796d0f61a05b 328
HannesTschofenig 0:796d0f61a05b 329 /* brainpoolP512r1 OBJECT IDENTIFIER ::= {versionOne 13} */
HannesTschofenig 0:796d0f61a05b 330 #define OID_EC_GRP_BP512R1 OID_EC_BRAINPOOL_V1 "\x0D"
HannesTschofenig 0:796d0f61a05b 331
HannesTschofenig 0:796d0f61a05b 332 /*
HannesTschofenig 0:796d0f61a05b 333 * SEC1 C.1
HannesTschofenig 0:796d0f61a05b 334 *
HannesTschofenig 0:796d0f61a05b 335 * prime-field OBJECT IDENTIFIER ::= { id-fieldType 1 }
HannesTschofenig 0:796d0f61a05b 336 * id-fieldType OBJECT IDENTIFIER ::= { ansi-X9-62 fieldType(1)}
HannesTschofenig 0:796d0f61a05b 337 */
HannesTschofenig 0:796d0f61a05b 338 #define OID_ANSI_X9_62_FIELD_TYPE OID_ANSI_X9_62 "\x01"
HannesTschofenig 0:796d0f61a05b 339 #define OID_ANSI_X9_62_PRIME_FIELD OID_ANSI_X9_62_FIELD_TYPE "\x01"
HannesTschofenig 0:796d0f61a05b 340
HannesTschofenig 0:796d0f61a05b 341 /*
HannesTschofenig 0:796d0f61a05b 342 * ECDSA signature identifiers, from RFC 5480
HannesTschofenig 0:796d0f61a05b 343 */
HannesTschofenig 0:796d0f61a05b 344 #define OID_ANSI_X9_62_SIG OID_ANSI_X9_62 "\x04" /* signatures(4) */
HannesTschofenig 0:796d0f61a05b 345 #define OID_ANSI_X9_62_SIG_SHA2 OID_ANSI_X9_62_SIG "\x03" /* ecdsa-with-SHA2(3) */
HannesTschofenig 0:796d0f61a05b 346
HannesTschofenig 0:796d0f61a05b 347 /* ecdsa-with-SHA1 OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 348 * iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4) 1 } */
HannesTschofenig 0:796d0f61a05b 349 #define OID_ECDSA_SHA1 OID_ANSI_X9_62_SIG "\x01"
HannesTschofenig 0:796d0f61a05b 350
HannesTschofenig 0:796d0f61a05b 351 /* ecdsa-with-SHA224 OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 352 * iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4)
HannesTschofenig 0:796d0f61a05b 353 * ecdsa-with-SHA2(3) 1 } */
HannesTschofenig 0:796d0f61a05b 354 #define OID_ECDSA_SHA224 OID_ANSI_X9_62_SIG_SHA2 "\x01"
HannesTschofenig 0:796d0f61a05b 355
HannesTschofenig 0:796d0f61a05b 356 /* ecdsa-with-SHA256 OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 357 * iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4)
HannesTschofenig 0:796d0f61a05b 358 * ecdsa-with-SHA2(3) 2 } */
HannesTschofenig 0:796d0f61a05b 359 #define OID_ECDSA_SHA256 OID_ANSI_X9_62_SIG_SHA2 "\x02"
HannesTschofenig 0:796d0f61a05b 360
HannesTschofenig 0:796d0f61a05b 361 /* ecdsa-with-SHA384 OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 362 * iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4)
HannesTschofenig 0:796d0f61a05b 363 * ecdsa-with-SHA2(3) 3 } */
HannesTschofenig 0:796d0f61a05b 364 #define OID_ECDSA_SHA384 OID_ANSI_X9_62_SIG_SHA2 "\x03"
HannesTschofenig 0:796d0f61a05b 365
HannesTschofenig 0:796d0f61a05b 366 /* ecdsa-with-SHA512 OBJECT IDENTIFIER ::= {
HannesTschofenig 0:796d0f61a05b 367 * iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4)
HannesTschofenig 0:796d0f61a05b 368 * ecdsa-with-SHA2(3) 4 } */
HannesTschofenig 0:796d0f61a05b 369 #define OID_ECDSA_SHA512 OID_ANSI_X9_62_SIG_SHA2 "\x04"
HannesTschofenig 0:796d0f61a05b 370
HannesTschofenig 0:796d0f61a05b 371 #ifdef __cplusplus
HannesTschofenig 0:796d0f61a05b 372 extern "C" {
HannesTschofenig 0:796d0f61a05b 373 #endif
HannesTschofenig 0:796d0f61a05b 374
HannesTschofenig 0:796d0f61a05b 375 /**
HannesTschofenig 0:796d0f61a05b 376 * \brief Base OID descriptor structure
HannesTschofenig 0:796d0f61a05b 377 */
HannesTschofenig 0:796d0f61a05b 378 typedef struct {
HannesTschofenig 0:796d0f61a05b 379 const char *asn1; /*!< OID ASN.1 representation */
HannesTschofenig 0:796d0f61a05b 380 size_t asn1_len; /*!< length of asn1 */
HannesTschofenig 0:796d0f61a05b 381 const char *name; /*!< official name (e.g. from RFC) */
HannesTschofenig 0:796d0f61a05b 382 const char *description; /*!< human friendly description */
HannesTschofenig 0:796d0f61a05b 383 } oid_descriptor_t;
HannesTschofenig 0:796d0f61a05b 384
HannesTschofenig 0:796d0f61a05b 385 /**
HannesTschofenig 0:796d0f61a05b 386 * \brief Translate an ASN.1 OID into its numeric representation
HannesTschofenig 0:796d0f61a05b 387 * (e.g. "\x2A\x86\x48\x86\xF7\x0D" into "1.2.840.113549")
HannesTschofenig 0:796d0f61a05b 388 *
HannesTschofenig 0:796d0f61a05b 389 * \param buf buffer to put representation in
HannesTschofenig 0:796d0f61a05b 390 * \param size size of the buffer
HannesTschofenig 0:796d0f61a05b 391 * \param oid OID to translate
HannesTschofenig 0:796d0f61a05b 392 *
HannesTschofenig 0:796d0f61a05b 393 * \return Length of the string written (excluding final NULL) or
HannesTschofenig 0:796d0f61a05b 394 * POLARSSL_ERR_OID_BUF_TO_SMALL in case of error
HannesTschofenig 0:796d0f61a05b 395 */
HannesTschofenig 0:796d0f61a05b 396 int oid_get_numeric_string( char *buf, size_t size, const asn1_buf *oid );
HannesTschofenig 0:796d0f61a05b 397
HannesTschofenig 0:796d0f61a05b 398 #if defined(POLARSSL_X509_USE_C) || defined(POLARSSL_X509_CREATE_C)
HannesTschofenig 0:796d0f61a05b 399 /**
HannesTschofenig 0:796d0f61a05b 400 * \brief Translate an X.509 extension OID into local values
HannesTschofenig 0:796d0f61a05b 401 *
HannesTschofenig 0:796d0f61a05b 402 * \param oid OID to use
HannesTschofenig 0:796d0f61a05b 403 * \param ext_type place to store the extension type
HannesTschofenig 0:796d0f61a05b 404 *
HannesTschofenig 0:796d0f61a05b 405 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 406 */
HannesTschofenig 0:796d0f61a05b 407 int oid_get_x509_ext_type( const asn1_buf *oid, int *ext_type );
HannesTschofenig 0:796d0f61a05b 408 #endif
HannesTschofenig 0:796d0f61a05b 409
HannesTschofenig 0:796d0f61a05b 410 /**
HannesTschofenig 0:796d0f61a05b 411 * \brief Translate an X.509 attribute type OID into the short name
HannesTschofenig 0:796d0f61a05b 412 * (e.g. the OID for an X520 Common Name into "CN")
HannesTschofenig 0:796d0f61a05b 413 *
HannesTschofenig 0:796d0f61a05b 414 * \param oid OID to use
HannesTschofenig 0:796d0f61a05b 415 * \param short_name place to store the string pointer
HannesTschofenig 0:796d0f61a05b 416 *
HannesTschofenig 0:796d0f61a05b 417 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 418 */
HannesTschofenig 0:796d0f61a05b 419 int oid_get_attr_short_name( const asn1_buf *oid, const char **short_name );
HannesTschofenig 0:796d0f61a05b 420
HannesTschofenig 0:796d0f61a05b 421 /**
HannesTschofenig 0:796d0f61a05b 422 * \brief Translate PublicKeyAlgorithm OID into pk_type
HannesTschofenig 0:796d0f61a05b 423 *
HannesTschofenig 0:796d0f61a05b 424 * \param oid OID to use
HannesTschofenig 0:796d0f61a05b 425 * \param pk_alg place to store public key algorithm
HannesTschofenig 0:796d0f61a05b 426 *
HannesTschofenig 0:796d0f61a05b 427 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 428 */
HannesTschofenig 0:796d0f61a05b 429 int oid_get_pk_alg( const asn1_buf *oid, pk_type_t *pk_alg );
HannesTschofenig 0:796d0f61a05b 430
HannesTschofenig 0:796d0f61a05b 431 /**
HannesTschofenig 0:796d0f61a05b 432 * \brief Translate pk_type into PublicKeyAlgorithm OID
HannesTschofenig 0:796d0f61a05b 433 *
HannesTschofenig 0:796d0f61a05b 434 * \param pk_alg Public key type to look for
HannesTschofenig 0:796d0f61a05b 435 * \param oid place to store ASN.1 OID string pointer
HannesTschofenig 0:796d0f61a05b 436 * \param olen length of the OID
HannesTschofenig 0:796d0f61a05b 437 *
HannesTschofenig 0:796d0f61a05b 438 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 439 */
HannesTschofenig 0:796d0f61a05b 440 int oid_get_oid_by_pk_alg( pk_type_t pk_alg,
HannesTschofenig 0:796d0f61a05b 441 const char **oid, size_t *olen );
HannesTschofenig 0:796d0f61a05b 442
HannesTschofenig 0:796d0f61a05b 443 #if defined(POLARSSL_ECP_C)
HannesTschofenig 0:796d0f61a05b 444 /**
HannesTschofenig 0:796d0f61a05b 445 * \brief Translate NamedCurve OID into an EC group identifier
HannesTschofenig 0:796d0f61a05b 446 *
HannesTschofenig 0:796d0f61a05b 447 * \param oid OID to use
HannesTschofenig 0:796d0f61a05b 448 * \param grp_id place to store group id
HannesTschofenig 0:796d0f61a05b 449 *
HannesTschofenig 0:796d0f61a05b 450 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 451 */
HannesTschofenig 0:796d0f61a05b 452 int oid_get_ec_grp( const asn1_buf *oid, ecp_group_id *grp_id );
HannesTschofenig 0:796d0f61a05b 453
HannesTschofenig 0:796d0f61a05b 454 /**
HannesTschofenig 0:796d0f61a05b 455 * \brief Translate EC group identifier into NamedCurve OID
HannesTschofenig 0:796d0f61a05b 456 *
HannesTschofenig 0:796d0f61a05b 457 * \param grp_id EC group identifier
HannesTschofenig 0:796d0f61a05b 458 * \param oid place to store ASN.1 OID string pointer
HannesTschofenig 0:796d0f61a05b 459 * \param olen length of the OID
HannesTschofenig 0:796d0f61a05b 460 *
HannesTschofenig 0:796d0f61a05b 461 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 462 */
HannesTschofenig 0:796d0f61a05b 463 int oid_get_oid_by_ec_grp( ecp_group_id grp_id,
HannesTschofenig 0:796d0f61a05b 464 const char **oid, size_t *olen );
HannesTschofenig 0:796d0f61a05b 465 #endif /* POLARSSL_ECP_C */
HannesTschofenig 0:796d0f61a05b 466
HannesTschofenig 0:796d0f61a05b 467 #if defined(POLARSSL_MD_C)
HannesTschofenig 0:796d0f61a05b 468 /**
HannesTschofenig 0:796d0f61a05b 469 * \brief Translate SignatureAlgorithm OID into md_type and pk_type
HannesTschofenig 0:796d0f61a05b 470 *
HannesTschofenig 0:796d0f61a05b 471 * \param oid OID to use
HannesTschofenig 0:796d0f61a05b 472 * \param md_alg place to store message digest algorithm
HannesTschofenig 0:796d0f61a05b 473 * \param pk_alg place to store public key algorithm
HannesTschofenig 0:796d0f61a05b 474 *
HannesTschofenig 0:796d0f61a05b 475 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 476 */
HannesTschofenig 0:796d0f61a05b 477 int oid_get_sig_alg( const asn1_buf *oid,
HannesTschofenig 0:796d0f61a05b 478 md_type_t *md_alg, pk_type_t *pk_alg );
HannesTschofenig 0:796d0f61a05b 479
HannesTschofenig 0:796d0f61a05b 480 /**
HannesTschofenig 0:796d0f61a05b 481 * \brief Translate SignatureAlgorithm OID into description
HannesTschofenig 0:796d0f61a05b 482 *
HannesTschofenig 0:796d0f61a05b 483 * \param oid OID to use
HannesTschofenig 0:796d0f61a05b 484 * \param desc place to store string pointer
HannesTschofenig 0:796d0f61a05b 485 *
HannesTschofenig 0:796d0f61a05b 486 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 487 */
HannesTschofenig 0:796d0f61a05b 488 int oid_get_sig_alg_desc( const asn1_buf *oid, const char **desc );
HannesTschofenig 0:796d0f61a05b 489
HannesTschofenig 0:796d0f61a05b 490 /**
HannesTschofenig 0:796d0f61a05b 491 * \brief Translate md_type and pk_type into SignatureAlgorithm OID
HannesTschofenig 0:796d0f61a05b 492 *
HannesTschofenig 0:796d0f61a05b 493 * \param md_alg message digest algorithm
HannesTschofenig 0:796d0f61a05b 494 * \param pk_alg public key algorithm
HannesTschofenig 0:796d0f61a05b 495 * \param oid place to store ASN.1 OID string pointer
HannesTschofenig 0:796d0f61a05b 496 * \param olen length of the OID
HannesTschofenig 0:796d0f61a05b 497 *
HannesTschofenig 0:796d0f61a05b 498 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 499 */
HannesTschofenig 0:796d0f61a05b 500 int oid_get_oid_by_sig_alg( pk_type_t pk_alg, md_type_t md_alg,
HannesTschofenig 0:796d0f61a05b 501 const char **oid, size_t *olen );
HannesTschofenig 0:796d0f61a05b 502
HannesTschofenig 0:796d0f61a05b 503 /**
HannesTschofenig 0:796d0f61a05b 504 * \brief Translate hash algorithm OID into md_type
HannesTschofenig 0:796d0f61a05b 505 *
HannesTschofenig 0:796d0f61a05b 506 * \param oid OID to use
HannesTschofenig 0:796d0f61a05b 507 * \param md_alg place to store message digest algorithm
HannesTschofenig 0:796d0f61a05b 508 *
HannesTschofenig 0:796d0f61a05b 509 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 510 */
HannesTschofenig 0:796d0f61a05b 511 int oid_get_md_alg( const asn1_buf *oid, md_type_t *md_alg );
HannesTschofenig 0:796d0f61a05b 512 #endif /* POLARSSL_MD_C */
HannesTschofenig 0:796d0f61a05b 513
HannesTschofenig 0:796d0f61a05b 514 /**
HannesTschofenig 0:796d0f61a05b 515 * \brief Translate Extended Key Usage OID into description
HannesTschofenig 0:796d0f61a05b 516 *
HannesTschofenig 0:796d0f61a05b 517 * \param oid OID to use
HannesTschofenig 0:796d0f61a05b 518 * \param desc place to store string pointer
HannesTschofenig 0:796d0f61a05b 519 *
HannesTschofenig 0:796d0f61a05b 520 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 521 */
HannesTschofenig 0:796d0f61a05b 522 int oid_get_extended_key_usage( const asn1_buf *oid, const char **desc );
HannesTschofenig 0:796d0f61a05b 523
HannesTschofenig 0:796d0f61a05b 524 /**
HannesTschofenig 0:796d0f61a05b 525 * \brief Translate md_type into hash algorithm OID
HannesTschofenig 0:796d0f61a05b 526 *
HannesTschofenig 0:796d0f61a05b 527 * \param md_alg message digest algorithm
HannesTschofenig 0:796d0f61a05b 528 * \param oid place to store ASN.1 OID string pointer
HannesTschofenig 0:796d0f61a05b 529 * \param olen length of the OID
HannesTschofenig 0:796d0f61a05b 530 *
HannesTschofenig 0:796d0f61a05b 531 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 532 */
HannesTschofenig 0:796d0f61a05b 533 int oid_get_oid_by_md( md_type_t md_alg, const char **oid, size_t *olen );
HannesTschofenig 0:796d0f61a05b 534
HannesTschofenig 0:796d0f61a05b 535 #if defined(POLARSSL_CIPHER_C)
HannesTschofenig 0:796d0f61a05b 536 /**
HannesTschofenig 0:796d0f61a05b 537 * \brief Translate encryption algorithm OID into cipher_type
HannesTschofenig 0:796d0f61a05b 538 *
HannesTschofenig 0:796d0f61a05b 539 * \param oid OID to use
HannesTschofenig 0:796d0f61a05b 540 * \param cipher_alg place to store cipher algorithm
HannesTschofenig 0:796d0f61a05b 541 *
HannesTschofenig 0:796d0f61a05b 542 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 543 */
HannesTschofenig 0:796d0f61a05b 544 int oid_get_cipher_alg( const asn1_buf *oid, cipher_type_t *cipher_alg );
HannesTschofenig 0:796d0f61a05b 545 #endif /* POLARSSL_CIPHER_C */
HannesTschofenig 0:796d0f61a05b 546
HannesTschofenig 0:796d0f61a05b 547 #if defined(POLARSSL_PKCS12_C)
HannesTschofenig 0:796d0f61a05b 548 /**
HannesTschofenig 0:796d0f61a05b 549 * \brief Translate PKCS#12 PBE algorithm OID into md_type and
HannesTschofenig 0:796d0f61a05b 550 * cipher_type
HannesTschofenig 0:796d0f61a05b 551 *
HannesTschofenig 0:796d0f61a05b 552 * \param oid OID to use
HannesTschofenig 0:796d0f61a05b 553 * \param md_alg place to store message digest algorithm
HannesTschofenig 0:796d0f61a05b 554 * \param cipher_alg place to store cipher algorithm
HannesTschofenig 0:796d0f61a05b 555 *
HannesTschofenig 0:796d0f61a05b 556 * \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
HannesTschofenig 0:796d0f61a05b 557 */
HannesTschofenig 0:796d0f61a05b 558 int oid_get_pkcs12_pbe_alg( const asn1_buf *oid, md_type_t *md_alg,
HannesTschofenig 0:796d0f61a05b 559 cipher_type_t *cipher_alg );
HannesTschofenig 0:796d0f61a05b 560 #endif /* POLARSSL_PKCS12_C */
HannesTschofenig 0:796d0f61a05b 561
HannesTschofenig 0:796d0f61a05b 562 #ifdef __cplusplus
HannesTschofenig 0:796d0f61a05b 563 }
HannesTschofenig 0:796d0f61a05b 564 #endif
HannesTschofenig 0:796d0f61a05b 565
HannesTschofenig 0:796d0f61a05b 566 #endif /* oid.h */
HannesTschofenig 0:796d0f61a05b 567
HannesTschofenig 0:796d0f61a05b 568