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