1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
14 * The Original Code is the Netscape security libraries.
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 2004
19 * the Initial Developer. All Rights Reserved.
23 * Alternatively, the contents of this file may be used under the terms of
24 * either the GNU General Public License Version 2 or later (the "GPL"), or
25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 * in which case the provisions of the GPL or the LGPL are applicable instead
27 * of those above. If you wish to allow use of your version of this file only
28 * under the terms of either the GPL or the LGPL, and not to allow others to
29 * use your version of this file under the terms of the MPL, indicate your
30 * decision by deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL or the LGPL. If you do not delete
32 * the provisions above, a recipient may use your version of this file under
33 * the terms of any one of the MPL, the GPL or the LGPL.
35 * ***** END LICENSE BLOCK ***** */
38 #include "secmodt.h" /* for CKM_INVALID_MECHANISM */
40 #define OI(x) { siDEROID, (unsigned char *)x, sizeof x }
41 #define OD(oid,tag,desc,mech,ext) { OI(oid), tag, desc, mech, ext }
42 #define ODN(oid,desc) \
43 { OI(oid), 0, desc, CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION }
45 #define OIDT static const unsigned char
47 /* OIW Security Special Interest Group defined algorithms. */
48 #define OIWSSIG 0x2B, 13, 3, 2
50 OIDT oiwMD5RSA
[] = { OIWSSIG
, 3 };
51 OIDT oiwDESCBC
[] = { OIWSSIG
, 7 };
52 OIDT oiwRSAsig
[] = { OIWSSIG
, 11 };
53 OIDT oiwDSA
[] = { OIWSSIG
, 12 };
54 OIDT oiwMD5RSAsig
[] = { OIWSSIG
, 25 };
55 OIDT oiwSHA1
[] = { OIWSSIG
, 26 };
56 OIDT oiwDSASHA1
[] = { OIWSSIG
, 27 };
57 OIDT oiwDSASHA1param
[] = { OIWSSIG
, 28 };
58 OIDT oiwSHA1RSA
[] = { OIWSSIG
, 29 };
61 /* Microsoft OIDs. (1 3 6 1 4 1 311 ... ) */
62 #define MICROSOFT 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37
64 OIDT mCTL
[] = { MICROSOFT
, 10, 3, 1 }; /* Cert Trust List signing */
65 OIDT mTSS
[] = { MICROSOFT
, 10, 3, 2 }; /* Time Stamp Signing */
66 OIDT mSGC
[] = { MICROSOFT
, 10, 3, 3 }; /* Server gated cryptography */
67 OIDT mEFS
[] = { MICROSOFT
, 10, 3, 4 }; /* Encrypted File System */
68 OIDT mSMIME
[] = { MICROSOFT
, 16, 4 }; /* SMIME encryption key prefs */
70 OIDT mECRTT
[] = { MICROSOFT
, 20, 2 }; /* Enrollment cert type xtn */
71 OIDT mEAGNT
[] = { MICROSOFT
, 20, 2, 1 }; /* Enrollment Agent */
72 OIDT mKPSCL
[] = { MICROSOFT
, 20, 2, 2 }; /* KP SmartCard Logon */
73 OIDT mNTPN
[] = { MICROSOFT
, 20, 2, 3 }; /* NT Principal Name */
74 OIDT mCASRV
[] = { MICROSOFT
, 21, 1 }; /* CertServ CA version */
76 /* AOL OIDs (1 3 6 1 4 1 1066 ... ) */
77 #define AOL 0x2B, 0x06, 0x01, 0x04, 0x01, 0x88, 0x2A
79 /* PKIX IDs (1 3 6 1 5 5 7 ...) */
80 #define ID_PKIX 0x2B, 6, 1, 5, 5, 7
81 /* PKIX Access Descriptors (methods for Authority Info Access Extns) */
82 #define ID_AD ID_PKIX, 48
84 OIDT padOCSP
[] = { ID_AD
, 1 }; /* OCSP method */
85 OIDT padCAissuer
[] = { ID_AD
, 2 }; /* URI (for CRL ?) */
86 OIDT padTimeStamp
[] = { ID_AD
, 3 }; /* time stamping */
88 /* ISO Cert Extension type OIDs (id-ce) (2 5 29 ...) */
90 #define X520_ATTRIBUTE_TYPE X500, 0x04
91 #define X500_ALG X500, 0x08
92 #define X500_ALG_ENCRYPTION X500_ALG, 0x01
93 #define ID_CE X500, 29
95 OIDT cePlcyObs
[] = { ID_CE
, 3 }; /* Cert policies, obsolete. */
96 OIDT cePlcyCns
[] = { ID_CE
, 36 }; /* Cert policy constraints. */
98 /* US Company arc (2 16 840 1 ...) */
99 #define USCOM 0x60, 0x86, 0x48, 0x01
100 #define USGOV USCOM, 0x65
101 #define USDOD USGOV, 2
102 #define ID_INFOSEC USDOD, 1
104 /* Verisign PKI OIDs (2 16 840 1 113733 1 ...) */
105 #define VERISIGN_PKI USCOM, 0x86, 0xf8, 0x45, 1
106 #define VERISIGN_XTN VERISIGN_PKI, 6
107 #define VERISIGN_POL VERISIGN_PKI, 7 /* Cert policies */
108 #define VERISIGN_TNET VERISIGN_POL, 23 /* Verisign Trust Network */
110 OIDT vcx7
[] = { VERISIGN_XTN
, 7 }; /* Cert Extension 7 (?) */
111 OIDT vcp1
[] = { VERISIGN_TNET
, 1 }; /* class 1 cert policy */
112 OIDT vcp2
[] = { VERISIGN_TNET
, 2 }; /* class 2 cert policy */
113 OIDT vcp3
[] = { VERISIGN_TNET
, 3 }; /* class 3 cert policy */
114 OIDT vcp4
[] = { VERISIGN_TNET
, 4 }; /* class 4 cert policy */
117 /* ------------------------------------------------------------------- */
118 static const SECOidData oids
[] = {
119 /* OIW Security Special Interest Group OIDs */
120 ODN( oiwMD5RSA
, "OIWSecSIG MD5 with RSA"),
121 ODN( oiwDESCBC
, "OIWSecSIG DES CBC"),
122 ODN( oiwRSAsig
, "OIWSecSIG RSA signature"),
123 ODN( oiwDSA
, "OIWSecSIG DSA"),
124 ODN( oiwMD5RSAsig
, "OIWSecSIG MD5 with RSA signature"),
125 ODN( oiwSHA1
, "OIWSecSIG SHA1"),
126 ODN( oiwDSASHA1
, "OIWSecSIG DSA with SHA1"),
127 ODN( oiwDSASHA1param
, "OIWSecSIG DSA with SHA1 with params"),
128 ODN( oiwSHA1RSA
, "OIWSecSIG MD5 with RSA"),
131 ODN( mCTL
, "Microsoft Cert Trust List signing"),
132 ODN( mTSS
, "Microsoft Time Stamp signing"),
133 ODN( mSGC
, "Microsoft SGC SSL server"),
134 ODN( mEFS
, "Microsoft Encrypted File System"),
135 ODN( mSMIME
, "Microsoft SMIME preferences"),
136 ODN( mECRTT
, "Microsoft Enrollment Cert Type Extension"),
137 ODN( mEAGNT
, "Microsoft Enrollment Agent"),
138 ODN( mKPSCL
, "Microsoft KP SmartCard Logon"),
139 ODN( mNTPN
, "Microsoft NT Principal Name"),
140 ODN( mCASRV
, "Microsoft CertServ CA version"),
143 ODN( padOCSP
, "PKIX OCSP method"),
144 ODN( padCAissuer
, "PKIX CA Issuer method"),
145 ODN( padTimeStamp
, "PKIX Time Stamping method"),
148 ODN( cePlcyObs
, "Certificate Policies (Obsolete)"),
149 ODN( cePlcyCns
, "Certificate Policy Constraints"),
152 ODN( vcx7
, "Verisign Cert Extension 7 (?)"),
153 ODN( vcp1
, "Verisign Class 1 Certificate Policy"),
154 ODN( vcp2
, "Verisign Class 2 Certificate Policy"),
155 ODN( vcp3
, "Verisign Class 3 Certificate Policy"),
156 ODN( vcp4
, "Verisign Class 4 Certificate Policy"),
160 static const unsigned int numOids
= (sizeof oids
) / (sizeof oids
[0]);
163 SECU_RegisterDynamicOids(void)
166 SECStatus rv
= SECSuccess
;
168 for (i
= 0; i
< numOids
; ++i
) {
169 SECOidTag tag
= SECOID_AddEntry(&oids
[i
]);
170 if (tag
== SEC_OID_UNKNOWN
) {
172 #ifdef DEBUG_DYN_OIDS
173 fprintf(stderr
, "Add OID[%d] failed\n", i
);
175 fprintf(stderr
, "Add OID[%d] returned tag %d\n", i
, tag
);