Back to index

lightning-sunbird  0.9+nobinonly
secoid.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is the Netscape security libraries.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Netscape Communications Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 1994-2000
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPL"), or
00025  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00026  * in which case the provisions of the GPL or the LGPL are applicable instead
00027  * of those above. If you wish to allow use of your version of this file only
00028  * under the terms of either the GPL or the LGPL, and not to allow others to
00029  * use your version of this file under the terms of the MPL, indicate your
00030  * decision by deleting the provisions above and replace them with the notice
00031  * and other provisions required by the GPL or the LGPL. If you do not delete
00032  * the provisions above, a recipient may use your version of this file under
00033  * the terms of any one of the MPL, the GPL or the LGPL.
00034  *
00035  * ***** END LICENSE BLOCK ***** */
00036 
00037 #ifndef _SECOID_H_
00038 #define _SECOID_H_
00039 /*
00040  * secoid.h - public data structures and prototypes for ASN.1 OID functions
00041  *
00042  * $Id: secoid.h,v 1.6 2004/04/25 15:03:18 gerv%gerv.net Exp $
00043  */
00044 
00045 #include "plarena.h"
00046 
00047 #include "seccomon.h"
00048 #include "secoidt.h"
00049 #include "secasn1t.h"
00050 
00051 SEC_BEGIN_PROTOS
00052 
00053 extern const SEC_ASN1Template SECOID_AlgorithmIDTemplate[];
00054 
00055 /* This functions simply returns the address of the above-declared template. */
00056 SEC_ASN1_CHOOSER_DECLARE(SECOID_AlgorithmIDTemplate)
00057 
00058 /*
00059  * OID handling routines
00060  */
00061 extern SECOidData *SECOID_FindOID( const SECItem *oid);
00062 extern SECOidTag SECOID_FindOIDTag(const SECItem *oid);
00063 extern SECOidData *SECOID_FindOIDByTag(SECOidTag tagnum);
00064 extern SECOidData *SECOID_FindOIDByMechanism(unsigned long mechanism);
00065 
00066 /****************************************/
00067 /*
00068 ** Algorithm id handling operations
00069 */
00070 
00071 /*
00072 ** Fill in an algorithm-ID object given a tag and some parameters.
00073 **     "aid" where the DER encoded algorithm info is stored (memory
00074 **        is allocated)
00075 **     "tag" the tag number defining the algorithm 
00076 **     "params" if not NULL, the parameters to go with the algorithm
00077 */
00078 extern SECStatus SECOID_SetAlgorithmID(PRArenaPool *arena, SECAlgorithmID *aid,
00079                                SECOidTag tag, SECItem *params);
00080 
00081 /*
00082 ** Copy the "src" object to "dest". Memory is allocated in "dest" for
00083 ** each of the appropriate sub-objects. Memory in "dest" is not freed
00084 ** before memory is allocated (use SECOID_DestroyAlgorithmID(dest, PR_FALSE)
00085 ** to do that).
00086 */
00087 extern SECStatus SECOID_CopyAlgorithmID(PRArenaPool *arena, SECAlgorithmID *dest,
00088                                 SECAlgorithmID *src);
00089 
00090 /*
00091 ** Get the tag number for the given algorithm-id object.
00092 */
00093 extern SECOidTag SECOID_GetAlgorithmTag(SECAlgorithmID *aid);
00094 
00095 /*
00096 ** Destroy an algorithm-id object.
00097 **     "aid" the certificate-request to destroy
00098 **     "freeit" if PR_TRUE then free the object as well as its sub-objects
00099 */
00100 extern void SECOID_DestroyAlgorithmID(SECAlgorithmID *aid, PRBool freeit);
00101 
00102 /*
00103 ** Compare two algorithm-id objects, returning the difference between
00104 ** them.
00105 */
00106 extern SECComparison SECOID_CompareAlgorithmID(SECAlgorithmID *a,
00107                                       SECAlgorithmID *b);
00108 
00109 extern PRBool SECOID_KnownCertExtenOID (SECItem *extenOid);
00110 
00111 /* Given a tag number, return a string describing it.
00112  */
00113 extern const char *SECOID_FindOIDTagDescription(SECOidTag tagnum);
00114 
00115 /* Add a dynamic SECOidData to the dynamic OID table.
00116 ** Routine copies the src entry, and returns the new SECOidTag.
00117 ** Returns SEC_OID_INVALID if failed to add for some reason.
00118 */
00119 extern SECOidTag SECOID_AddEntry(const SECOidData * src);
00120 
00121 /*
00122  * free up the oid data structures.
00123  */
00124 extern SECStatus SECOID_Shutdown(void);
00125 
00126 
00127 SEC_END_PROTOS
00128 
00129 #endif /* _SECOID_H_ */