cryptlib  3.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros
asn1_oids.h
Go to the documentation of this file.
1 /****************************************************************************
2 * *
3 * ASN.1 AlgorithmIdentifier OID Tables *
4 * Copyright Peter Gutmann 1992-2011 *
5 * *
6 ****************************************************************************/
7 
8 /* A table mapping OID's to algorithm types. We take advantage of the fact
9  that object identifiers were designed to be handled in the encoded form
10  (without any need for decoding) and compare expected OID's with the raw
11  encoded form. Some OID's are for pure algorithms, others are for aWithB
12  type combinations (usually encryption + hash). As a variation on this,
13  some algorithms have two (or even more parameters), for example 3DES
14  encryption + CBC mode, or AES encryption + CBC mode + 128-bit key size.
15  In order to deal with this we allow two parameters alongside the main
16  algorithm:
17 
18  Signature: param1 = hash algorithm.
19  Encryption: param1 = mode, param2 = key size (if required).
20  Hash: param1 = block size (if required).
21 
22  In order for the table to work for encoding, the values have to be sorted
23  based on their parameters, so that a given algorithm is followed by its
24  sub-OIDs sorted first on param1 and then param2.
25 
26  There are multiple OID's for RSA, the main ones being rsa (which doesn't
27  specify an exact data format and is deprecated), rsaEncryption (as per
28  PKCS #1, recommended), and rsaSignature (ISO 9796). We use rsaEncryption
29  and its derived forms (e.g. md5WithRSAEncryption) rather than alternatives
30  like md5WithRSA. There is also an OID for rsaKeyTransport that uses
31  PKCS #1 padding but isn't defined by RSADSI.
32 
33  There are a great many OIDs for DSA and/or SHA. We list the less common
34  ones after all the other OIDs so that we always encode the more common
35  form, but can decode many forms (there are even more OIDs for SHA or DSA
36  with common parameters that we don't bother with).
37 
38  AES has a whole series of OIDs that vary depending on the key size used,
39  this usually isn't of any use since we can tell the keysize from other
40  places but is needed in a few situations such as when we're deriving a
41  key into an AES context */
42 
43 typedef struct {
44  const CRYPT_ALGO_TYPE algorithm; /* The basic algorithm */
45  const int param1, param2; /* The algorithm subtype or mode */
46  const ALGOID_CLASS_TYPE algoClass; /* Algorithm class */
47  const BYTE FAR_BSS *oid; /* The OID for this algorithm */
48  } ALGOID_INFO;
49 
50 static const ALGOID_INFO FAR_BSS algoIDinfoTbl[] = {
51  /* RSA and <hash>WithRSA */
53  MKOID( "\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x01\x01" ) },
54  /* rsaEncryption (1 2 840 113549 1 1 1) */
56  MKOID( "\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x01\x04" ) },
57  /* md5withRSAEncryption (1 2 840 113549 1 1 4) */
59  MKOID( "\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x01\x05" ) },
60  /* sha1withRSAEncryption (1 2 840 113549 1 1 5) */
62  MKOID( "\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x01\x05" ) },
63  /* Bug workaround for implementations that erroneously use
64  xxxWithRSA when they should be using straight RSA */
66  MKOID( "\x06\x05\x2B\x0E\x03\x02\x1D" ) },
67  /* Another sha-1WithRSAEncryption (1 3 14 3 2 29) */
69  MKOID( "\x06\x06\x2B\x24\x03\x03\x01\x01" ) },
70  /* Another rsaSignatureWithsha1 (1 3 36 3 3 1 1) */
72  MKOID( "\x06\x06\x2B\x24\x03\x03\x01\x02" ) },
73  /* rsaSignatureWithripemd160 (1 3 36 3 3 1 2) */
74 #ifdef USE_SHA2
76  MKOID( "\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x01\x0B" ) },
77  /* sha256withRSAEncryption (1 2 840 113549 1 1 11) */
79  MKOID( "\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x01\x0B" ) },
80  /* Bug workaround for implementations that erroneously use
81  xxxWithRSA when they should be using straight RSA */
82  #ifdef USE_SHA2_EXT
83  #if defined( CONFIG_SUITEB )
85  MKOID( "\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x01\x0C" ) },
86  /* sha384withRSAEncryption (1 2 840 113549 1 1 12) */
87  #else
89  MKOID( "\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x01\x0D" ) },
90  /* sha512withRSAEncryption (1 2 840 113549 1 1 13) */
91  #endif /* Suite B vs. generic use */
92  #endif /* USE_SHA2_EXT */
93 #endif /* USE_SHA2 */
94 
95  /* DSA and dsaWith<hash> */
96 #ifdef USE_DSA
98  MKOID( "\x06\x07\x2A\x86\x48\xCE\x38\x04\x01" ) },
99  /* dsa (1 2 840 10040 4 1) */
101  MKOID( "\x06\x05\x2B\x0E\x03\x02\x0C" ) },
102  /* Peculiar deprecated dsa (1 3 14 3 2 12), but used by CDSA and the
103  German PKI profile */
105  MKOID( "\x06\x07\x2A\x86\x48\xCE\x38\x04\x03" ) },
106  /* dsaWithSha1 (1 2 840 10040 4 3) */
108  MKOID( "\x06\x05\x2B\x0E\x03\x02\x1B" ) },
109  /* Another dsaWithSHA1 (1 3 14 3 2 27) */
111  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x02\x01\x01\x02" ) },
112  /* Yet another dsaWithSHA-1 (2 16 840 1 101 2 1 1 2) */
114  MKOID( "\x06\x05\x2B\x0E\x03\x02\x0D" ) },
115  /* When they ran out of valid dsaWithSHA's, they started using invalid
116  ones. This one is from JDK 1.1 and is actually dsaWithSHA(-0), but
117  it's used as if it were dsaWithSHA-1 (1 3 14 3 2 13) */
118 #endif /* USE_DSA */
119 
120  /* Elgamal */
121 #ifdef USE_ELGAMAL
123  MKOID( "\x06\x0A\x2B\x06\x01\x04\x01\x97\x55\x01\x02\x01" ) },
124  /* elgamal (1 3 6 1 4 1 3029 1 2 1) */
125 #endif /* USE_ELGAMAL */
126 
127  /* DH */
128 #ifdef USE_DH
130  MKOID( "\x06\x07\x2A\x86\x48\xCE\x3E\x02\x01" ) },
131  /* dhPublicKey (1 2 840 10046 2 1) */
132 #endif /* USE_DH */
133 
134  /* ECDSA and ecdsaWith<hash>. The xxxWithRecommended/Specified are a
135  complex mess and aren't normally used by anything (for example they
136  were explicitly excluded from the PKIX/SMIME specs because there's no
137  point to them) but due to the fact that there's no public use of ECC
138  certs by CAs there are oddball private-label CAs that use them with
139  no correcting factor in the form of rejection by implementations
140  present. For now we ignore them in the hope that the oddball private
141  uses will eventually go away */
142 #ifdef USE_ECDSA
144  MKOID( "\x06\x07\x2A\x86\x48\xCE\x3D\x02\x01" ) },
145  /* ecPublicKey (1 2 840 10045 2 1) */
147  MKOID( "\x06\x07\x2A\x86\x48\xCE\x3D\x04\x01" ) },
148  /* ecdsaWithSHA1 (1 2 840 10045 4 1) */
149  #if 0 /* These are too awkward to support easily, and PKIX says they
150  shouldn't be used anyway */
152  MKOID( "\x06\x07\x2A\x86\x48\xCE\x3D\x04\x02" ) },
153  /* ecdsaWithRecommended (= ...withSHA1) (1 2 840 10045 4 2) */
155  MKOID( "\x06\x07\x2A\x86\x48\xCE\x3D\x04\x03" ) },
156  /* ecdsaWithSpecified (= ...withSHA1) (1 2 840 10045 4 3) */
157  #endif /* 0 */
158 #ifdef USE_SHA2
160  MKOID( "\x06\x08\x2A\x86\x48\xCE\x3D\x04\x03\x02" ) },
161  /* ecdsaWithSHA256 (1 2 840 10045 4 3 2) */
162  #ifdef USE_SHA2_EXT
163  #if defined( CONFIG_SUITEB )
165  MKOID( "\x06\x08\x2A\x86\x48\xCE\x3D\x04\x03\x03" ) },
166  /* ecdsaWithSHA384 (1 2 840 10045 4 3 3) */
167  #else
169  MKOID( "\x06\x08\x2A\x86\x48\xCE\x3D\x04\x03\x04" ) },
170  /* ecdsaWithSHA512 (1 2 840 10045 4 3 4) */
171  #endif /* Suite B vs. generic use */
172  #endif /* USE_SHA2_EXT */
173 #endif /* USE_SHA2 */
174 #endif /* USE_ECDSA */
175 
176  /* Hash algorithms */
177 #ifdef USE_MD5
179  MKOID( "\x06\x08\x2A\x86\x48\x86\xF7\x0D\x02\x05" ) },
180  /* md5 (1 2 840 113549 2 5) */
182  MKOID( "\x06\x08\x02\x82\x06\x01\x0A\x01\x03\x02" ) },
183  /* Another md5 (0 2 262 1 10 1 3 2) */
185  MKOID( "\x06\x0B\x60\x86\x48\x01\x86\xF8\x37\x01\x02\x08\x32" ) },
186  /* Yet another md5 (2 16 840 1 113719 1 2 8 50) */
187 #endif /* USE_MD5 */
189  MKOID( "\x06\x05\x2B\x0E\x03\x02\x1A" ) },
190  /* sha1 (1 3 14 3 2 26) */
192  MKOID( "\x06\x0B\x60\x86\x48\x01\x86\xF8\x37\x01\x02\x08\x52" ) },
193  /* Another sha1 (2 16 840 1 113719 1 2 8 82) */
194 #ifdef USE_RIPEMD160
196  MKOID( "\x06\x05\x2B\x24\x03\x02\x01" ) },
197  /* ripemd160 (1 3 36 3 2 1) */
199  MKOID( "\x06\x08\x02\x82\x06\x01\x0A\x01\x03\x08" ) },
200  /* Another ripemd160 (0 2 262 1 10 1 3 8) */
201 #endif /* USE_RIPEMD160 */
202 #ifdef USE_SHA2
204  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01" ) },
205  /* sha2-256 (2 16 840 1 101 3 4 2 1) */
206  #ifdef USE_SHA2_EXT
207  #if defined( CONFIG_SUITEB )
209  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x02" ) },
210  /* sha2-384 (2 16 840 1 101 3 4 2 2) */
211  #else
213  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03" ) },
214  /* sha2-512 (2 16 840 1 101 3 4 2 3) */
215  #endif /* Suite B vs. generic use */
216  #endif /* USE_SHA2_EXT */
217 #endif /* USE_SHA2 */
218 
219  /* MAC algorithms */
220 #ifdef USE_HMAC_MD5
222  MKOID( "\x06\x08\x2B\x06\x01\x05\x05\x08\x01\x01" ) },
223  /* hmac-MD5 (1 3 6 1 5 5 8 1 1) */
224 #endif /* USE_HMAC_MD5 */
226  MKOID( "\x06\x08\x2B\x06\x01\x05\x05\x08\x01\x02" ) },
227  /* hmac-SHA (1 3 6 1 5 5 8 1 2) */
229  MKOID( "\x06\x08\x2A\x86\x48\x86\xF7\x0D\x02\x07" ) },
230  /* Another hmacWithSHA1 (1 2 840 113549 2 7) */
231 #ifdef USE_HMAC_SHA2
233  MKOID( "\x06\x08\x2A\x86\x48\x86\xF7\x0D\x02\x09" ) },
234  /* hmacWithSHA256 (1 2 840 113549 2 9) */
235 #endif /* USE_HMAC_SHA2 */
236 
237  /* Encryption algorithms */
239  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x01" ) },
240  /* aes128-ECB (2 16 840 1 101 3 4 1 1) */
242  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x15" ) },
243  /* aes192-ECB (2 16 840 1 101 3 4 1 21) */
245  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x29" ) },
246  /* aes256-ECB (2 16 840 1 101 3 4 1 41) */
248  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x02" ) },
249  /* aes128-CBC (2 16 840 1 101 3 4 1 2) */
251  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x16" ) },
252  /* aes192-CBC (2 16 840 1 101 3 4 1 22) */
254  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x2A" ) },
255  /* aes256-CBC (2 16 840 1 101 3 4 1 42) */
257  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x03" ) },
258  /* aes128-OFB (2 16 840 1 101 3 4 1 3) */
260  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x17" ) },
261  /* aes192-OFB (2 16 840 1 101 3 4 1 23) */
263  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x2B" ) },
264  /* aes256-OFB (2 16 840 1 101 3 4 1 43) */
266  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x04" ) },
267  /* aes128-CFB (2 16 840 1 101 3 4 1 4) */
269  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x18" ) },
270  /* aes192-CFB (2 16 840 1 101 3 4 1 24) */
272  MKOID( "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x2C" ) },
273  /* aes256-CFB (2 16 840 1 101 3 4 1 44) */
275  MKOID( "\x06\x0A\x2B\x06\x01\x04\x01\x97\x55\x01\x01\x01" ) },
276  /* blowfishECB (1 3 6 1 4 1 3029 1 1 1) */
278  MKOID( "\x06\x0A\x2B\x06\x01\x04\x01\x97\x55\x01\x01\x02" ) },
279  /* blowfishCBC (1 3 6 1 4 1 3029 1 1 2) */
281  MKOID( "\x06\x0A\x2B\x06\x01\x04\x01\x97\x55\x01\x01\x03" ) },
282  /* blowfishCFB (1 3 6 1 4 1 3029 1 1 3) */
284  MKOID( "\x06\x0A\x2B\x06\x01\x04\x01\x97\x55\x01\x01\x04" ) },
285  /* blowfishOFB (1 3 6 1 4 1 3029 1 1 4) */
287  MKOID( "\x06\x05\x2B\x0E\x03\x02\x06" ) },
288  /* desECB (1 3 14 3 2 6) */
290  MKOID( "\x06\x09\x02\x82\x06\x01\x0A\x01\x02\x02\x01" ) },
291  /* Another desECB (0 2 262 1 10 1 2 2 1) */
293  MKOID( "\x06\x05\x2B\x0E\x03\x02\x07" ) },
294  /* desCBC (1 3 14 3 2 7) */
296  MKOID( "\x06\x09\x02\x82\x06\x01\x0A\x01\x02\x02\x02" ) },
297  /* Another desCBC (0 2 262 1 10 1 2 2 2) */
299  MKOID( "\x06\x05\x2B\x0E\x03\x02\x08" ) },
300  /* desOFB (1 3 14 3 2 8) */
302  MKOID( "\x06\x09\x02\x82\x06\x01\x0A\x01\x02\x02\x03" ) },
303  /* Another desOFB (0 2 262 1 10 1 2 2 3) */
305  MKOID( "\x06\x05\x2B\x0E\x03\x02\x09" ) },
306  /* desCFB (1 3 14 3 2 9) */
308  MKOID( "\x06\x09\x02\x82\x06\x01\x0A\x01\x02\x02\x05" ) },
309  /* Another desCFB (0 2 262 1 10 1 2 2 5) */
311  MKOID( "\x06\x08\x2A\x86\x48\x86\xF7\x0D\x03\x07" ) },
312  /* des-EDE3-CBC (1 2 840 113549 3 7) */
314  MKOID( "\x06\x09\x02\x82\x06\x01\x0A\x01\x02\x03\x02" ) },
315  /* Another des3CBC (0 2 262 1 10 1 2 3 2) */
316 #ifdef USE_RC2
318  MKOID( "\x06\x08\x2A\x86\x48\x86\xF7\x0D\x03\x02" ) },
319  /* rc2CBC (1 2 840 113549 3 2) */
321  MKOID( "\x06\x08\x2A\x86\x48\x86\xF7\x0D\x03\x03" ) },
322  /* rc2ECB (1 2 840 113549 3 3) */
323 #endif /* USE_RC2 */
324 #ifdef USE_RC4
326  MKOID( "\x06\x08\x2A\x86\x48\x86\xF7\x0D\x03\x04" ) },
327  /* rc4 (1 2 840 113549 3 4) */
328 #endif /* USE_RC4 */
329 #ifdef USE_RC5
331  MKOID( "\x06\x08\x2A\x86\x48\x86\xF7\x0D\x03\x09" ) },
332  /* rC5-CBCPad (1 2 840 113549 3 9) */
334  MKOID( "\x06\x08\x2A\x86\x48\x86\xF7\x0D\x03\x08" ) },
335  /* rc5CBC (sometimes used interchangeably with the above) (1 2 840 113549 3 8) */
336 #endif /* USE_RC5 */
337 
338  /* Authenticated encryption algorithms */
339  { CRYPT_IALGO_GENERIC_SECRET, 16, 0, ALGOID_CLASS_AUTHENC,
340  MKOID( "\x06\x0B\x2A\x86\x48\x86\xF7\x0D\x01\x09\x10\x03\x0F" ) },
341  /* authEnc128 (1 2 840 113549 1 9 16 3 15) */
342  { CRYPT_IALGO_GENERIC_SECRET, 32, 0, ALGOID_CLASS_AUTHENC,
343  MKOID( "\x06\x0B\x2A\x86\x48\x86\xF7\x0D\x01\x09\x10\x03\x10" ) },
344  /* authEnc128 (1 2 840 113549 1 9 16 3 16) */
345 
348  };