📄 pki1.h
字号:
/* * 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 PKI1_H#define PKI1_H#ifdef DEBUGstatic const char PKI1_CVS_ID[] = "@(#) $RCSfile: pki1.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:24 $ $Name: NSS_3_1_1_RTM $";#endif /* DEBUG *//* * pki1.h * * This file contains the prototypes to the non-public NSS routines * relating to the PKIX part-1 objects. */#ifndef PKI1T_H#include "pki1t.h"#endif /* PKI1T_H */#ifndef NSSPKI1_H#include "nsspki1.h"#endif /* NSSPKI1_H */PR_BEGIN_EXTERN_C/* fgmr 19990505 moved these here from oiddata.h */extern const nssAttributeTypeAliasTable nss_attribute_type_aliases[];extern const PRUint32 nss_attribute_type_alias_count;/* * NSSOID * * The non-public "methods" regarding this "object" are: * * nssOID_CreateFromBER -- constructor * nssOID_CreateFromUTF8 -- constructor * (there is no explicit destructor) * * nssOID_GetDEREncoding * nssOID_GetUTF8Encoding * * In debug builds, the following non-public calls are also available: * * nssOID_verifyPointer * nssOID_getExplanation * nssOID_getTaggedUTF8 *//* * 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 set an error on the 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 set an error on the error * stack. * * The error may be one of the following values: * NSS_ERROR_INVALID_UTF8 * 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_UTF8;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 set an error on the 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);/* * 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 set an error * on the 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);/* * nssOID_verifyPointer * * This method is only present in debug builds. * * If the specified pointer is a valid poitner to an NSSOID object, * this routine will return PR_SUCCESS. Otherwise, it will put an * error on the error stack and return PR_FAILURE. * * The error may be one of the following values: * NSS_ERROR_INVALID_NSSOID * * Return value: * PR_SUCCESS if the pointer is valid * PR_FAILURE if it isn't */#ifdef DEBUGNSS_EXTERN PRStatusnssOID_verifyPointer( const NSSOID *oid);extern const NSSError NSS_ERROR_INVALID_NSSOID;#endif /* DEBUG *//* * nssOID_getExplanation * * This method is only present in debug builds. * * This routine will return a static pointer to a UTF8-encoded string * describing (in English) the specified OID. The memory pointed to * by the return value is not owned by the caller, and should not be * freed or modified. Note that explanations are only provided for * the OIDs built into the NSS library; there is no way to specify an * explanation for dynamically created OIDs. This routine is intended * only for use in debugging tools such as "derdump." This routine * may return null upon error, in which case it will have placed an * error on the error stack. * * The error may be one of the following values: * NSS_ERROR_INVALID_NSSOID * * Return value: * NULL upon error * A static pointer to a readonly, non-caller-owned UTF8-encoded * string explaining the specified OID. */#ifdef DEBUGNSS_EXTERN const char *nssOID_getExplanation( NSSOID *oid);extern const NSSError NSS_ERROR_INVALID_NSSOID;#endif /* DEBUG *//* * nssOID_getTaggedUTF8 * * This method is only present in debug builds. * * This routine will return a pointer to a caller-owned UTF8-encoded * string containing a tagged encoding of the specified OID. Note * that OID (component) tags are only provided for the OIDs built * into the NSS library; there is no way to specify tags for * dynamically created OIDs. This routine is intended for use in * debugging tools such as "derdump." 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 set * an error on the 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 tagged encoding of * this NSSOID */#ifdef DEBUGNSS_EXTERN NSSUTF8 *nssOID_getTaggedUTF8( NSSOID *oid, NSSArena *arenaOpt);extern const NSSError NSS_ERROR_INVALID_NSSOID;extern const NSSError NSS_ERROR_NO_MEMORY;#endif /* DEBUG *//* * NSSATAV * * The non-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 * * In debug builds, the following non-public call is also available: * * nssATAV_verifyPointer *//* * 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 set an error on the 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, const NSSBER *berATAV);/* * 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 set an error * on the error stack. * * The error may be one of the following values: * NSS_ERROR_UNKNOWN_ATTRIBUTE * NSS_ERROR_INVALID_UTF8 * NSS_ERROR_NO_MEMORY * * Return value: * NULL upon error * A pointer to an NSSATAV upon success */NSS_EXTERN NSSATAV *nssATAV_CreateFromUTF8( NSSArena *arenaOpt, const NSSUTF8 *stringATAV);/* * 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 set an error on the 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);/* * 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 * set an error on the 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);/* * 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 set * an error on the 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);/* * 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 set an error on the 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);/* * nssATAV_GetType *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -