Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cOID.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cOID_H
7 #define _INC_cOID_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../GrayLibBase.h"
13 #include "../Hash/cHashCode.h" // SSL_Hash_TYPE
14 #include "../Key/cKeyBase.h" // SSL_Key_TYPE
15 #include "../Key/cECPGroupParams.h" // ECPGroup_TYPE
16 #include "../Cipher/cCipherTypeDef.h" // SSL_Cipher_TYPE
17 #include "../Cert/cX509.h" // X509_EXT_t
19 
20 namespace GrayLib
21 {
22  //
23  // Top level OID tuples
24  //
25 #define OID_ISO_MEMBER_BODIES "\x2a" // {iso(1) member-body(2)}
26 #define OID_ISO_IDENTIFIED_ORG "\x2b" // {iso(1) identified-organization(3)}
27 #define OID_ISO_CCITT_DS "\x55" // {joint-iso-ccitt(2) ds(5)}
28 #define OID_ISO_ITU_COUNTRY "\x60" // {joint-iso-itu-t(2) country(16)}
29 
30  //
31  // ISO Member bodies OID parts
32  //
33 #define OID_COUNTRY_US "\x86\x48" // {us(840)}
34 #define OID_ORG_RSA_DATA_SECURITY "\x86\xf7\x0d" // {rsadsi(113549)}
35 #define OID_RSA_COMPANY OID_ISO_MEMBER_BODIES OID_COUNTRY_US OID_ORG_RSA_DATA_SECURITY // {iso(1) member-body(2) us(840) rsadsi(113549)}
36 #define OID_ORG_ANSI_X9_62 "\xce\x3d" // ansi-X9-62(10045)
37 #define OID_ANSI_X9_62 OID_ISO_MEMBER_BODIES OID_COUNTRY_US OID_ORG_ANSI_X9_62
38 
39  //
40  // ISO Identified organization OID parts
41  //
42 #define OID_ORG_DOD "\x06" // {dod(6)}
43 #define OID_ORG_OIW "\x0e"
44 #define OID_OIW_SECSIG OID_ORG_OIW "\x03"
45 #define OID_OIW_SECSIG_ALG OID_OIW_SECSIG "\x02"
46 #define OID_OIW_SECSIG_SHA1 OID_OIW_SECSIG_ALG "\x1a"
47 #define OID_ORG_CERTICOM "\x81\x04" // certicom(132)
48 #define OID_CERTICOM OID_ISO_IDENTIFIED_ORG OID_ORG_CERTICOM
49 #define OID_ORG_TELETRUST "\x24" // teletrust(36)
50 #define OID_TELETRUST OID_ISO_IDENTIFIED_ORG OID_ORG_TELETRUST
51 
52  //
53  // ISO ITU OID parts
54  //
55 #define OID_ORGANIZATION "\x01" // {organization(1)}
56 #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)}
57 
58 #define OID_ORG_GOV "\x65" // {gov(101)}
59 #define OID_GOV OID_ISO_ITU_US_ORG OID_ORG_GOV // {joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101)}
60 #define OID_ORG_NETSCAPE "\x86\xF8\x42" // {netscape(113730)}
61 #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)}
62  // ISO arc for standard certificate and CRL extensions
63 #define OID_ID_CE OID_ISO_CCITT_DS "\x1D"
64  //
65  // Private Internet Extensions
66  // { iso(1) identified-organization(3) dod(6) internet(1)
68  //
69 #define OID_PKIX OID_ISO_IDENTIFIED_ORG OID_ORG_DOD "\x01\x05\x05\x07"
70 
71  //
72  // Arc for standard naming attributes
73  //
74 #define OID_AT OID_ISO_CCITT_DS "\x04"
75 #define OID_AT_CN OID_AT "\x03"
76 #define OID_AT_SUR_NAME OID_AT "\x04"
77 #define OID_AT_SERIAL_NUMBER OID_AT "\x05"
78 #define OID_AT_COUNTRY OID_AT "\x06"
79 #define OID_AT_LOCALITY OID_AT "\x07"
80 #define OID_AT_STATE OID_AT "\x08"
81 #define OID_AT_ORGANIZATION OID_AT "\x0A"
82 #define OID_AT_ORG_UNIT OID_AT "\x0B"
83 #define OID_AT_TITLE OID_AT "\x0C"
84 #define OID_AT_POSTAL_ADDRESS OID_AT "\x10"
85 #define OID_AT_POSTAL_CODE OID_AT "\x11"
86 #define OID_AT_GIVEN_NAME OID_AT "\x2A"
87 #define OID_AT_INITIALS OID_AT "\x2B"
88 #define OID_AT_GENERATION_QUALIFIER OID_AT "\x2C"
89 #define OID_AT_UNIQUE_IDENTIFIER OID_AT "\x2D"
90 #define OID_AT_DN_QUALIFIER OID_AT "\x2E"
91 #define OID_AT_PSEUDONYM OID_AT "\x41"
92 
93 #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)}
94  //
95  // OIDs for standard certificate extensions
96  //
97 #define OID_AUTHORITY_KEY_IDENTIFIER OID_ID_CE "\x23"
98 #define OID_SUBJECT_KEY_IDENTIFIER OID_ID_CE "\x0E"
99 #define OID_KEY_USAGE OID_ID_CE "\x0F"
100 #define OID_CERTIFICATE_POLICIES OID_ID_CE "\x20"
101 #define OID_POLICY_MAPPINGS OID_ID_CE "\x21"
102 #define OID_SUBJECT_ALT_NAME OID_ID_CE "\x11"
103 #define OID_ISSUER_ALT_NAME OID_ID_CE "\x12"
104 #define OID_SUBJECT_DIRECTORY_ATTRS OID_ID_CE "\x09"
105 #define OID_BASIC_CONSTRAINTS OID_ID_CE "\x13"
106 #define OID_NAME_CONSTRAINTS OID_ID_CE "\x1E"
107 #define OID_POLICY_CONSTRAINTS OID_ID_CE "\x24"
108 #define OID_EXTENDED_KEY_USAGE OID_ID_CE "\x25"
109 #define OID_CRL_DISTRIBUTION_POINTS OID_ID_CE "\x1F"
110 #define OID_INIHIBIT_ANYPOLICY OID_ID_CE "\x36"
111 #define OID_FRESHEST_CRL OID_ID_CE "\x2E"
112 
113  //
114  // Netscape certificate extensions
115  //
116 #define OID_NS_CERT OID_NETSCAPE "\x01"
117 #define OID_NS_CERT_TYPE OID_NS_CERT "\x01"
118 #define OID_NS_BASE_URL OID_NS_CERT "\x02"
119 #define OID_NS_REVOCATION_URL OID_NS_CERT "\x03"
120 #define OID_NS_CA_REVOCATION_URL OID_NS_CERT "\x04"
121 #define OID_NS_RENEWAL_URL OID_NS_CERT "\x07"
122 #define OID_NS_CA_POLICY_URL OID_NS_CERT "\x08"
123 #define OID_NS_SSL_SERVER_NAME OID_NS_CERT "\x0C"
124 #define OID_NS_COMMENT OID_NS_CERT "\x0D"
125 #define OID_NS_DATA_TYPE OID_NETSCAPE "\x02"
126 #define OID_NS_CERT_SEQUENCE OID_NS_DATA_TYPE "\x05"
127 
128  //
129  // OIDs for CRL extensions
130  //
131 #define OID_PRIVATE_KEY_USAGE_PERIOD OID_ID_CE "\x10"
132 #define OID_CRL_NUMBER OID_ID_CE "\x14"
133 
134  //
135  // X.509 v3 Extended key usage OIDs
136  //
137 #define OID_ANY_EXTENDED_KEY_USAGE OID_EXTENDED_KEY_USAGE "\x00"
138 
139 #define OID_KP OID_PKIX "\x03"
140 #define OID_SERVER_AUTH OID_KP "\x01"
141 #define OID_CLIENT_AUTH OID_KP "\x02"
142 #define OID_CODE_SIGNING OID_KP "\x03"
143 #define OID_EMAIL_PROTECTION OID_KP "\x04"
144 #define OID_TIME_STAMPING OID_KP "\x08"
145 #define OID_OCSP_SIGNING OID_KP "\x09"
146  //
147  // PKCS definition OIDs
148  //
149 
150 #define OID_PKCS OID_RSA_COMPANY "\x01"
151 #define OID_PKCS1 OID_PKCS "\x01"
152 #define OID_PKCS5 OID_PKCS "\x05"
153 #define OID_PKCS9 OID_PKCS "\x09"
154 #define OID_PKCS12 OID_PKCS "\x0c"
155  //
156  // PKCS#1 OIDs
157  //
158 #define OID_PKCS1_RSA OID_PKCS1 "\x01"
159 #define OID_PKCS1_MD2 OID_PKCS1 "\x02"
160 #define OID_PKCS1_MD4 OID_PKCS1 "\x03"
161 #define OID_PKCS1_MD5 OID_PKCS1 "\x04"
162 #define OID_PKCS1_SHA1 OID_PKCS1 "\x05"
163 #define OID_PKCS1_SHA224 OID_PKCS1 "\x0e"
164 #define OID_PKCS1_SHA256 OID_PKCS1 "\x0b"
165 #define OID_PKCS1_SHA384 OID_PKCS1 "\x0c"
166 #define OID_PKCS1_SHA512 OID_PKCS1 "\x0d"
167 
168 #define OID_RSA_SHA_OBS "\x2B\x0E\x03\x02\x1D"
169 
170 #define OID_PKCS9_EMAIL OID_PKCS9 "\x01"
171  // RFC 4055
172 #define OID_RSASSA_PSS OID_PKCS1 "\x0a"
173 #define OID_MGF1 OID_PKCS1 "\x08"
174  //
175  // Digest algorithms
176  //
177 #define OID_DIGEST_ALG_MD2 OID_RSA_COMPANY "\x02\x02"
178 #define OID_DIGEST_ALG_MD4 OID_RSA_COMPANY "\x02\x04"
179 #define OID_DIGEST_ALG_MD5 OID_RSA_COMPANY "\x02\x05"
180 #define OID_DIGEST_ALG_SHA1 OID_ISO_IDENTIFIED_ORG OID_OIW_SECSIG_SHA1
181 #define OID_DIGEST_ALG_SHA224 OID_GOV "\x03\x04\x02\x04"
182 #define OID_DIGEST_ALG_SHA256 OID_GOV "\x03\x04\x02\x01"
183 
184 #define OID_DIGEST_ALG_SHA384 OID_GOV "\x03\x04\x02\x02"
185 #define OID_DIGEST_ALG_SHA512 OID_GOV "\x03\x04\x02\x03"
186 #define OID_HMAC_SHA1 OID_RSA_COMPANY "\x02\x07"
187  //
188  // Encryption algorithms
189  //
190 #define OID_DES_CBC OID_ISO_IDENTIFIED_ORG OID_OIW_SECSIG_ALG "\x07"
191 #define OID_DES_EDE3_CBC OID_RSA_COMPANY "\x03\x07"
192 
193  //
194  // PKCS#5 OIDs
195  //
196 #define OID_PKCS5_PBKDF2 OID_PKCS5 "\x0c"
197 #define OID_PKCS5_PBES2 OID_PKCS5 "\x0d"
198 #define OID_PKCS5_PBMAC1 OID_PKCS5 "\x0e"
199 
200  //
201  // PKCS#5 PBES1 algorithms
202  //
203 #define OID_PKCS5_PBE_MD2_DES_CBC OID_PKCS5 "\x01"
204 #define OID_PKCS5_PBE_MD2_RC2_CBC OID_PKCS5 "\x04"
205 #define OID_PKCS5_PBE_MD5_DES_CBC OID_PKCS5 "\x03"
206 #define OID_PKCS5_PBE_MD5_RC2_CBC OID_PKCS5 "\x06"
207 #define OID_PKCS5_PBE_SHA1_DES_CBC OID_PKCS5 "\x0a"
208 #define OID_PKCS5_PBE_SHA1_RC2_CBC OID_PKCS5 "\x0b"
209 
210  //
211  // PKCS#8 OIDs
212  //
213 #define OID_PKCS9_CSR_EXT_REQ OID_PKCS9 "\x0e"
214 
215  //
216  // PKCS#12 PBE OIDs
217  //
218 #define OID_PKCS12_PBE OID_PKCS12 "\x01"
219 
220 #define OID_PKCS12_PBE_SHA1_RC4_128 OID_PKCS12_PBE "\x01"
221 #define OID_PKCS12_PBE_SHA1_RC4_40 OID_PKCS12_PBE "\x02"
222 #define OID_PKCS12_PBE_SHA1_DES3_EDE_CBC OID_PKCS12_PBE "\x03"
223 #define OID_PKCS12_PBE_SHA1_DES2_EDE_CBC OID_PKCS12_PBE "\x04"
224 #define OID_PKCS12_PBE_SHA1_RC2_128_CBC OID_PKCS12_PBE "\x05"
225 #define OID_PKCS12_PBE_SHA1_RC2_40_CBC OID_PKCS12_PBE "\x06"
226  //
227  // EC key algorithms from RFC 5480
228  //
229 
230  // id-ecPublicKey OBJECT IDENTIFIER ::= {
231  // iso(1) member-body(2) us(840) ansi-X9-62(10045) keyType(2) 1 }
232 #define OID_EC_ALG_UNRESTRICTED OID_ANSI_X9_62 "\x02\01"
233 
234  // id-ecDH OBJECT IDENTIFIER ::= {
235  // iso(1) identified-organization(3) certicom(132)
236  // schemes(1) ecdh(12) }
237 #define OID_EC_ALG_ECDH OID_CERTICOM "\x01\x0c"
238 
239  //
240  // ECParameters namedCurve identifiers, from RFC 5480, RFC 5639, and SEC2
241  //
242 
243  // secp192r1 OBJECT IDENTIFIER ::= {
244  // iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3) prime(1) 1 }
245 #define OID_EC_GRP_secp192r1 OID_ANSI_X9_62 "\x03\x01\x01"
246 
247  // secp224r1 OBJECT IDENTIFIER ::= {
248  // iso(1) identified-organization(3) certicom(132) curve(0) 33 }
249 #define OID_EC_GRP_secp224r1 OID_CERTICOM "\x00\x21"
250 
251  // secp256r1 OBJECT IDENTIFIER ::= {
252  // iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3) prime(1) 7 }
253 #define OID_EC_GRP_secp256r1 OID_ANSI_X9_62 "\x03\x01\x07"
254 
255  // secp384r1 OBJECT IDENTIFIER ::= {
256  // iso(1) identified-organization(3) certicom(132) curve(0) 34 }
257 #define OID_EC_GRP_secp384r1 OID_CERTICOM "\x00\x22"
258 
259  // secp521r1 OBJECT IDENTIFIER ::= {
260  // iso(1) identified-organization(3) certicom(132) curve(0) 35 }
261 #define OID_EC_GRP_secp521r1 OID_CERTICOM "\x00\x23"
262 
263  // secp192k1 OBJECT IDENTIFIER ::= {
264  // iso(1) identified-organization(3) certicom(132) curve(0) 31 }
265 #define OID_EC_GRP_secp192k1 OID_CERTICOM "\x00\x1f"
266 
267  // secp224k1 OBJECT IDENTIFIER ::= {
268  // iso(1) identified-organization(3) certicom(132) curve(0) 32 }
269 #define OID_EC_GRP_secp224k1 OID_CERTICOM "\x00\x20"
270 
271  // secp256k1 OBJECT IDENTIFIER ::= {
272  // iso(1) identified-organization(3) certicom(132) curve(0) 10 }
273 #define OID_EC_GRP_secp256k1 OID_CERTICOM "\x00\x0a"
274 
275  // RFC 5639 4.1
276  // ecStdCurvesAndGeneration OBJECT IDENTIFIER::= {iso(1)
277  // identified-organization(3) teletrust(36) algorithm(3) signature-
278  // algorithm(3) ecSign(2) 8}
279  // ellipticCurve OBJECT IDENTIFIER ::= {ecStdCurvesAndGeneration 1}
280  // versionOne OBJECT IDENTIFIER ::= {ellipticCurve 1}
281 #define OID_EC_BRAINPOOL_V1 OID_TELETRUST "\x03\x03\x02\x08\x01\x01"
282 
283  // brainpoolP256r1 OBJECT IDENTIFIER ::= {versionOne 7}
284 #define OID_EC_GRP_brainpoolP256r1 OID_EC_BRAINPOOL_V1 "\x07"
285 
286  // brainpoolP384r1 OBJECT IDENTIFIER ::= {versionOne 11}
287 #define OID_EC_GRP_brainpoolP384r1 OID_EC_BRAINPOOL_V1 "\x0B"
288 
289  // brainpoolP512r1 OBJECT IDENTIFIER ::= {versionOne 13}
290 #define OID_EC_GRP_brainpoolP512r1 OID_EC_BRAINPOOL_V1 "\x0D"
291 
292  //
293  // SEC1 C.1
294  //
295  // prime-field OBJECT IDENTIFIER ::= { id-fieldType 1 }
296  // id-fieldType OBJECT IDENTIFIER ::= { ansi-X9-62 fieldType(1)}
297  //
298 #define OID_ANSI_X9_62_FIELD_TYPE OID_ANSI_X9_62 "\x01"
299 #define OID_ANSI_X9_62_PRIME_FIELD OID_ANSI_X9_62_FIELD_TYPE "\x01"
300 
301  //
302  // ECDSA signature identifiers, from RFC 5480
303  //
304 #define OID_ANSI_X9_62_SIG OID_ANSI_X9_62 "\x04" // signatures(4)
305 #define OID_ANSI_X9_62_SIG_SHA2 OID_ANSI_X9_62_SIG "\x03" // ecdsa-with-SHA2(3)
306 
307  // ecdsa-with-SHA1 OBJECT IDENTIFIER ::= {
308  // iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4) 1 }
309 #define OID_ECDSA_SHA1 OID_ANSI_X9_62_SIG "\x01"
310 
311  // ecdsa-with-SHA224 OBJECT IDENTIFIER ::= {
312  // iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4)
313  // ecdsa-with-SHA2(3) 1 }
314 #define OID_ECDSA_SHA224 OID_ANSI_X9_62_SIG_SHA2 "\x01"
315 
316  // ecdsa-with-SHA256 OBJECT IDENTIFIER ::= {
317  // iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4)
318  // ecdsa-with-SHA2(3) 2 }
319 #define OID_ECDSA_SHA256 OID_ANSI_X9_62_SIG_SHA2 "\x02"
320 
321  // ecdsa-with-SHA384 OBJECT IDENTIFIER ::= {
322  // iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4)
323  // ecdsa-with-SHA2(3) 3 }
324 #define OID_ECDSA_SHA384 OID_ANSI_X9_62_SIG_SHA2 "\x03"
325 
326  // ecdsa-with-SHA512 OBJECT IDENTIFIER ::= {
327  // iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4)
328  // ecdsa-with-SHA2(3) 4 }
329 #define OID_ECDSA_SHA512 OID_ANSI_X9_62_SIG_SHA2 "\x04"
330 
331  struct GRAYLIB_LINK cOIDDefBase // static init defs
332  {
336 
337  const char* m_oid;
338  size_t m_oid_len;
339 
340  const char* m_name;
341  const char* m_description;
342 
343  public:
344  bool isLast() const
345  {
347  return m_oid == nullptr; // nullptr always indicates end of list.
348  }
349 
350  const cOIDDefBase* FindAsn1(const BYTE* pOid, size_t nSizeOid, size_t nSizeElement = sizeof(cOIDDefBase)) const
351  {
353  const cOIDDefBase* p = this;
354  while (!p->isLast())
355  {
356  // Match only up to length of m_oid
357  if (p->m_oid_len <= nSizeOid)
358  {
359  if (::memcmp(p->m_oid, pOid, p->m_oid_len)==0)
360  return p;
361  }
362  p = (const cOIDDefBase*)(((const BYTE*)p) + nSizeElement);
363  }
364  return nullptr;
365  }
366 
367  const char* GetDesc(const cMemBlock& oid, size_t nSizeElement) const
368  {
369  const cOIDDefBase* p = FindAsn1(oid.get_DataBytes(), oid.get_DataSize(), nSizeElement);
370  if (p == nullptr)
371  return nullptr;
372  return p->m_description;
373  }
374  };
375 
376  template <class T>
377  struct cOIDDefT1 : public cOIDDefBase // static init
378  {
383  public:
384  T m_key1; // extra info for the OID
385  public:
387  : cOIDDefBase(b)
388  , m_key1(k1)
389  {}
390 
391  const THIS_t* FindAsn1(const BYTE* pOid, size_t nSizeOid) const
392  {
393  return (const THIS_t*)cOIDDefBase::FindAsn1(pOid, nSizeOid, sizeof(*this));
394  }
395 
396  bool GetKey1(const cMemBlock& oid, T* pKey1) const
397  {
398  const THIS_t* p = FindAsn1(oid.get_DataBytes(), oid.get_DataSize());
399  if (p == nullptr)
400  return false;
401  *pKey1 = p->m_key1;
402  return true;
403  }
404  const THIS_t* FindKey1(T key1) const
405  {
406  const THIS_t* p = this;
407  while (!p->isLast())
408  {
409  if (p->m_key1 == key1)
410  return p;
411  p++;
412  }
413  return nullptr;
414  }
415  };
416 
417  template <class T1, class T2>
418  struct cOIDDefT2 : public cOIDDefT1<T1> // static init
419  {
422 
425  public:
426  T2 m_key2; // extra info for the OID
427  public:
428  cOIDDefT2(cOIDDefBase b, T1 k1, T2 k2)
429  : cOIDDefT1<T1>(b, k1), m_key2(k2)
430  {}
431 
432  const THIS_t* FindAsn1(const BYTE* pOid, size_t nSizeOid) const
433  {
434  return (const THIS_t*)cOIDDefBase::FindAsn1(pOid, nSizeOid, sizeof(*this));
435  }
436  bool GetKey2(const cMemBlock& oid, T1* pKey1, T2* pKey2) const
437  {
438  const THIS_t* p = FindAsn1(oid.get_DataBytes(), oid.get_DataSize());
439  if (p == nullptr)
440  return false;
441  *pKey1 = p->m_key1;
442  *pKey2 = p->m_key2;
443  return true;
444  }
445  const THIS_t* FindKey2(T1 key1, T2 key2) const
446  {
447  const THIS_t* p = this;
448  while (!p->isLast())
449  {
450  if (p->m_key1 == key1 && p->m_key2 == key2)
451  return p;
452  p++;
453  }
454  return nullptr;
455  }
456  };
457 
458  struct GRAYLIB_LINK cOID // static
459  {
462 
463  static const cOIDDefT1<const char*> k_oid_x520_attr_type[];
464  static const cOIDDefBase k_oid_ext_key_usage[];
465  static const cOIDDefT2<SSL_Hash_TYPE, SSL_Key_TYPE> k_oid_sig_alg[];
466  static const cOIDDefT1<SSL_Key_TYPE> k_oid_KeyAlg[];
467  static const cOIDDefT1<ECPGroup_TYPE> k_oid_ecp_grp[];
468  static const cOIDDefT1<SSL_Hash_TYPE> k_oid_hash_def[];
469 
472  static const char* GRAYCALL FindAttrShortName(const cMemBlock& oid);
473 
474  static const cOIDDefBase* GRAYCALL FindOIDForAttr(const char* name, StrLen_t name_len);
475 
477  static bool GRAYCALL FindX509_EXT(const cMemBlock& oid, OUT X509_EXT_t& ext_type);
478 
480  static bool GRAYCALL FindPrivateKeyType(const cMemBlock& oid, SSL_Key_TYPE& eKeyType);
481 
483  static const cOIDDefBase* GRAYCALL FindOIDForPrivateKeyType(SSL_Key_TYPE eKeyType);
484 
486  static bool GRAYCALL FindECPGroupId(const cMemBlock& oid, ECPGroup_TYPE& eECPGroupId);
487 
489  static const cOIDDefBase* GRAYCALL FindOIDForECPGroupId(ECPGroup_TYPE eECPGroupId);
490 
492  static bool GRAYCALL ReadSigAlg(const cASNBuf& oid, OUT cKeySigAlg& sigalg);
493 
495  static const char* GRAYCALL ReadSigAlgDesc(const cASNBuf& oid);
496 
498  static const cOIDDefBase* GRAYCALL FindOIDForSigAlg(const cKeySigAlg& sigalg);
499 
501  static bool GRAYCALL ReadHashType(const cMemBlock& oid, OUT SSL_Hash_TYPE& reHashType);
502 
504  static const char* GRAYCALL GetExt_ExtKeyUsage(const cASNBuf& oid);
505 
507  static const cOIDDefBase* GRAYCALL FindOIDForHashType(SSL_Hash_TYPE eHashType);
508 
510  static bool GRAYCALL FindCipherType(const cASNBuf& oid, SSL_Cipher_TYPE& reCipherType);
511 
513  static bool GRAYCALL FindPkcs12Pbe(const cASNBuf& oid, SSL_Hash_TYPE& reHashType, SSL_Cipher_TYPE& reCipherType);
514 
515  static StrLen_t GRAYCALL MakeNumDotStr(StrBuilder& s, const BYTE* pOid, size_t nSizeOid);
516  static const cOIDDefBase* GRAYCALL FindAny(const BYTE* pOid, size_t nSizeOid);
517  static StrLen_t GRAYCALL MakeStr(StrBuilder& s, const cASNBuf& oid);
518  };
519 };
520 
521 #endif // _INC_cOID_H
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
Definition: cASN.h:78
Definition: StrBuilder.h:18
Definition: cMem.h:311
BYTE * get_DataBytes() const noexcept
Definition: cMem.h:354
size_t get_DataSize() const noexcept
Definition: cMem.h:344
Definition: cMesh.h:22
ECPGroup_TYPE
Definition: cECPGroupParams.h:28
SSL_Cipher_TYPE
Definition: cCipherTypeDef.h:22
X509_EXT_t
Definition: cX509.h:71
SSL_Key_TYPE
Definition: cKeyBase.h:24
SSL_Hash_TYPE
Definition: cHashCode.h:23
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
Definition: cKeyBase.h:40
Definition: cOID.h:332
const char * GetDesc(const cMemBlock &oid, size_t nSizeElement) const
Definition: cOID.h:367
size_t m_oid_len
length of m_oid above
Definition: cOID.h:338
const char * m_description
human friendly description. default for m_key1
Definition: cOID.h:341
const char * m_oid
ASN.1 OID representation (as string sort of)
Definition: cOID.h:337
const char * m_name
official name (e.g. from RFC)
Definition: cOID.h:340
const cOIDDefBase * FindAsn1(const BYTE *pOid, size_t nSizeOid, size_t nSizeElement=sizeof(cOIDDefBase)) const
Definition: cOID.h:350
bool isLast() const
Definition: cOID.h:344
Definition: cOID.h:378
cOIDDefBase SUPER_t
Definition: cOID.h:381
const THIS_t * FindAsn1(const BYTE *pOid, size_t nSizeOid) const
Definition: cOID.h:391
T m_key1
Definition: cOID.h:384
cOIDDefT1(cOIDDefBase b, T k1)
Definition: cOID.h:386
cOIDDefT1< T > THIS_t
Definition: cOID.h:382
const THIS_t * FindKey1(T key1) const
Definition: cOID.h:404
bool GetKey1(const cMemBlock &oid, T *pKey1) const
Definition: cOID.h:396
Definition: cOID.h:419
const THIS_t * FindAsn1(const BYTE *pOid, size_t nSizeOid) const
Definition: cOID.h:432
bool GetKey2(const cMemBlock &oid, T1 *pKey1, T2 *pKey2) const
Definition: cOID.h:436
cOIDDefT1< T1 > SUPER_t
Definition: cOID.h:423
cOIDDefT2< T1, T2 > THIS_t
Definition: cOID.h:424
const THIS_t * FindKey2(T1 key1, T2 key2) const
Definition: cOID.h:445
cOIDDefT2(cOIDDefBase b, T1 k1, T2 k2)
Definition: cOID.h:428
T2 m_key2
Definition: cOID.h:426
Definition: cOID.h:459