nsspki1.h

来自「支持SSL v2/v3, TLS, PKCS #5, PKCS #7, PKCS」· C头文件 代码 · 共 2,342 行 · 第 1/5 页

H
2,342
字号
/*  * The contents of this file are subject to the Mozilla Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ *  * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. *  * The Original Code is the Netscape security libraries. *  * The Initial Developer of the Original Code is Netscape * Communications Corporation.  Portions created by Netscape are  * Copyright (C) 1994-2000 Netscape Communications Corporation.  All * Rights Reserved. *  * Contributor(s): *  * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL"), in which case the provisions of the GPL are applicable  * instead of those above.  If you wish to allow use of your  * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by * the GPL.  If you do not delete the provisions above, a recipient * may use your version of this file under either the MPL or the * GPL. */#ifndef NSSPKI1_H#define NSSPKI1_H#ifdef DEBUGstatic const char NSSPKI1_CVS_ID[] = "@(#) $RCSfile: nsspki1.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:20 $ $Name: NSS_3_1_1_RTM $";#endif /* DEBUG *//* * nsspki1.h * * This file contains the prototypes of the public NSS routines  * dealing with the PKIX part-1 definitions. */#ifndef NSSBASET_H#include "nssbaset.h"#endif /* NSSBASET_H */#ifndef NSSPKI1T_H#include "nsspki1t.h"#endif /* NSSPKI1T_H */#ifndef OIDDATA_H#include "oiddata.h"#endif /* OIDDATA_H */PR_BEGIN_EXTERN_C/* * NSSOID * * The public "methods" regarding this "object" are: * *  NSSOID_CreateFromBER   -- constructor *  NSSOID_CreateFromUTF8  -- constructor *  (there is no explicit destructor) *  *  NSSOID_GetDEREncoding *  NSSOID_GetUTF8Encoding */extern const NSSOID *NSS_OID_UNKNOWN;/* * NSSOID_CreateFromBER * * This routine creates an NSSOID by decoding a BER- or DER-encoded * OID.  It may return NSS_OID_UNKNOWN upon error, in which case it  * will have created an error stack. * * The error may be one of the following values: *  NSS_ERROR_INVALID_BER *  NSS_ERROR_NO_MEMORY * * Return value: *  NSS_OID_UNKNOWN upon error *  An NSSOID upon success */NSS_EXTERN NSSOID *NSSOID_CreateFromBER(  NSSBER *berOid);extern const NSSError NSS_ERROR_INVALID_BER;extern const NSSError NSS_ERROR_NO_MEMORY;/* * NSSOID_CreateFromUTF8 * * This routine creates an NSSOID by decoding a UTF8 string  * representation of an OID in dotted-number format.  The string may  * optionally begin with an octothorpe.  It may return NSS_OID_UNKNOWN * upon error, in which case it will have created an error stack. * * The error may be one of the following values: *  NSS_ERROR_INVALID_STRING *  NSS_ERROR_NO_MEMORY * * Return value: *  NSS_OID_UNKNOWN upon error *  An NSSOID upon success */NSS_EXTERN NSSOID *NSSOID_CreateFromUTF8(  NSSUTF8 *stringOid);extern const NSSError NSS_ERROR_INVALID_STRING;extern const NSSError NSS_ERROR_NO_MEMORY;/* * NSSOID_GetDEREncoding * * This routine returns the DER encoding of the specified NSSOID. * If the optional arena argument is non-null, the memory used will * be obtained from that arena; otherwise, the memory will be obtained * from the heap.  This routine may return return null upon error, in  * which case it will have created an error stack. * * The error may be one of the following values: *  NSS_ERROR_INVALID_NSSOID *  NSS_ERROR_NO_MEMORY * * Return value: *  NULL upon error *  The DER encoding of this NSSOID */NSS_EXTERN NSSDER *NSSOID_GetDEREncoding(  const NSSOID *oid,  NSSDER *rvOpt,  NSSArena *arenaOpt);extern const NSSError NSS_ERROR_INVALID_NSSOID;extern const NSSError NSS_ERROR_NO_MEMORY;/* * NSSOID_GetUTF8Encoding * * This routine returns a UTF8 string containing the dotted-number  * encoding of the specified NSSOID.  If the optional arena argument  * is non-null, the memory used will be obtained from that arena;  * otherwise, the memory will be obtained from the heap.  This routine * may return null upon error, in which case it will have created an * error stack. * * The error may be one of the following values: *  NSS_ERROR_INVALID_NSSOID *  NSS_ERROR_NO_MEMORY * * Return value: *  NULL upon error *  A pointer to a UTF8 string containing the dotted-digit encoding of  *      this NSSOID */NSS_EXTERN NSSUTF8 *NSSOID_GetUTF8Encoding(  const NSSOID *oid,  NSSArena *arenaOpt);extern const NSSError NSS_ERROR_INVALID_NSSOID;extern const NSSError NSS_ERROR_NO_MEMORY;/* * NSSATAV * * The public "methods" regarding this "object" are: * *  NSSATAV_CreateFromBER   -- constructor *  NSSATAV_CreateFromUTF8  -- constructor *  NSSATAV_Create          -- constructor * *  NSSATAV_Destroy *  NSSATAV_GetDEREncoding *  NSSATAV_GetUTF8Encoding *  NSSATAV_GetType *  NSSATAV_GetValue *  NSSATAV_Compare *  NSSATAV_Duplicate *//* * NSSATAV_CreateFromBER *  * This routine creates an NSSATAV by decoding a BER- or DER-encoded * ATAV.  If the optional arena argument is non-null, the memory used  * will be obtained from that arena; otherwise, the memory will be  * obtained from the heap.  This routine may return NULL upon error,  * in which case it will have created an error stack. * * The error may be one of the following values: *  NSS_ERROR_INVALID_BER *  NSS_ERROR_NO_MEMORY * * Return value: *  NULL upon error *  A pointer to an NSSATAV upon success */NSS_EXTERN NSSATAV *NSSATAV_CreateFromBER(  NSSArena *arenaOpt,  NSSBER *derATAV);extern const NSSError NSS_ERROR_INVALID_BER;extern const NSSError NSS_ERROR_NO_MEMORY;/* * NSSATAV_CreateFromUTF8 * * This routine creates an NSSATAV by decoding a UTF8 string in the * "equals" format, e.g., "c=US."  If the optional arena argument is  * non-null, the memory used will be obtained from that arena;  * otherwise, the memory will be obtained from the heap.  This routine * may return NULL upon error, in which case it will have created an * error stack. * * The error may be one of the following values: *  NSS_ERROR_UNKNOWN_ATTRIBUTE *  NSS_ERROR_INVALID_STRING *  NSS_ERROR_NO_MEMORY * * Return value: *  NULL upon error *  A pointer to an NSSATAV upon success */NSS_EXTERN NSSATAV *NSSATAV_CreateFromUTF8(  NSSArena *arenaOpt,  NSSUTF8 *stringATAV);extern const NSSError NSS_ERROR_UNKNOWN_ATTRIBUTE;extern const NSSError NSS_ERROR_INVALID_STRING;extern const NSSError NSS_ERROR_NO_MEMORY;/* * NSSATAV_Create * * This routine creates an NSSATAV from the specified NSSOID and the * specified data. If the optional arena argument is non-null, the  * memory used will be obtained from that arena; otherwise, the memory * will be obtained from the heap.If the specified data length is zero,  * the data is assumed to be terminated by first zero byte; this allows  * UTF8 strings to be easily specified.  This routine may return NULL  * upon error, in which case it will have created an error stack. * * The error may be one of the following values: *  NSS_ERROR_INVALID_ARENA *  NSS_ERROR_INVALID_NSSOID *  NSS_ERROR_INVALID_POINTER *  NSS_ERROR_NO_MEMORY * * Return value: *  NULL upon error *  A pointer to an NSSATAV upon success */NSS_EXTERN NSSATAV *NSSATAV_Create(  NSSArena *arenaOpt,  const NSSOID *oid,  const void *data,  PRUint32 length);extern const NSSError NSS_ERROR_INVALID_ARENA;extern const NSSError NSS_ERROR_INVALID_NSSOID;extern const NSSError NSS_ERROR_INVALID_POINTER;extern const NSSError NSS_ERROR_NO_MEMORY;/* * NSSATAV_Destroy * * This routine will destroy an ATAV object.  It should eventually be * called on all ATAVs created without an arena.  While it is not  * necessary to call it on ATAVs created within an arena, it is not an * error to do so.  This routine returns a PRStatus value; if * successful, it will return PR_SUCCESS.  If unsuccessful, it will * create an error stack and return PR_FAILURE. * * The error may be one of the following values: *  NSS_ERROR_INVALID_ATAV *   * Return value: *  PR_FAILURE upon error *  PR_SUCCESS upon success */NSS_EXTERN PRStatusNSSATAV_Destroy(  NSSATAV *atav);extern const NSSError NSS_ERROR_INVALID_ATAV;/* * NSSATAV_GetDEREncoding * * This routine will DER-encode an ATAV object. If the optional arena * argument is non-null, the memory used will be obtained from that * arena; otherwise, the memory will be obtained from the heap.  This * routine may return null upon error, in which case it will have  * created an error stack. * * The error may be one of the following values: *  NSS_ERROR_INVALID_ATAV *  NSS_ERROR_NO_MEMORY * * Return value: *  NULL upon error *  The DER encoding of this NSSATAV */NSS_EXTERN NSSDER *NSSATAV_GetDEREncoding(  NSSATAV *atav,  NSSArena *arenaOpt);extern const NSSError NSS_ERROR_INVALID_ATAV;extern const NSSError NSS_ERROR_NO_MEMORY;/* * NSSATAV_GetUTF8Encoding * * This routine returns a UTF8 string containing a string  * representation of the ATAV in "equals" notation (e.g., "o=Acme").   * If the optional arena argument is non-null, the memory used will be * obtained from that arena; otherwise, the memory will be obtained  * from the heap.  This routine may return null upon error, in which  * case it will have created an error stack. * * The error may be one of the following values: *  NSS_ERROR_INVALID_ATAV *  NSS_ERROR_NO_MEMORY * * Return value: *  NULL upon error *  A pointer to a UTF8 string containing the "equals" encoding of the  *      ATAV */NSS_EXTERN NSSUTF8 *NSSATAV_GetUTF8Encoding(  NSSATAV *atav,  NSSArena *arenaOpt);extern const NSSError NSS_ERROR_INVALID_ATAV;extern const NSSError NSS_ERROR_NO_MEMORY;/* * NSSATAV_GetType * * This routine returns the NSSOID corresponding to the attribute type * in the specified ATAV.  This routine may return NSS_OID_UNKNOWN  * upon error, in which case it will have created an error stack. * * The error may be one of the following values: *  NSS_ERROR_INVALID_ATAV * * Return value: *  NSS_OID_UNKNOWN upon error *  An element of enum NSSOIDenum upon success */NSS_EXTERN const NSSOID *NSSATAV_GetType(  NSSATAV *atav);extern const NSSError NSS_ERROR_INVALID_ATAV;/* * NSSATAV_GetValue * * This routine returns an NSSItem containing the attribute value * in the specified ATAV.  If the optional arena argument is non-null, * the memory used will be obtained from that arena; otherwise, the * memory will be obtained from the heap.  This routine may return * NULL upon error, in which case it will have created an error stack. * * The error may be one of the following values: *  NSS_ERROR_INVALID_ATAV *  NSS_ERROR_NO_MEMORY * * Return value: *  NULL upon error *  A pointer to an NSSItem containing the attribute value. */NSS_EXTERN NSSUTF8 *NSSATAV_GetValue(  NSSATAV *atav,  NSSArena *arenaOpt);extern const NSSError NSS_ERROR_INVALID_ATAV;extern const NSSError NSS_ERROR_NO_MEMORY;/* * NSSATAV_Compare * * This routine compares two ATAVs for equality.  For two ATAVs to be * equal, the attribute types must be the same, and the attribute  * values must have equal length and contents.  The result of the  * comparison will be stored at the location pointed to by the "equalp" * variable, which must point to a valid PRBool.  This routine may  * return PR_FAILURE upon error, in which case it will have created an * error stack. * * The error may be one of the following values: *  NSS_ERROR_INVALID_ATAV *  NSS_ERROR_INVALID_ARGUMENT * * Return value: *  PR_FAILURE on error *  PR_SUCCESS upon a successful comparison (equal or not) */NSS_EXTERN PRStatusNSSATAV_Compare(  NSSATAV *atav1,  NSSATAV *atav2,  PRBool *equalp);extern const NSSError NSS_ERROR_INVALID_ATAV;extern const NSSError NSS_ERROR_INVALID_ARGUMENT;/* * NSSATAV_Duplicate * * This routine duplicates the specified ATAV.  If the optional arena 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?