]> git.saurik.com Git - apple/security.git/blob - libsecurity_smime/lib/secoid.h
Security-57337.20.44.tar.gz
[apple/security.git] / libsecurity_smime / lib / secoid.h
1 /*
2 * The contents of this file are subject to the Mozilla Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/MPL/
6 *
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
11 *
12 * The Original Code is the Netscape security libraries.
13 *
14 * The Initial Developer of the Original Code is Netscape
15 * Communications Corporation. Portions created by Netscape are
16 * Copyright (C) 1994-2000 Netscape Communications Corporation. All
17 * Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 * Alternatively, the contents of this file may be used under the
22 * terms of the GNU General Public License Version 2 or later (the
23 * "GPL"), in which case the provisions of the GPL are applicable
24 * instead of those above. If you wish to allow use of your
25 * version of this file only under the terms of the GPL and not to
26 * allow others to use your version of this file under the MPL,
27 * indicate your decision by deleting the provisions above and
28 * replace them with the notice and other provisions required by
29 * the GPL. If you do not delete the provisions above, a recipient
30 * may use your version of this file under either the MPL or the
31 * GPL.
32 */
33
34 #ifndef _SECOID_H_
35 #define _SECOID_H_
36 /*
37 * secoid.h - public data structures and prototypes for ASN.1 OID functions
38 */
39
40 #include <security_asn1/seccomon.h>
41 #include <security_asn1/plarenas.h>
42 #include <Security/secasn1t.h>
43
44 #include <security_smime/secoidt.h>
45
46 SEC_BEGIN_PROTOS
47
48 extern const SecAsn1Template SECOID_AlgorithmIDTemplate[];
49
50 /* This functions simply returns the address of the above-declared template. */
51 SEC_ASN1_CHOOSER_DECLARE(SECOID_AlgorithmIDTemplate)
52
53 /*
54 * OID handling routines
55 */
56 extern SECOidData *SECOID_FindOID(const SecAsn1Item *oid);
57 extern SECOidTag SECOID_FindOIDTag(const SecAsn1Item *oid);
58 extern SECOidData *SECOID_FindOIDByTag(SECOidTag tagnum);
59 extern SECOidData *SECOID_FindOIDByCssmAlgorithm(SecAsn1AlgId cssmAlgorithm);
60
61 /****************************************/
62 /*
63 ** Algorithm id handling operations
64 */
65
66 /*
67 ** Fill in an algorithm-ID object given a tag and some parameters.
68 ** "aid" where the DER encoded algorithm info is stored (memory
69 ** is allocated)
70 ** "tag" the tag defining the algorithm (SEC_OID_*)
71 ** "params" if not NULL, the parameters to go with the algorithm
72 */
73 extern SECStatus SECOID_SetAlgorithmID(PRArenaPool *arena, SECAlgorithmID *aid,
74 SECOidTag tag, const SecAsn1Item *params);
75
76 /*
77 ** Copy the "src" object to "dest". Memory is allocated in "dest" for
78 ** each of the appropriate sub-objects. Memory in "dest" is not freed
79 ** before memory is allocated (use SECOID_DestroyAlgorithmID(dest, PR_FALSE)
80 ** to do that).
81 */
82 extern SECStatus SECOID_CopyAlgorithmID(PRArenaPool *arena, SECAlgorithmID *dest,
83 const SECAlgorithmID *src);
84
85 /*
86 ** Get the SEC_OID_* tag for the given algorithm-id object.
87 */
88 extern SECOidTag SECOID_GetAlgorithmTag(const SECAlgorithmID *aid);
89
90 /*
91 ** Destroy an algorithm-id object.
92 ** "aid" the certificate-request to destroy
93 ** "freeit" if PR_TRUE then free the object as well as its sub-objects
94 */
95 extern void SECOID_DestroyAlgorithmID(SECAlgorithmID *aid, Boolean freeit);
96
97 /*
98 ** Compare two algorithm-id objects, returning the difference between
99 ** them.
100 */
101 extern SECComparison SECOID_CompareAlgorithmID(const SECAlgorithmID *a,
102 const SECAlgorithmID *b);
103
104 extern Boolean SECOID_KnownCertExtenOID (const SecAsn1Item *extenOid);
105
106 /* Given a SEC_OID_* tag, return a string describing it.
107 */
108 extern const char *SECOID_FindOIDTagDescription(SECOidTag tagnum);
109
110 #if 0
111 /*
112 * free up the oid data structures.
113 */
114 extern SECStatus SECOID_Shutdown(void);
115 #endif
116
117
118 SEC_END_PROTOS
119
120 #endif /* _SECOID_H_ */