blob: 529cf66ae2046275bc3b2d787270f9d7ae564490 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt_private.h"
#ifdef LTC_DER
typedef struct {
enum ltc_oid_id id;
const char* oid;
} oid_table_entry;
static const oid_table_entry pka_oids[] = {
{ PKA_RSA, "1.2.840.113549.1.1.1" },
{ PKA_DSA, "1.2.840.10040.4.1" },
{ PKA_EC, "1.2.840.10045.2.1" },
{ PKA_EC_PRIMEF, "1.2.840.10045.1.1" },
};
/*
Returns the OID requested.
@return CRYPT_OK if valid
*/
int pk_get_oid(enum ltc_oid_id id, const char **st)
{
unsigned int i;
LTC_ARGCHK(st != NULL);
for (i = 0; i < sizeof(pka_oids)/sizeof(pka_oids[0]); ++i) {
if (pka_oids[i].id == id) {
*st = pka_oids[i].oid;
return CRYPT_OK;
}
}
return CRYPT_INVALID_ARG;
}
#endif
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
|