Bug 460926 A11y hierachy is broken on Ubuntu 8.10 (GNOME 2.24), r=Evan.Yan sr=roc
[wine-gecko.git] / security / nss / lib / util / secoid.h
blob31bb61d3ef5277f7c2956a878312e787f07f4541
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
12 * License.
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) 1994-2000
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
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 ***** */
37 #ifndef _SECOID_H_
38 #define _SECOID_H_
40 #include "utilrename.h"
43 * secoid.h - public data structures and prototypes for ASN.1 OID functions
45 * $Id: secoid.h,v 1.10 2008/06/14 14:20:38 wtc%google.com Exp $
48 #include "plarena.h"
50 #include "seccomon.h"
51 #include "secoidt.h"
52 #include "secasn1t.h"
54 SEC_BEGIN_PROTOS
56 extern const SEC_ASN1Template SECOID_AlgorithmIDTemplate[];
58 /* This functions simply returns the address of the above-declared template. */
59 SEC_ASN1_CHOOSER_DECLARE(SECOID_AlgorithmIDTemplate)
62 * OID handling routines
64 extern SECOidData *SECOID_FindOID( const SECItem *oid);
65 extern SECOidTag SECOID_FindOIDTag(const SECItem *oid);
66 extern SECOidData *SECOID_FindOIDByTag(SECOidTag tagnum);
67 extern SECOidData *SECOID_FindOIDByMechanism(unsigned long mechanism);
69 /****************************************/
71 ** Algorithm id handling operations
75 ** Fill in an algorithm-ID object given a tag and some parameters.
76 ** "aid" where the DER encoded algorithm info is stored (memory
77 ** is allocated)
78 ** "tag" the tag number defining the algorithm
79 ** "params" if not NULL, the parameters to go with the algorithm
81 extern SECStatus SECOID_SetAlgorithmID(PLArenaPool *arena, SECAlgorithmID *aid,
82 SECOidTag tag, SECItem *params);
85 ** Copy the "src" object to "dest". Memory is allocated in "dest" for
86 ** each of the appropriate sub-objects. Memory in "dest" is not freed
87 ** before memory is allocated (use SECOID_DestroyAlgorithmID(dest, PR_FALSE)
88 ** to do that).
90 extern SECStatus SECOID_CopyAlgorithmID(PLArenaPool *arena, SECAlgorithmID *dest,
91 SECAlgorithmID *src);
94 ** Get the tag number for the given algorithm-id object.
96 extern SECOidTag SECOID_GetAlgorithmTag(SECAlgorithmID *aid);
99 ** Destroy an algorithm-id object.
100 ** "aid" the certificate-request to destroy
101 ** "freeit" if PR_TRUE then free the object as well as its sub-objects
103 extern void SECOID_DestroyAlgorithmID(SECAlgorithmID *aid, PRBool freeit);
106 ** Compare two algorithm-id objects, returning the difference between
107 ** them.
109 extern SECComparison SECOID_CompareAlgorithmID(SECAlgorithmID *a,
110 SECAlgorithmID *b);
112 extern PRBool SECOID_KnownCertExtenOID (SECItem *extenOid);
114 /* Given a tag number, return a string describing it.
116 extern const char *SECOID_FindOIDTagDescription(SECOidTag tagnum);
118 /* Add a dynamic SECOidData to the dynamic OID table.
119 ** Routine copies the src entry, and returns the new SECOidTag.
120 ** Returns SEC_OID_INVALID if failed to add for some reason.
122 extern SECOidTag SECOID_AddEntry(const SECOidData * src);
125 * initialize the oid data structures.
127 extern SECStatus SECOID_Init(void);
130 * free up the oid data structures.
132 extern SECStatus SECOID_Shutdown(void);
134 /* if to->data is not NULL, and to->len is large enough to hold the result,
135 * then the resultant OID will be copyed into to->data, and to->len will be
136 * changed to show the actual OID length.
137 * Otherwise, memory for the OID will be allocated (from the caller's
138 * PLArenaPool, if pool is non-NULL) and to->data will receive the address
139 * of the allocated data, and to->len will receive the OID length.
140 * The original value of to->data is not freed when a new buffer is allocated.
142 * The input string may begin with "OID." and this still be ignored.
143 * The length of the input string is given in len. If len == 0, then
144 * len will be computed as strlen(from), meaning it must be NUL terminated.
145 * It is an error if from == NULL, or if *from == '\0'.
147 extern SECStatus SEC_StringToOID(PLArenaPool *pool, SECItem *to,
148 const char *from, PRUint32 len);
150 SEC_END_PROTOS
152 #endif /* _SECOID_H_ */