diff options
Diffstat (limited to 'security/nss/lib')
237 files changed, 78354 insertions, 0 deletions
diff --git a/security/nss/lib/pkix/doc/name_rules.html b/security/nss/lib/pkix/doc/name_rules.html new file mode 100644 index 000000000..70f9dd72e --- /dev/null +++ b/security/nss/lib/pkix/doc/name_rules.html @@ -0,0 +1,178 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<!-- + - 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. + --> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.6 [en] (X11; U; IRIX 6.3 IP32) [Netscape]"> +</head> +<body> + +<h1> +Notes on libpkix name rules</h1> + +<h2> +Types</h2> +Every type mentioned in RFC 2459 is reflected in libpkix. The type +names, defined in <tt>nsspkix.h</tt>, are exactly the names used in the +RFC with the added prefix of ``<tt>NSSPKIX</tt>.'' The <tt>PKIX</tt> +part of the name is to distinguish between these specifically defined types +and more general reflections that are used in higher-level trust domains, +crypto contexts, etc. For example, <tt>NSSPKIXCertificate</tt> is +a type with specific properties defined in RFC 2459, while <tt>NSSCertificate</tt> +is a general type, not necessarily based on an X.509 certificate, that +has additional associated information. +<p>Additionally, libpkix defines some "helper" types, usually when +a type definition in the RFC was unusually complex. These types +are prefixed with <tt>NSSPKIX</tt> as above, but the next letter is lowercase. +Examples of these types include <tt>NSSPKIXrevokedCertificates</tt> and +<tt>NSSPKIXpolicyMapping</tt>. +<br> +<h2> +Simple types</h2> +Many types used in or defined by RFC 2459 have more-or-less equivalent +``natural'' types. These include <tt>BOOLEAN</tt>, <tt>INTEGER</tt>, +the string types, and the date types. +<p><tt>BOOLEAN</tt> values are always automatically converted to and from +<tt>PRBool</tt> types. +<p><tt>INTEGER</tt> types are used in two ways: as a ``small integer,'' +typically a quantity, and as an identification value (e.g., the serial +number of a certificate). In the former situation, the RFC usually +states that the values may be limited by the application to some value. +We reflect these integers as <tt>PRInt32</tt> values, which is limited +to about two billion. (The reason an unsigned integer wasn't used +is that we use -1 as an error value; while admittedly reserving one half +of the number space merely to indicate an error is perhaps wasteful, reducing +the count limit from four billion to two isn't that unreasonable.) +``Large integer'' uses are reflected as <tt>NSSItem</tt>s. +<p>String types -- even complicated <tt>CHOICE</tt>s of strings -- are +always converted to and from <tt>NSSUTF8</tt> strings. Most of the +string types can handle any UTF-8 string; the few that don't will check +the <tt>NSSUTF8</tt> string for invalid characters and return an error +if any are found. +<p>Date types are always converted to and from <tt>PRTime</tt> values. +<font color="#FF0000">***FGMR*** or whatever.</font><font color="#000000"> +The RFC-defined types may contain values that may not be represented as +<tt>PRTime</tt>s; when conversion of such a value is attempted, the error +<tt>NSS_ERROR_VALUE_OUT_OF_RANGE</tt> will be returned. However, +types that contain time values have comparator methods defined, so that +valid comparisons may be made, even if the time is out of the range of +<tt>PRTime</tt>.</font> +<br><font color="#000000"></font> +<h2> +<font color="#000000">Function names</font></h2> +<font color="#000000">All function names are created by catenating the +type name, an underscore, and the name of a method defined on that type. +In some situations, this does create rather long function names; however, +since these are usually assocated with the more obscure types, we felt +that sticking to a common naming system was preferable to inventing new +names. (The Principle of Least Surprise.)</font> +<br><font color="#000000"></font> +<h2> +<font color="#000000">Universal methods</font></h2> +<font color="#000000">Every type has a few standard methods:</font> +<ul> +<li> +<tt><font color="#000000"><typename>_CreateFromBER</font></tt></li> + +<li> +<tt><font color="#000000"><typename>_Create</font></tt></li> + +<li> +<tt><font color="#000000"><typename>_Destroy</font></tt></li> + +<li> +<tt><font color="#000000"><typename>_GetDEREncoding</font></tt></li> + +<li> +<tt><font color="#000000"><typename>_Equal</font></tt></li> + +<li> +<tt><font color="#000000"><typename>_Duplicate</font></tt></li> +</ul> +<font color="#000000">For types for which a BER encoding can be created +which is not the DER encoding, there is a method <tt><typename>_GetBEREncoding</tt>.</font> +<br><font color="#000000"></font> +<h2> +<font color="#000000">Accessors</font></h2> +<font color="#000000">Simple accessor method names are constructed with +``<tt>Get</tt>'' and ``<tt>Set</tt>'' followed by the field name:</font> +<ul> +<li> +<tt><font color="#000000"><typename>_Get<fieldname></font></tt></li> + +<li> +<tt><font color="#000000"><typename>_Set<fieldname></font></tt></li> +</ul> +<font color="#000000">Optional fields also have ``<tt>Has</tt>'' and ``<tt>Remove</tt>'' +methods, constructed in the same way.</font> +<br><font color="#000000"></font> +<h2> +<font color="#000000">Sequences</font></h2> +<font color="#000000">Sequences have the following accessors:</font> +<ul> +<li> +<tt><font color="#000000"><typename>_Get<name>Count</font></tt></li> + +<li> +<tt><font color="#000000"><typename>_Get<name>s</font></tt></li> + +<li> +<tt><font color="#000000"><typename>_Set<name>s</font></tt></li> + +<li> +<tt><font color="#000000"><typename>_Get<name></font></tt></li> + +<li> +<tt><font color="#000000"><typename>_Set<name></font></tt></li> + +<li> +<tt><font color="#000000"><typename>_Append<name></font></tt></li> + +<li> +<tt><font color="#000000"><typename>_Insert<name></font></tt></li> + +<li> +<tt><font color="#000000"><typename>_Remove<name></font></tt></li> + +<li> +<tt><font color="#000000"><typename>_Find<name></font></tt></li> +</ul> +<font color="#000000">Sets (unordered sequences) replace the <tt>Append</tt> +and <tt>Insert</tt> methods with <tt>Add</tt>. The plural Get and +Set methods operate on arrays of the subtype.</font> +<br><font color="#000000"></font> +<br><font color="#000000"></font> +<br><font color="#000000"></font> +</body> +</html> diff --git a/security/nss/lib/pkix/include/nsspkix.h b/security/nss/lib/pkix/include/nsspkix.h new file mode 100644 index 000000000..6e55be3a9 --- /dev/null +++ b/security/nss/lib/pkix/include/nsspkix.h @@ -0,0 +1,24377 @@ +/* + * 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 NSSPKIX_H +#define NSSPKIX_H + +#ifdef DEBUG +static const char NSSPKIX_CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +/* + * nsspkix.h + * + * This file contains the prototypes for the public methods defined + * for the PKIX part-1 objects. + */ + +#ifndef NSSPKIXT_H +#include "nsspkixt.h" +#endif /* NSSPKIXT_H */ + +PR_BEGIN_EXTERN_C + +/* + * Attribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Attribute ::= SEQUENCE { + * type AttributeType, + * values SET OF AttributeValue + * -- at least one value is required -- } + * + * The public calls for the type: + * + * NSSPKIXAttribute_Decode + * NSSPKIXAttribute_Create + * NSSPKIXAttribute_CreateFromArray + * NSSPKIXAttribute_Destroy + * NSSPKIXAttribute_Encode + * NSSPKIXAttribute_GetType + * NSSPKIXAttribute_SetType + * NSSPKIXAttribute_GetValueCount + * NSSPKIXAttribute_GetValues + * NSSPKIXAttribute_SetValues + * NSSPKIXAttribute_GetValue + * NSSPKIXAttribute_SetValue + * NSSPKIXAttribute_AddValue + * NSSPKIXAttribute_RemoveValue + * NSSPKIXAttribute_FindValue + * NSSPKIXAttribute_Equal + * NSSPKIXAttribute_Duplicate + * + */ + +/* + * NSSPKIXAttribute_Decode + * + * This routine creates an NSSPKIXAttribute by decoding a BER- + * or DER-encoded Attribute as defined in RFC 2459. This + * routine may return NULL upon error, in which case it will + * have created an error stack. If the optional arena argument + * is non-NULL, that arena will be used for the required memory. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttribute * +NSSPKIXAttribute_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXAttribute_Create + * + * This routine creates an NSSPKIXAttribute from specified components. + * This routine may return NULL upon error, in which case it will have + * created an error stack. If the optional arena argument is non-NULL, + * that arena will be used for the required memory. There must be at + * least one attribute value specified. The final argument must be + * NULL, to indicate the end of the set of attribute values. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttribute * +NSSPKIXAttribute_Create +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + NSSPKIXAttributeValue *value1, + ... +); + +/* + * NSSPKIXAttribute_CreateFromArray + * + * This routine creates an NSSPKIXAttribute from specified components. + * This routine may return NULL upon error, in which case it will have + * created an error stack. If the optional arena argument is non-NULL, + * that arena will be used for the required memory. There must be at + * least one attribute value specified. The final argument must be + * NULL, to indicate the end of the set of attribute values. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttribute * +NSSPKIXAttribute_CreateFromArray +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + PRUint32 count, + NSSPKIXAttributeValue values[] +); + +/* + * NSSPKIXAttribute_Destroy + * + * This routine destroys an NSSPKIXAttribute. It should be called on + * all such objects created without an arena. It does not need to be + * called for objects created with an arena, but it may be. This + * routine returns a PRStatus value. Upon error, it will create an + * error stack and return PR_FAILURE. + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAttribute_Destroy +( + NSSPKIXAttribute *attribute +); + +/* + * NSSPKIXAttribute_Encode + * + * This routine returns the BER encoding of the specified + * NSSPKIXAttribute. {usual rules about itemOpt and arenaOpt} + * This routine indicates an error (NSS_ERROR_INVALID_DATA) + * if there are no attribute values (i.e., the last one was removed). + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_DATA + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXAttribute_Encode +( + NSSPKIXAttribute *attribute, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAttribute_GetType + * + * This routine returns the attribute type oid of the specified + * NSSPKIXAttribute. + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSPKIXAttributeType pointer upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttributeType * +NSSPKIXAttribute_GetType +( + NSSPKIXAttribute *attribute +); + +/* + * NSSPKIXAttribute_SetType + * + * This routine sets the attribute type oid of the indicated + * NSSPKIXAttribute to the specified value. Since attributes + * may be application-defined, no checking can be done on + * either the correctness of the attribute type oid value nor + * the suitability of the set of attribute values. + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_OID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAttribute_SetType +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeType *attributeType +); + +/* + * NSSPKIXAttribute_GetValueCount + * + * This routine returns the number of attribute values present in + * the specified NSSPKIXAttribute. This routine returns a PRInt32. + * Upon error, this routine returns -1. This routine indicates an + * error if the number of values cannot be expressed as a PRInt32. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXAttribute_GetValueCount +( + NSSPKIXAttribute *attribute +); + +/* + * NSSPKIXAttribute_GetValues + * + * This routine returns all of the attribute values in the specified + * NSSPKIXAttribute. If the optional pointer to an array of NSSItems + * is non-null, then that array will be used and returned; otherwise, + * an array will be allocated and returned. If the limit is nonzero + * (which is must be if the specified array is nonnull), then an + * error is indicated if it is smaller than the value count. + * {arenaOpt} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSItem's upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttributeValue * +NSSPKIXAttribute_GetValues +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeValue rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAttribute_SetValues + * + * This routine sets all of the values of the specified + * NSSPKIXAttribute to the values in the specified NSSItem array. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_POINTER + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAttribute_SetValues +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeValue values[], + PRInt32 count +); + +/* + * NSSPKIXAttribute_GetValue + * + * This routine returns the i'th attribute value of the set of + * values in the specified NSSPKIXAttribute. Although the set + * is unordered, an arbitrary ordering will be maintained until + * the data in the attribute is changed. {usual comments about + * itemOpt and arenaOpt} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttributeValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeValue * +NSSPKIXAttribute_GetValue +( + NSSPKIXAttribute *attribute, + PRInt32 i, + NSSPKIXAttributeValue *itemOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAttribute_SetValue + * + * This routine sets the i'th attribute value {blah blah; copies + * memory contents over..} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAttribute_SetValue +( + NSSPKIXAttribute *attribute, + PRInt32 i, + NSSPKIXAttributeValue *value +); + +/* + * NSSPKIXAttribute_AddValue + * + * This routine adds the specified attribute value to the set in + * the specified NSSPKIXAttribute. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAttribute_AddValue +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeValue *value +); + +/* + * NSSPKIXAttribute_RemoveValue + * + * This routine removes the i'th attribute value of the set in the + * specified NSSPKIXAttribute. An attempt to remove the last value + * will fail. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_AT_MINIMUM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAttribute_RemoveValue +( + NSSPKIXAttribute *attribute, + PRInt32 i +); + +/* + * NSSPKIXAttribute_FindValue + * + * This routine searches the set of attribute values in the specified + * NSSPKIXAttribute for the provided data. If an exact match is found, + * then that value's index is returned. If an exact match is not + * found, -1 is returned. If there is more than one exact match, one + * index will be returned. {notes about unorderdness of SET, etc} + * If the index may not be represented as an integer, an error is + * indicated. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value + * The index of the specified attribute value upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXAttribute_FindValue +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeValue *attributeValue +); + +/* + * NSSPKIXAttribute_Equal + * + * This routine compares two NSSPKIXAttribute's for equality. + * It returns PR_TRUE if they are equal, PR_FALSE otherwise. + * This routine also returns PR_FALSE upon error; if you're + * that worried about it, check for an error stack. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXAttribute_Equal +( + NSSPKIXAttribute *one, + NSSPKIXAttribute *two, + PRStatus *statusOpt +); + +/* + * NSSPKIXAttribute_Duplicate + * + * This routine duplicates an NSSPKIXAttribute. {arenaOpt} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttribute * +NSSPKIXAttribute_Duplicate +( + NSSPKIXAttribute *attribute, + NSSArena *arenaOpt +); + +/* + * AttributeTypeAndValue + * + * This structure contains an attribute type (indicated by an OID), + * and the type-specific value. RelativeDistinguishedNames consist + * of a set of these. These are distinct from Attributes (which have + * SET of values), from AttributeDescriptions (which have qualifiers + * on the types), and from AttributeValueAssertions (which assert a + * a value comparison under some matching rule). + * + * From RFC 2459: + * + * AttributeTypeAndValue ::= SEQUENCE { + * type AttributeType, + * value AttributeValue } + * + * The public calls for the type: + * + * NSSPKIXAttributeTypeAndValue_Decode + * NSSPKIXAttributeTypeAndValue_CreateFromUTF8 + * NSSPKIXAttributeTypeAndValue_Create + * NSSPKIXAttributeTypeAndValue_Destroy + * NSSPKIXAttributeTypeAndValue_Encode + * NSSPKIXAttributeTypeAndValue_GetUTF8Encoding + * NSSPKIXAttributeTypeAndValue_GetType + * NSSPKIXAttributeTypeAndValue_SetType + * NSSPKIXAttributeTypeAndValue_GetValue + * NSSPKIXAttributeTypeAndValue_SetValue + * NSSPKIXAttributeTypeAndValue_Equal + * NSSPKIXAttributeTypeAndValue_Duplicate + */ + +/* + * NSSPKIXAttributeTypeAndValue_Decode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeTypeAndValue * +NSSPKIXAttributeTypeAndValue_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXAttributeTypeAndValue_CreateFromUTF8 + * + * + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeTypeAndValue * +NSSPKIXAttributeTypeAndValue_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +); + +/* + * NSSPKIXAttributeTypeAndValue_Create + * + * + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeTypeAndValue * +NSSPKIXAttributeTypeAndValue_Create +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + NSSPKIXAttributeValue *value +); + +/* + * NSSPKIXAttributeTypeAndValue_Destroy + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAttributeTypeAndValue_Destroy +( + NSSPKIXAttributeTypeAndValue *atav +); + +/* + * NSSPKIXAttributeTypeAndValue_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXAttributeTypeAndValue_Encode +( + NSSPKIXAttributeTypeAndValue *atav, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAttributeTypeAndValue_GetUTF8Encoding + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXAttributeTypeAndValue_GetUTF8Encoding +( + NSSPKIXAttributeTypeAndValue *atav, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAttributeTypeAndValue_GetType + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSPKIXAttributeType pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeType * +NSSPKIXAttributeTypeAndValue_GetType +( + NSSPKIXAttributeTypeAndValue *atav +); + +/* + * NSSPKIXAttributeTypeAndValue_SetType + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_OID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAttributeTypeAndValue_SetType +( + NSSPKIXAttributeTypeAndValue *atav, + NSSPKIXAttributeType *attributeType +); + +/* + * NSSPKIXAttributeTypeAndValue_GetValue + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSAttributeValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeValue * +NSSPKIXAttributeTypeAndValue_GetValue +( + NSSPKIXAttributeTypeAndValue *atav, + NSSPKIXAttributeValue *itemOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAttributeTypeAndValue_SetValue + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAttributeTypeAndValue_SetValue +( + NSSPKIXAttributeTypeAndValue *atav, + NSSPKIXAttributeValue *value +); + +/* + * NSSPKIXAttributeTypeAndValue_Equal + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXAttributeTypeAndValue_Equal +( + NSSPKIXAttributeTypeAndValue *atav1, + NSSPKIXAttributeTypeAndValue *atav2, + PRStatus *statusOpt +); + +/* + * NSSPKIXAttributeTypeAndValue_Duplicate + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeTypeAndValue * +NSSPKIXAttributeTypeAndValue_Duplicate +( + NSSPKIXAttributeTypeAndValue *atav, + NSSArena *arenaOpt +); + +/* + * X520Name + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520name ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-name)), + * printableString PrintableString (SIZE (1..ub-name)), + * universalString UniversalString (SIZE (1..ub-name)), + * utf8String UTF8String (SIZE (1..ub-name)), + * bmpString BMPString (SIZE(1..ub-name)) } + * + * ub-name INTEGER ::= 32768 + * + * The public calls for this type: + * + * NSSPKIXX520Name_Decode + * NSSPKIXX520Name_CreateFromUTF8 + * NSSPKIXX520Name_Create (?) + * NSSPKIXX520Name_Destroy + * NSSPKIXX520Name_Encode + * NSSPKIXX520Name_GetUTF8Encoding + * NSSPKIXX520Name_Equal + * NSSPKIXX520Name_Duplicate + * + * The public data for this type: + * + * NSSPKIXX520Name_MAXIMUM_LENGTH + * + */ + +/* + * NSSPKIXX520Name_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520Name * +NSSPKIXX520Name_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXX520Name_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520Name * +NSSPKIXX520Name_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXX520Name_Create + * + * XXX fgmr: currently nssStringType is a private type. Thus, + * this public method should not exist. I'm leaving this here + * to remind us later what we want to decide. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING_TYPE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +/* + * NSS_EXTERN NSSPKIXX520Name * + * NSSPKIXX520Name_Create + * ( + * NSSArena *arenaOpt, + * nssStringType type, + * NSSItem *data + * ); + */ + +/* + * NSSPKIXX520Name_Destroy + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXX520Name_Destroy +( + NSSPKIXX520Name *name +); + +/* + * NSSPKIXX520Name_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXX520Name_Encode +( + NSSPKIXX520Name *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXX520Name_GetUTF8Encoding + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXX520Name_GetUTF8Encoding +( + NSSPKIXX520Name *name, + NSSArena *arenaOpt +); + +/* + * NSSPKIXX520Name_Equal + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXX520Name_Equal +( + NSSPKIXX520Name *name1, + NSSPKIXX520Name *name2, + PRStatus *statusOpt +); + +/* + * NSSPKIXX520Name_Duplicate + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520Name * +NSSPKIXX520Name_Duplicate +( + NSSPKIXX520Name *name, + NSSArena *arenaOpt +); + +/* + * NSSPKIXX520Name_MAXIMUM_LENGTH + * + * From RFC 2459: + * + * ub-name INTEGER ::= 32768 + */ + +extern const PRUint32 NSSPKIXX520Name_MAXIMUM_LENGTH; + +/* + * X520CommonName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520CommonName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-common-name)), + * printableString PrintableString (SIZE (1..ub-common-name)), + * universalString UniversalString (SIZE (1..ub-common-name)), + * utf8String UTF8String (SIZE (1..ub-common-name)), + * bmpString BMPString (SIZE(1..ub-common-name)) } + * + * ub-common-name INTEGER ::= 64 + * + * The public calls for this type: + * + * NSSPKIXX520CommonName_Decode + * NSSPKIXX520CommonName_CreateFromUTF8 + * NSSPKIXX520CommonName_Create (?) + * NSSPKIXX520CommonName_Destroy + * NSSPKIXX520CommonName_Encode + * NSSPKIXX520CommonName_GetUTF8Encoding + * NSSPKIXX520CommonName_Equal + * NSSPKIXX520CommonName_Duplicate + * + * The public data for this type: + * + * NSSPKIXX520CommonName_MAXIMUM_LENGTH + * + */ + +/* + * NSSPKIXX520CommonName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520CommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520CommonName * +NSSPKIXX520CommonName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXX520CommonName_Create + * + * XXX fgmr: currently nssStringType is a private type. Thus, + * this public method should not exist. I'm leaving this here + * to remind us later what we want to decide. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING_TYPE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXX520CommonName upon success + * NULL upon failure + */ + +/* + * NSS_EXTERN NSSPKIXX520CommonName * + * NSSPKIXX520CommonName_Create + * ( + * NSSArena *arenaOpt, + * nssStringType type, + * NSSItem *data + * ); + */ + +/* + * NSSPKIXX520CommonName_Destroy + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_COMMON_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXX520CommonName_Destroy +( + NSSPKIXX520CommonName *name +); + +/* + * NSSPKIXX520CommonName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520CommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520CommonName * +NSSPKIXX520CommonName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXX520CommonName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_COMMON_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXX520CommonName_Encode +( + NSSPKIXX520CommonName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXX520CommonName_GetUTF8Encoding + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_COMMON_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXX520CommonName_GetUTF8Encoding +( + NSSPKIXX520CommonName *name, + NSSArena *arenaOpt +); + +/* + * NSSPKIXX520CommonName_Equal + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_COMMON_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXX520CommonName_Equal +( + NSSPKIXX520CommonName *name1, + NSSPKIXX520CommonName *name2, + PRStatus *statusOpt +); + +/* + * NSSPKIXX520CommonName_Duplicate + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_COMMON_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520CommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520CommonName * +NSSPKIXX520CommonName_Duplicate +( + NSSPKIXX520CommonName *name, + NSSArena *arenaOpt +); + +/* + * NSSPKIXX520CommonName_MAXIMUM_LENGTH + * + * From RFC 2459: + * + * ub-common-name INTEGER ::= 64 + */ + +extern const PRUint32 NSSPKIXX520CommonName_MAXIMUM_LENGTH; + +/* + * X520LocalityName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520LocalityName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-locality-name)), + * printableString PrintableString (SIZE (1..ub-locality-name)), + * universalString UniversalString (SIZE (1..ub-locality-name)), + * utf8String UTF8String (SIZE (1..ub-locality-name)), + * bmpString BMPString (SIZE(1..ub-locality-name)) } + * + * The public calls for this type: + * + * NSSPKIXX520LocalityName_Decode + * NSSPKIXX520LocalityName_CreateFromUTF8 + * NSSPKIXX520LocalityName_Encode + * + */ + +/* + * NSSPKIXX520LocalityName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520LocalityName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520LocalityName * +NSSPKIXX520LocalityName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXX520LocalityName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520LocalityName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520LocalityName * +NSSPKIXX520LocalityName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXX520LocalityName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXX520LocalityName_Encode +( + NSSPKIXX520LocalityName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X520StateOrProvinceName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520StateOrProvinceName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-state-name)), + * printableString PrintableString (SIZE (1..ub-state-name)), + * universalString UniversalString (SIZE (1..ub-state-name)), + * utf8String UTF8String (SIZE (1..ub-state-name)), + * bmpString BMPString (SIZE(1..ub-state-name)) } + * + * The public calls for this type: + * + * NSSPKIXX520StateOrProvinceName_Decode + * NSSPKIXX520StateOrProvinceName_CreateFromUTF8 + * NSSPKIXX520StateOrProvinceName_Encode + * + */ + +/* + * NSSPKIXX520StateOrProvinceName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520StateOrProvinceName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520StateOrProvinceName * +NSSPKIXX520StateOrProvinceName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXX520StateOrProvinceName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520StateOrProvinceName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520StateOrProvinceName * +NSSPKIXX520StateOrProvinceName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXX520StateOrProvinceName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXX520StateOrProvinceName_Encode +( + NSSPKIXX520StateOrProvinceName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X520OrganizationName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520OrganizationName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-organization-name)), + * printableString PrintableString (SIZE (1..ub-organization-name)), + * universalString UniversalString (SIZE (1..ub-organization-name)), + * utf8String UTF8String (SIZE (1..ub-organization-name)), + * bmpString BMPString (SIZE(1..ub-organization-name)) } + * + * The public calls for this type: + * + * NSSPKIXX520OrganizationName_Decode + * NSSPKIXX520OrganizationName_CreateFromUTF8 + * NSSPKIXX520OrganizationName_Encode + * + */ + +/* + * NSSPKIXX520OrganizationName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520OrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520OrganizationName * +NSSPKIXX520OrganizationName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXX520OrganizationName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520OrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520OrganizationName * +NSSPKIXX520OrganizationName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXX520OrganizationName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXX520OrganizationName_Encode +( + NSSPKIXX520OrganizationName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X520OrganizationalUnitName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520OrganizationalUnitName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-organizational-unit-name)), + * printableString PrintableString + * (SIZE (1..ub-organizational-unit-name)), + * universalString UniversalString + * (SIZE (1..ub-organizational-unit-name)), + * utf8String UTF8String (SIZE (1..ub-organizational-unit-name)), + * bmpString BMPString (SIZE(1..ub-organizational-unit-name)) } + * + * The public calls for this type: + * + * NSSPKIXX520OrganizationalUnitName_Decode + * NSSPKIXX520OrganizationalUnitName_CreateFromUTF8 + * NSSPKIXX520OrganizationalUnitName_Encode + * + */ + +/* + * NSSPKIXX520OrganizationalUnitName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520OrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520OrganizationalUnitName * +NSSPKIXX520OrganizationalUnitName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXX520OrganizationalUnitName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520OrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520OrganizationalUnitName * +NSSPKIXX520OrganizationalUnitName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXX520OrganizationalUnitName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXX520OrganizationalUnitName_Encode +( + NSSPKIXX520OrganizationalUnitName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X520Title + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520Title ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-title)), + * printableString PrintableString (SIZE (1..ub-title)), + * universalString UniversalString (SIZE (1..ub-title)), + * utf8String UTF8String (SIZE (1..ub-title)), + * bmpString BMPString (SIZE(1..ub-title)) } + * + * The public calls for this type: + * + * NSSPKIXX520Title_Decode + * NSSPKIXX520Title_CreateFromUTF8 + * NSSPKIXX520Title_Encode + * + */ + +/* + * NSSPKIXX520Title_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Title upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520Title * +NSSPKIXX520Title_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXX520Title_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Title upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520Title * +NSSPKIXX520Title_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXX520Title_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXX520Title_Encode +( + NSSPKIXX520Title *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X520dnQualifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520dnQualifier ::= PrintableString + * + * The public calls for this type: + * + * NSSPKIXX520dnQualifier_Decode + * NSSPKIXX520dnQualifier_CreateFromUTF8 + * NSSPKIXX520dnQualifier_Encode + * + */ + +/* + * NSSPKIXX520dnQualifier_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520dnQualifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520dnQualifier * +NSSPKIXX520dnQualifier_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXX520dnQualifier_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520dnQualifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520dnQualifier * +NSSPKIXX520dnQualifier_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXX520dnQualifier_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXX520dnQualifier_Encode +( + NSSPKIXX520dnQualifier *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X520countryName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520countryName ::= PrintableString (SIZE (2)) -- IS 3166 codes + * + * The public calls for this type: + * + * NSSPKIXX520countryName_Decode + * NSSPKIXX520countryName_CreateFromUTF8 + * NSSPKIXX520countryName_Encode + * + */ + +/* + * NSSPKIXX520countryName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520countryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520countryName * +NSSPKIXX520countryName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXX520countryName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520countryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520countryName * +NSSPKIXX520countryName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXX520countryName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXX520countryName_Encode +( + NSSPKIXX520countryName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * Pkcs9email + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Pkcs9email ::= IA5String (SIZE (1..ub-emailaddress-length)) + * + * The public calls for this type: + * + * NSSPKIXPkcs9email_Decode + * NSSPKIXPkcs9email_CreateFromUTF8 + * NSSPKIXPkcs9email_Encode + * + */ + +/* + * NSSPKIXPkcs9email_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPkcs9email upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPkcs9email * +NSSPKIXPkcs9email_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXPkcs9email_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPkcs9email upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPkcs9email * +NSSPKIXPkcs9email_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXPkcs9email_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXPkcs9email_Encode +( + NSSPKIXPkcs9email *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * Name + * + * This structure contains a union of the possible name formats, + * which at the moment is limited to an RDNSequence. + * + * From RFC 2459: + * + * Name ::= CHOICE { -- only one possibility for now -- + * rdnSequence RDNSequence } + * + * The public calls for this type: + * + * NSSPKIXName_Decode + * NSSPKIXName_CreateFromUTF8 + * NSSPKIXName_Create + * NSSPKIXName_CreateFromRDNSequence + * NSSPKIXName_Destroy + * NSSPKIXName_Encode + * NSSPKIXName_GetUTF8Encoding + * NSSPKIXName_GetChoice + * NSSPKIXName_GetRDNSequence + * NSSPKIXName_GetSpecifiedChoice {fgmr remove this} + * NSSPKIXName_SetRDNSequence + * NSSPKIXName_SetSpecifiedChoice + * NSSPKIXName_Equal + * NSSPKIXName_Duplicate + * + * (here is where I had specific attribute value gettors in pki1) + * + */ + +/* + * NSSPKIXName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +NSSPKIXName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXName_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +NSSPKIXName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +); + +/* + * NSSPKIXName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_CHOICE + * NSS_ERROR_INVALID_ARGUMENT + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +NSSPKIXName_Create +( + NSSArena *arenaOpt, + NSSPKIXNameChoice choice, + void *arg +); + +/* + * NSSPKIXName_CreateFromRDNSequence + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +NSSPKIXName_CreateFromRDNSequence +( + NSSArena *arenaOpt, + NSSPKIXRDNSequence *rdnSequence +); + +/* + * NSSPKIXName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXName_Destroy +( + NSSPKIXName *name +); + +/* + * NSSPKIXName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXName_Encode +( + NSSPKIXName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXName_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXName_GetUTF8Encoding +( + NSSPKIXName *name, + NSSArena *arenaOpt +); + +/* + * NSSPKIXName_GetChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * A valid element of the NSSPKIXNameChoice enumeration upon success + * The value NSSPKIXNameChoice_NSSinvalid (-1) upon error + */ + +NSS_EXTERN NSSPKIXNameChoice +NSSPKIXName_GetChoice +( + NSSPKIXName *name +); + +/* + * NSSPKIXName_GetRDNSequence + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A pointer to a valid NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRDNSequence * +NSSPKIXName_GetRDNSequence +( + NSSPKIXName *name, + NSSArena *arenaOpt +); + +/* + * NSSPKIXName_GetSpecifiedChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A valid pointer ... + * NULL upon failure + */ + +NSS_EXTERN void * +NSSPKIXName_GetSpecifiedChoice +( + NSSPKIXName *name, + NSSPKIXNameChoice choice, + NSSArena *arenaOpt +); + +/* + * NSSPKIXName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXName_Equal +( + NSSPKIXName *name1, + NSSPKIXName *name2, + PRStatus *statusOpt +); + +/* + * NSSPKIXName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +NSSPKIXName_Duplicate +( + NSSPKIXName *name, + NSSArena *arenaOpt +); + +/* + * RDNSequence + * + * This structure contains a sequence of RelativeDistinguishedName + * objects. + * + * From RFC 2459: + * + * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName + * + * The public calls for this type: + * + * NSSPKIXRDNSequence_Decode + * NSSPKIXRDNSequence_CreateFromUTF8 + * NSSPKIXRDNSequence_Create + * NSSPKIXRDNSequence_CreateFromArray + * NSSPKIXRDNSequence_Destroy + * NSSPKIXRDNSequence_Encode + * NSSPKIXRDNSequence_GetUTF8Encoding + * NSSPKIXRDNSequence_GetRelativeDistinguishedNameCount + * NSSPKIXRDNSequence_GetRelativeDistinguishedNames + * NSSPKIXRDNSequence_SetRelativeDistinguishedNames + * NSSPKIXRDNSequence_GetRelativeDistinguishedName + * NSSPKIXRDNSequence_SetRelativeDistinguishedName + * NSSPKIXRDNSequence_AppendRelativeDistinguishedName + * NSSPKIXRDNSequence_InsertRelativeDistinguishedName + * NSSPKIXRDNSequence_RemoveRelativeDistinguishedName + * NSSPKIXRDNSequence_FindRelativeDistinguishedName + * NSSPKIXRDNSequence_Equal + * NSSPKIXRDNSequence_Duplicate + * + */ + +/* + * NSSPKIXRDNSequence_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRDNSequence * +NSSPKIXRDNSequence_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXRDNSequence_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRDNSequence * +NSSPKIXRDNSequence_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +); + +/* + * NSSPKIXRDNSequence_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRDNSequence * +NSSPKIXRDNSequence_Create +( + NSSArena *arenaOpt, + NSSPKIXRelativeDistinguishedName *rdn1, + ... +); + +/* + * NSSPKIXRDNSequence_CreateFromArray + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRDNSequence * +NSSPKIXRDNSequence_Create +( + NSSArena *arenaOpt, + PRUint32 count, + NSSPKIXRelativeDistinguishedName *rdns[] +); + +/* + * NSSPKIXRDNSequence_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXRDNSequence_Destroy +( + NSSPKIXRDNSequence *rdnseq +); + +/* + * NSSPKIXRDNSequence_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXRDNSequence_Encode +( + NSSPKIXRDNSequence *rdnseq, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXRDNSequence_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXRDNSequence_GetUTF8Encoding +( + NSSPKIXRDNSequence *rdnseq, + NSSArena *arenaOpt +); + +/* + * NSSPKIXRDNSequence_GetRelativeDistinguishedNameCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXRDNSequence_GetRelativeDistinguishedNameCount +( + NSSPKIXRDNSequence *rdnseq +); + +/* + * NSSPKIXRDNSequence_GetRelativeDistinguishedNames + * + * This routine returns all of the relative distinguished names in the + * specified RDN Sequence. {...} If the array is allocated, or if the + * specified one has extra space, the array will be null-terminated. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXRelativeDistinguishedName + * pointers upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName ** +NSSPKIXRDNSequence_GetRelativeDistinguishedNames +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXRDNSequence_SetRelativeDistinguishedNames + * + * -- fgmr comments -- + * If the array pointer itself is null, the set is considered empty. + * If the count is zero but the pointer nonnull, the array will be + * assumed to be null-terminated. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXRDNSequence_SetRelativeDistinguishedNames +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rdns[], + PRInt32 countOpt +); + +/* + * NSSPKIXRDNSequence_GetRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +NSSPKIXRDNSequence_GetRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXRDNSequence_SetRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXRDNSequence_SetRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i, + NSSPKIXRelativeDistinguishedName *rdn +); + +/* + * NSSPKIXRDNSequence_AppendRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXRDNSequence_AppendRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rdn +); + +/* + * NSSPKIXRDNSequence_InsertRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXRDNSequence_InsertRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i, + NSSPKIXRelativeDistinguishedName *rdn +); + +/* + * NSSPKIXRDNSequence_RemoveRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXRDNSequence_RemoveRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i +); + +/* + * NSSPKIXRDNSequence_FindRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified attribute value upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXRDNSequence_FindRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rdn +); + +/* + * NSSPKIXRDNSequence_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXRDNSequence_Equal +( + NSSPKIXRDNSequence *one, + NSSPKIXRDNSequence *two, + PRStatus *statusOpt +); + +/* + * NSSPKIXRDNSequence_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRDNSequence * +NSSPKIXRDNSequence_Duplicate +( + NSSPKIXRDNSequence *rdnseq, + NSSArena *arenaOpt +); + +/* + * DistinguishedName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DistinguishedName ::= RDNSequence + * + * This is just a public typedef; no new methods are required. {fgmr-- right?} + */ + +/* + * RelativeDistinguishedName + * + * This structure contains an unordered set of AttributeTypeAndValue + * objects. RDNs are used to distinguish a set of objects underneath + * a common object. + * + * Often, a single ATAV is sufficient to make a unique distinction. + * For example, if a company assigns its people unique uid values, + * then in the Name "uid=smith,ou=People,o=Acme,c=US" the "uid=smith" + * ATAV by itself forms an RDN. However, sometimes a set of ATAVs is + * needed. For example, if a company needed to distinguish between + * two Smiths by specifying their corporate divisions, then in the + * Name "(cn=Smith,ou=Sales),ou=People,o=Acme,c=US" the parenthesised + * set of ATAVs forms the RDN. + * + * From RFC 2459: + * + * RelativeDistinguishedName ::= + * SET SIZE (1 .. MAX) OF AttributeTypeAndValue + * + * The public calls for this type: + * + * NSSPKIXRelativeDistinguishedName_Decode + * NSSPKIXRelativeDistinguishedName_CreateFromUTF8 + * NSSPKIXRelativeDistinguishedName_Create + * NSSPKIXRelativeDistinguishedName_CreateFromArray + * NSSPKIXRelativeDistinguishedName_Destroy + * NSSPKIXRelativeDistinguishedName_Encode + * NSSPKIXRelativeDistinguishedName_GetUTF8Encoding + * NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValueCount + * NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValues + * NSSPKIXRelativeDistinguishedName_SetAttributeTypeAndValues + * NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValue + * NSSPKIXRelativeDistinguishedName_SetAttributeTypeAndValue + * NSSPKIXRelativeDistinguishedName_AddAttributeTypeAndValue + * NSSPKIXRelativeDistinguishedName_RemoveAttributeTypeAndValue + * NSSPKIXRelativeDistinguishedName_FindAttributeTypeAndValue + * NSSPKIXRelativeDistinguishedName_Equal + * NSSPKIXRelativeDistinguishedName_Duplicate + * + * fgmr: Logical additional functions include + * + * NSSPKIXRelativeDistinguishedName_FindAttributeTypeAndValueByType + * returns PRInt32 + * NSSPKIXRelativeDistinguishedName_FindAttributeTypeAndValuesByType + * returns array of PRInt32 + * NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValueForType + * returns NSSPKIXAttributeTypeAndValue + * NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValuesForType + * returns array of NSSPKIXAttributeTypeAndValue + * NSSPKIXRelativeDistinguishedName_GetAttributeValueForType + * returns NSSPKIXAttributeValue + * NSSPKIXRelativeDistinguishedName_GetAttributeValuesForType + * returns array of NSSPKIXAttributeValue + * + * NOTE: the "return array" versions are only meaningful if an RDN may + * contain multiple ATAVs with the same type. Verify in the RFC if + * this is possible or not. If not, nuke those three functions. + * + */ + +/* + * NSSPKIXRelativeDistinguishedName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +NSSPKIXRelativeDistinguishedName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXRelativeDistinguishedName_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +NSSPKIXRelativeDistinguishedName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +); + +/* + * NSSPKIXRelativeDistinguishedName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ATAV + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +NSSPKIXRelativeDistinguishedName_Create +( + NSSArena *arenaOpt, + NSSPKIXAttributeTypeAndValue *atav1, + ... +); + +/* + * NSSPKIXRelativeDistinguishedName_CreateFromArray + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ATAV + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +NSSPKIXRelativeDistinguishedName_CreateFromArray +( + NSSArena *arenaOpt, + PRUint32 count, + NSSPKIXAttributeTypeAndValue *atavs[] +); + +/* + * NSSPKIXRelativeDistinguishedName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXRelativeDistinguishedName_Destroy +( + NSSPKIXRelativeDistinguishedName *rdn +); + +/* + * NSSPKIXRelativeDistinguishedName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXRelativeDistinguishedName_Encode +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXRelativeDistinguishedName_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXRelativeDistinguishedName_GetUTF8Encoding +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSArena *arenaOpt +); + +/* + * NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValueCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValueCount +( + NSSPKIXRelativeDistinguishedName *rdn +); + +/* + * NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValues + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXAttributeTypeAndValue + * pointers upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeTypeAndValue ** +NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValues +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXRelativeDistinguishedName_SetAttributeTypeAndValues + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ATAV + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXRelativeDistinguishedName_SetAttributeTypeAndValues +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *atavs[], + PRInt32 countOpt +); + +/* + * NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeTypeAndValue * +NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXRelativeDistinguishedName_SetAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXRelativeDistinguishedName_SetAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + PRInt32 i, + NSSPKIXAttributeTypeAndValue *atav +); + +/* + * NSSPKIXRelativeDistinguishedName_AddAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXRelativeDistinguishedName_AddAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *atav +); + +/* + * NSSPKIXRelativeDistinguishedName_RemoveAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_AT_MINIMUM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXRelativeDistinguishedName_RemoveAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + PRInt32 i +); + +/* + * NSSPKIXRelativeDistinguishedName_FindAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified attribute value upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXRelativeDistinguishedName_FindAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *atav +); + +/* + * NSSPKIXRelativeDistinguishedName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXRelativeDistinguishedName_Equal +( + NSSPKIXRelativeDistinguishedName *one, + NSSPKIXRelativeDistinguishedName *two, + PRStatus *statusOpt +); + +/* + * NSSPKIXRelativeDistinguishedName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +NSSPKIXRelativeDistinguishedName_Duplicate +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSArena *arenaOpt +); + +/* + * DirectoryString + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DirectoryString ::= CHOICE { + * teletexString TeletexString (SIZE (1..MAX)), + * printableString PrintableString (SIZE (1..MAX)), + * universalString UniversalString (SIZE (1..MAX)), + * utf8String UTF8String (SIZE (1..MAX)), + * bmpString BMPString (SIZE(1..MAX)) } + * + * The public calls for this type: + * + * NSSPKIXDirectoryString_Decode + * NSSPKIXDirectoryString_CreateFromUTF8 + * NSSPKIXDirectoryString_Encode + * + */ + +/* + * NSSPKIXDirectoryString_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDirectoryString upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDirectoryString * +NSSPKIXDirectoryString_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXDirectoryString_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDirectoryString upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDirectoryString * +NSSPKIXDirectoryString_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXDirectoryString_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_DIRECTORY_STRING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXDirectoryString_Encode +( + NSSPKIXDirectoryString *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * Certificate + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Certificate ::= SEQUENCE { + * tbsCertificate TBSCertificate, + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING } + * + * The public calls for this type: + * + * NSSPKIXCertificate_Decode + * NSSPKIXCertificate_Create + * NSSPKIXCertificate_Destroy + * NSSPKIXCertificate_Encode + * NSSPKIXCertificate_GetTBSCertificate + * NSSPKIXCertificate_SetTBSCertificate + * NSSPKIXCertificate_GetAlgorithmIdentifier + * NSSPKIXCertificate_SetAlgorithmIdentifier + * NSSPKIXCertificate_GetSignature + * NSSPKIXCertificate_SetSignature + * NSSPKIXCertificate_Equal + * NSSPKIXCertificate_Duplicate + * + * { inherit TBSCertificate gettors? } + * + */ + +/* + * NSSPKIXCertificate_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificate * +NSSPKIXCertificate_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXCertificate_Create + * + * -- fgmr comments -- + * { at this level we'll have to just accept a specified signature } + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_ALGID + * NSS_ERROR_INVALID_PKIX_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificate * +NSSPKIXCertificate_Create +( + NSSArena *arenaOpt, + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXAlgorithmIdentifier *algID, + NSSItem *signature +); + +/* + * NSSPKIXCertificate_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificate_Destroy +( + NSSPKIXCertificate *cert +); + +/* + * NSSPKIXCertificate_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXCertificate_Encode +( + NSSPKIXCertificate *cert, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCertificate_GetTBSCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertificate * +NSSPKIXCertificate_GetTBSCertificate +( + NSSPKIXCertificate *cert, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCertificate_SetTBSCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificate_SetTBSCertificate +( + NSSPKIXCertificate *cert, + NSSPKIXTBSCertificate *tbsCert +); + +/* + * NSSPKIXCertificate_GetAlgorithmIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +NSSPKIXCertificate_GetAlgorithmIdentifier +( + NSSPKIXCertificate *cert, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCertificate_SetAlgorithmIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificate_SetAlgorithmIdentifier +( + NSSPKIXCertificate *cert, + NSSPKIXAlgorithmIdentifier *algid, +); + +/* + * NSSPKIXCertificate_GetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +NSSPKIXCertificate_GetSignature +( + NSSPKIXCertificate *cert, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCertificate_SetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_POINTER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificate_SetSignature +( + NSSPKIXCertificate *cert, + NSSItem *signature +); + +/* + * NSSPKIXCertificate_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXCertificate_Equal +( + NSSPKIXCertificate *one, + NSSPKIXCertificate *two, + PRStatus *statusOpt +); + +/* + * NSSPKIXCertificate_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificate * +NSSPKIXCertificate_Duplicate +( + NSSPKIXCertificate *cert, + NSSArena *arenaOpt +); + +/* + * TBSCertificate + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TBSCertificate ::= SEQUENCE { + * version [0] Version DEFAULT v1, + * serialNumber CertificateSerialNumber, + * signature AlgorithmIdentifier, + * issuer Name, + * validity Validity, + * subject Name, + * subjectPublicKeyInfo SubjectPublicKeyInfo, + * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, + * -- If present, version shall be v2 or v3 + * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, + * -- If present, version shall be v2 or v3 + * extensions [3] Extensions OPTIONAL + * -- If present, version shall be v3 -- } + * + * The public calls for this type: + * + * NSSPKIXTBSCertificate_Decode + * NSSPKIXTBSCertificate_Create + * NSSPKIXTBSCertificate_Destroy + * NSSPKIXTBSCertificate_Encode + * NSSPKIXTBSCertificate_GetVersion + * NSSPKIXTBSCertificate_SetVersion + * NSSPKIXTBSCertificate_GetSerialNumber + * NSSPKIXTBSCertificate_SetSerialNumber + * NSSPKIXTBSCertificate_GetSignature + * NSSPKIXTBSCertificate_SetSignature + * { inherit algid gettors? } + * NSSPKIXTBSCertificate_GetIssuer + * NSSPKIXTBSCertificate_SetIssuer + * { inherit "helper" issuer gettors? } + * NSSPKIXTBSCertificate_GetValidity + * NSSPKIXTBSCertificate_SetValidity + * { inherit validity accessors } + * NSSPKIXTBSCertificate_GetSubject + * NSSPKIXTBSCertificate_SetSubject + * NSSPKIXTBSCertificate_GetSubjectPublicKeyInfo + * NSSPKIXTBSCertificate_SetSubjectPublicKeyInfo + * NSSPKIXTBSCertificate_HasIssuerUniqueID + * NSSPKIXTBSCertificate_GetIssuerUniqueID + * NSSPKIXTBSCertificate_SetIssuerUniqueID + * NSSPKIXTBSCertificate_RemoveIssuerUniqueID + * NSSPKIXTBSCertificate_HasSubjectUniqueID + * NSSPKIXTBSCertificate_GetSubjectUniqueID + * NSSPKIXTBSCertificate_SetSubjectUniqueID + * NSSPKIXTBSCertificate_RemoveSubjectUniqueID + * NSSPKIXTBSCertificate_HasExtensions + * NSSPKIXTBSCertificate_GetExtensions + * NSSPKIXTBSCertificate_SetExtensions + * NSSPKIXTBSCertificate_RemoveExtensions + * { extension accessors } + * NSSPKIXTBSCertificate_Equal + * NSSPKIXTBSCertificate_Duplicate + */ + +/* + * NSSPKIXTBSCertificate_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertificate * +NSSPKIXTBSCertificate_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXTBSCertificate_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_VERSION + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_SERIAL_NUMBER + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ISSUER_NAME + * NSS_ERROR_INVALID_VALIDITY + * NSS_ERROR_INVALID_SUBJECT_NAME + * NSS_ERROR_INVALID_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_INVALID_ISSUER_UNIQUE_IDENTIFIER + * NSS_ERROR_INVALID_SUBJECT_UNIQUE_IDENTIFIER + * NSS_ERROR_INVALID_EXTENSION + * + * Return value: + */ + +NSS_EXTERN NSSPKIXTBSCertificate * +NSSPKIXTBSCertificate_Create +( + NSSArena *arenaOpt, + NSSPKIXVersion version, + NSSPKIXCertificateSerialNumber *serialNumber, + NSSPKIXAlgorithmIdentifier *signature, + NSSPKIXName *issuer, + NSSPKIXValidity *validity, + NSSPKIXName *subject, + NSSPKIXSubjectPublicKeyInfo *spki, + NSSPKIXUniqueIdentifier *issuerUniqueID, + NSSPKIXUniqueIdentifier *subjectUniqueID, + NSSPKIXExtensions *extensions +); + +/* + * NSSPKIXTBSCertificate_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_Destroy +( + NSSPKIXTBSCertificate *tbsCert +); + +/* + * NSSPKIXTBSCertificate_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXTBSCertificate_Encode +( + NSSPKIXTBSCertificate *tbsCert, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertificate_GetVersion + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid element of the NSSPKIXVersion enumeration upon success + * NSSPKIXVersion_NSSinvalid (-1) upon failure + */ + +NSS_EXTERN NSSPKIXVersion +NSSPKIXTBSCertificate_GetVersion +( + NSSPKIXTBSCertificate *tbsCert +); + +/* + * NSSPKIXTBSCertificate_SetVersion + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_VERSION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_SetVersion +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXVersion version +); + +/* + * NSSPKIXTBSCertificate_GetSerialNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXCertificateSerialNumber upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificateSerialNumber * +NSSPKIXTBSCertificate_GetSerialNumber +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXCertificateSerialNumber *snOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertificate_SetSerialNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_SetSerialNumber +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXCertificateSerialNumber *sn +); + +/* + * NSSPKIXTBSCertificate_GetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +NSSPKIXTBSCertificate_GetSignature +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertificate_SetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_SetSignature +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXAlgorithmIdentifier *algID +); + +/* + * { fgmr inherit algid gettors? } + */ + +/* + * NSSPKIXTBSCertificate_GetIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +NSSPKIXTBSCertificate_GetIssuer +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertificate_SetIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_SetIssuer +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXName *issuer +); + +/* + * { inherit "helper" issuer gettors? } + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * + * Return value: + */ + +/* + * NSSPKIXTBSCertificate_GetValidity + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXValidity upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXValidity * +NSSPKIXTBSCertificate_GetValidity +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertificate_SetValidity + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_SetValidity +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXValidity *validity +); + +/* + * { fgmr inherit validity accessors } + */ + +/* + * NSSPKIXTBSCertificate_GetSubject + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +NSSPKIXTBSCertificate_GetSubject +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertificate_SetSubject + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_SetSubject +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXName *subject +); + +/* + * NSSPKIXTBSCertificate_GetSubjectPublicKeyInfo + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXSubjectPublicKeyInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectPublicKeyInfo * +NSSPKIXTBSCertificate_GetSubjectPublicKeyInfo +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertificate_SetSubjectPublicKeyInfo + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_SetSubjectPublicKeyInfo +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXSubjectPublicKeyInfo *spki +); + +/* + * NSSPKIXTBSCertificate_HasIssuerUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXTBSCertificate_HasIssuerUniqueID +( + NSSPKIXTBSCertificate *tbsCert, + PRStatus *statusOpt +); + +/* + * NSSPKIXTBSCertificate_GetIssuerUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_CERT_HAS_NO_ISSUER_UNIQUE_ID + * + * Return value: + * A valid pointer to an NSSPKIXUniqueIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXUniqueIdentifier * +NSSPKIXTBSCertificate_GetIssuerUniqueID +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXUniqueIdentifier *uidOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertificate_SetIssuerUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_SetIssuerUniqueID +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXUniqueIdentifier *uid +); + +/* + * NSSPKIXTBSCertificate_RemoveIssuerUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_CERT_HAS_NO_ISSUER_UNIQUE_ID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_RemoveIssuerUniqueID +( + NSSPKIXTBSCertificate *tbsCert +); + +/* + * NSSPKIXTBSCertificate_HasSubjectUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXTBSCertificate_HasSubjectUniqueID +( + NSSPKIXTBSCertificate *tbsCert, + PRStatus *statusOpt +); + +/* + * NSSPKIXTBSCertificate_GetSubjectUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_CERT_HAS_NO_SUBJECT_UNIQUE_ID + * + * Return value: + * A valid pointer to an NSSPKIXUniqueIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXUniqueIdentifier * +NSSPKIXTBSCertificate_GetSubjectUniqueID +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXUniqueIdentifier *uidOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertificate_SetSubjectUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_SetSubjectUniqueID +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXUniqueIdentifier *uid +); + +/* + * NSSPKIXTBSCertificate_RemoveSubjectUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_CERT_HAS_NO_SUBJECT_UNIQUE_ID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_RemoveSubjectUniqueID +( + NSSPKIXTBSCertificate *tbsCert +); + +/* + * NSSPKIXTBSCertificate_HasExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXTBSCertificate_HasExtensions +( + NSSPKIXTBSCertificate *tbsCert, + PRStatus *statusOpt +); + +/* + * NSSPKIXTBSCertificate_GetExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_CERT_HAS_NO_EXTENSIONS + * + * Return value: + * A valid pointer to an NSSPKIXExtensions upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensions * +NSSPKIXTBSCertificate_GetExtensions +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertificate_SetExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_EXTENSIONS + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_SetExtensions +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXExtensions *extensions +); + +/* + * NSSPKIXTBSCertificate_RemoveExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_CERT_HAS_NO_EXTENSIONS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertificate_RemoveExtensions +( + NSSPKIXTBSCertificate *tbsCert +); + +/* + * { extension accessors } + */ + +/* + * NSSPKIXTBSCertificate_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXTBSCertificate_Equal +( + NSSPKIXTBSCertificate *one, + NSSPKIXTBSCertificate *two, + PRStatus *statusOpt +); + +/* + * NSSPKIXTBSCertificate_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertificate * +NSSPKIXTBSCertificate_Duplicate +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +/* + * CertificateSerialNumber + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CertificateSerialNumber ::= INTEGER + * + * This is just a typedef'd NSSBER; no methods are required. + * {fgmr -- the asn.1 stuff should have routines to convert + * integers to natural types when possible and vv. we can + * refer to them here..} + */ + +/* + * Validity + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Validity ::= SEQUENCE { + * notBefore Time, + * notAfter Time } + * + * The public calls for the type: + * + * NSSPKIXValidity_Decode + * NSSPKIXValidity_Create + * NSSPKIXValidity_Encode + * NSSPKIXValidity_Destroy + * NSSPKIXValidity_GetNotBefore + * NSSPKIXValidity_SetNotBefore + * NSSPKIXValidity_GetNotAfter + * NSSPKIXValidity_SetNotAfter + * NSSPKIXValidity_Equal + * NSSPKIXValidity_Compare + * NSSPKIXValidity_Duplicate + * + */ + +/* + * NSSPKIXValidity_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXValidity upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXValidity * +NSSPKIXValidity_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXValidity_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_TIME + * + * Return value: + * A valid pointer to an NSSPKIXValidity upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXValidity * +NSSPKIXValidity_Create +( + NSSArena *arenaOpt, + NSSPKIXTime notBefore, + NSSPKIXTime notAfter +); + +/* + * NSSPKIXValidity_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXValidity_Destroy +( + NSSPKIXValidity *validity +); + +/* + * NSSPKIXValidity_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXValidity_Encode +( + NSSPKIXValidity *validity, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXValidity_GetNotBefore + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid NSSPKIXTime upon success + * {we need to rethink NSSPKIXTime} + */ + +NSS_EXTERN NSSPKIXTime +NSSPKIXValidity_GetNotBefore +( + NSSPKIXValidity *validity +); + +/* + * NSSPKIXValidity_SetNotBefore + * + * -- fgmr comments -- + * {do we require that it be before the "notAfter" value?} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_VALUE_TOO_LARGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXValidity_SetNotBefore +( + NSSPKIXValidity *validity, + NSSPKIXTime notBefore +); + +/* + * NSSPKIXValidity_GetNotAfter + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid NSSPKIXTime upon success + * {we need to rethink NSSPKIXTime} + */ + +NSS_EXTERN NSSPKIXTime +NSSPKIXValidity_GetNotAfter +( + NSSPKIXValidity *validity +); + +/* + * NSSPKIXValidity_SetNotAfter + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_VALUE_TOO_SMALL + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXValidity_SetNotAfter +( + NSSPKIXValidity *validity, + NSSPKIXTime notAfter +); + +/* + * NSSPKIXValidity_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXValidity_Equal +( + NSSPKIXValidity *one, + NSSPKIXValidity *two, + PRStatus *statusOpt +); + +/* + * NSSPKIXValidity_Compare + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * + * Return value: + * 1 if the second is "greater" or later than the first + * 0 if they are equal + * -1 if the first is "greater" or later than the first + * -2 upon failure + */ + +NSS_EXTERN PRIntn +NSSPKIXValidity_Compare +( + NSSPKIXValidity *one, + NSSPKIXValidity *two +); + +/* + * NSSPKIXValidity_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXValidity upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXValidity * +NSSPKIXValidity_Duplicate +( + NSSPKIXValidity *validity, + NSSArena *arenaOpt +); + +/* + * Time + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Time ::= CHOICE { + * utcTime UTCTime, + * generalTime GeneralizedTime } + * + * The public calls for the type: + * + * NSSPKIXTime_Decode + * NSSPKIXTime_CreateFromPRTime + * NSSPKIXTime_CreateFromUTF8 + * NSSPKIXTime_Destroy + * NSSPKIXTime_Encode + * NSSPKIXTime_GetPRTime + * NSSPKIXTime_GetUTF8Encoding + * NSSPKIXTime_Equal + * NSSPKIXTime_Duplicate + * NSSPKIXTime_Compare + * + */ + +/* + * NSSPKIXTime_Decode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTime upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTime * +NSSPKIXTime_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXTime_CreateFromPRTime + * + */ + +NSS_EXTERN NSSPKIXTime * +NSSPKIXTime_CreateFromPRTime +( + NSSArena *arenaOpt, + PRTime prTime +); + +/* + * NSSPKIXTime_CreateFromUTF8 + * + */ + +NSS_EXTERN NSSPKIXTime * +NSSPKIXTime_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXTime_Destroy + * + */ + +NSS_EXTERN PR_STATUS +NSSPKIXTime_Destroy +( + NSSPKIXTime *time +); + +/* + * NSSPKIXTime_Encode + * + */ + +NSS_EXTERN NSSBER * +NSSPKIXTime_Encode +( + NSSPKIXTime *time, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTime_GetPRTime + * + * Returns a zero on error + */ + +NSS_EXTERN PRTime +NSSPKIXTime_GetPRTime +( + NSSPKIXTime *time, + PRStatus *statusOpt +); + +/* + * NSSPKIXTime_GetUTF8Encoding + * + */ + +NSS_EXTERN NSSUTF8 * +NSSPKXITime_GetUTF8Encoding +( + NSSPKIXTime *time, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTime_Equal + * + */ + +NSS_EXTERN PRBool +NSSPKXITime_Equal +( + NSSPKXITime *time1, + NSSPKXITime *time2, + PRStatus *statusOpt +); + +/* + * NSSPKIXTime_Duplicate + * + */ + +NSS_EXTERN NSSPKIXTime * +NSSPKXITime_Duplicate +( + NSSPKIXTime *time, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTime_Compare + * + * Usual result: -1, 0, 1 + * Returns 0 on error + */ + +NSS_EXTERN PRInt32 +NSSPKIXTime_Compare +( + NSSPKIXTime *time1, + NSSPKIXTime *tiem2, + PRStatus *statusOpt +); + +/* + * UniqueIdentifier + * + * -- fgmr comments -- + * Should we distinguish bitstrings from "regular" items/BERs? + * It could be another typedef, but with a separate type to help + * remind users about the factor of 8. OR we could make it a + * hard type, and require the use of some (trivial) converters. + * + * From RFC 2459: + * + * UniqueIdentifier ::= BIT STRING + * + */ + +/* + * SubjectPublicKeyInfo + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * SubjectPublicKeyInfo ::= SEQUENCE { + * algorithm AlgorithmIdentifier, + * subjectPublicKey BIT STRING } + * + * The public calls for the type: + * + * NSSPKIXSubjectPublicKeyInfo_Decode + * NSSPKIXSubjectPublicKeyInfo_Create + * NSSPKIXSubjectPublicKeyInfo_Encode + * NSSPKIXSubjectPublicKeyInfo_Destroy + * NSSPKIXSubjectPublicKeyInfo_GetAlgorithm + * NSSPKIXSubjectPublicKeyInfo_SetAlgorithm + * NSSPKIXSubjectPublicKeyInfo_GetSubjectPublicKey + * NSSPKIXSubjectPublicKeyInfo_SetSubjectPublicKey + * NSSPKIXSubjectPublicKeyInfo_Equal + * NSSPKIXSubjectPublicKeyInfo_Duplicate + * + */ + +/* + * NSSPKIXSubjectPublicKeyInfo_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXSubjectPublicKeyInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectPublicKeyInfo * +NSSPKIXSubjectPublicKeyInfo_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXSubjectPublicKeyInfo_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXSubjectPublicKeyInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectPublicKeyInfo * +NSSPKIXSubjectPublicKeyInfo_Create +( + NSSArena *arenaOpt, + NSSPKIXAlgorithmIdentifier *algid, + NSSItem *subjectPublicKey +); + +/* + * NSSPKIXSubjectPublicKeyInfo_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXSubjectPublicKeyInfo_Destroy +( + NSSPKIXSubjectPublicKeyInfo *spki +); + +/* + * NSSPKIXSubjectPublicKeyInfo_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXSubjectPublicKeyInfo_Encode +( + NSSPKIXSubjectPublicKeyInfo *spki, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXSubjectPublicKeyInfo_GetAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +NSSPKIXSubjectPublicKeyInfo_GetAlgorithm +( + NSSPKIXSubjectPublicKeyInfo *spki, + NSSArena *arenaOpt +); + +/* + * NSSPKIXSubjectPublicKeyInfo_SetAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXSubjectPublicKeyInfo_SetAlgorithm +( + NSSPKIXSubjectPublicKeyInfo *spki, + NSSPKIXAlgorithmIdentifier *algid +); + +/* + * NSSPKIXSubjectPublicKeyInfo_GetSubjectPublicKey + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +NSSPKIXSubjectPublicKeyInfo_GetSubjectPublicKey +( + NSSPKIXSubjectPublicKeyInfo *spki, + NSSItem *spkOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXSubjectPublicKeyInfo_SetSubjectPublicKey + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXSubjectPublicKeyInfo_SetSubjectPublicKey +( + NSSPKIXSubjectPublicKeyInfo *spki, + NSSItem *spk +); + +/* + * NSSPKIXSubjectPublicKeyInfo_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXSubjectPublicKeyInfo_Equal +( + NSSPKIXSubjectPublicKeyInfo *one, + NSSPKIXSubjectPublicKeyInfo *two, + PRStatus *statusOpt +); + +/* + * NSSPKIXSubjectPublicKeyInfo_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXSubjectPublicKeyInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectPublicKeyInfo * +NSSPKIXSubjectPublicKeyInfo_Duplicate +( + NSSPKIXSubjectPublicKeyInfo *spki, + NSSArena *arenaOpt +); + +/* + * Extensions + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension + * + */ + +/* { FGMR } */ + +/* + * Extension + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Extension ::= SEQUENCE { + * extnID OBJECT IDENTIFIER, + * critical BOOLEAN DEFAULT FALSE, + * extnValue OCTET STRING } + * + */ + +/* { FGMR } */ + +/* + * CertificateList + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CertificateList ::= SEQUENCE { + * tbsCertList TBSCertList, + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING } + * + * The public calls for the type: + * + * NSSPKIXCertificateList_Decode + * NSSPKIXCertificateList_Create + * NSSPKIXCertificateList_Encode + * NSSPKIXCertificateList_Destroy + * NSSPKIXCertificateList_GetTBSCertList + * NSSPKIXCertificateList_SetTBSCertList + * NSSPKIXCertificateList_GetSignatureAlgorithm + * NSSPKIXCertificateList_SetSignatureAlgorithm + * NSSPKIXCertificateList_GetSignature + * NSSPKIXCertificateList_SetSignature + * NSSPKIXCertificateList_Equal + * NSSPKIXCertificateList_Duplicate + * + */ + +/* + * NSSPKIXCertificateList_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCertificateList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificateList * +NSSPKIXCertificateList_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXCertificateList_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXCertificateList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificateList * +NSSPKIXCertificateList_Create +( + NSSArena *arenaOpt, + NSSPKIXTBSCertList *tbsCertList, + NSSPKIXAlgorithmIdentifier *sigAlg, + NSSItem *signature +); + +/* + * NSSPKIXCertificateList_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificateList_Destroy +( + NSSPKIXCertificateList *certList +); + +/* + * NSSPKIXCertificateList_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXCertificateList_Encode +( + NSSPKIXCertificateList *certList, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCertificateList_GetTBSCertList + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertList * +NSSPKIXCertificateList_GetTBSCertList +( + NSSPKIXCertificateList *certList, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCertificateList_SetTBSCertList + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificateList_SetTBSCertList +( + NSSPKIXCertificateList *certList, + NSSPKIXTBSCertList *tbsCertList +); + +/* + * NSSPKIXCertificateList_GetSignatureAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +NSSPKIXCertificateList_GetSignatureAlgorithm +( + NSSPKIXCertificateList *certList, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCertificateList_SetSignatureAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificateList_SetSignatureAlgorithm +( + NSSPKIXCertificateList *certList, + NSSPKIXAlgorithmIdentifier *sigAlg +); + +/* + * NSSPKIXCertificateList_GetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +NSSPKIXCertificateList_GetSignature +( + NSSPKIXCertificateList *certList, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCertificateList_SetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificateList_SetSignature +( + NSSPKIXCertificateList *certList, + NSSItem *sig +); + +/* + * NSSPKIXCertificateList_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXCertificateList_Equal +( + NSSPKIXCertificateList *one, + NSSPKIXCertificateList *two, + PRStatus *statusOpt +); + +/* + * NSSPKIXCertificateList_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXCertificateList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificateList * +NSSPKIXCertificateList_Duplicate +( + NSSPKIXCertificateList *certList, + NSSArena *arenaOpt +); + +/* + * TBSCertList + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TBSCertList ::= SEQUENCE { + * version Version OPTIONAL, + * -- if present, shall be v2 + * signature AlgorithmIdentifier, + * issuer Name, + * thisUpdate Time, + * nextUpdate Time OPTIONAL, + * revokedCertificates SEQUENCE OF SEQUENCE { + * userCertificate CertificateSerialNumber, + * revocationDate Time, + * crlEntryExtensions Extensions OPTIONAL + * -- if present, shall be v2 + * } OPTIONAL, + * crlExtensions [0] Extensions OPTIONAL + * -- if present, shall be v2 -- } + * + * The public calls for the type: + * + * NSSPKIXTBSCertList_Decode + * NSSPKIXTBSCertList_Create + * NSSPKIXTBSCertList_Destroy + * NSSPKIXTBSCertList_Encode + * NSSPKIXTBSCertList_GetVersion + * NSSPKIXTBSCertList_SetVersion + * NSSPKIXTBSCertList_GetSignature + * NSSPKIXTBSCertList_SetSignature + * NSSPKIXTBSCertList_GetIssuer + * NSSPKIXTBSCertList_SetIssuer + * NSSPKIXTBSCertList_GetThisUpdate + * NSSPKIXTBSCertList_SetThisUpdate + * NSSPKIXTBSCertList_HasNextUpdate + * NSSPKIXTBSCertList_GetNextUpdate + * NSSPKIXTBSCertList_SetNextUpdate + * NSSPKIXTBSCertList_RemoveNextUpdate + * NSSPKIXTBSCertList_GetRevokedCertificates + * NSSPKIXTBSCertList_SetRevokedCertificates + * NSSPKIXTBSCertList_HasCrlExtensions + * NSSPKIXTBSCertList_GetCrlExtensions + * NSSPKIXTBSCertList_SetCrlExtensions + * NSSPKIXTBSCertList_RemoveCrlExtensions + * NSSPKIXTBSCertList_Equal + * NSSPKIXTBSCertList_Duplicate + * + */ + +/* + * NSSPKIXTBSCertList_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertList * +NSSPKIXTBSCertList_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXTBSCertList_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_VERSION + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_PKIX_TIME + * (something for the times being out of order?) + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_PKIX_EXTENSIONS + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertList * +NSSPKIXTBSCertList_Create +( + NSSArena *arenaOpt, + NSSPKIXVersion version, + NSSPKIXAlgorithmIdentifier *signature, + NSSPKIXName *issuer, + NSSPKIXTime thisUpdate, + NSSPKIXTime nextUpdateOpt, + NSSPKIXrevokedCertificates *revokedCerts, + NSSPKIXExtensions *crlExtensionsOpt +); + +/* + * NSSPKIXTBSCertList_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertList_Destroy +( + NSSPKIXTBSCertList *certList +); + +/* + * NSSPKIXTBSCertList_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXTBSCertList_Encode +( + NSSPKIXTBSCertList *certList, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertList_GetVersion + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid element of the NSSPKIXVersion enumeration upon success + * NSSPKIXVersion_NSSinvalid (-1) upon failure + */ + +NSS_EXTERN NSSPKIXVersion +NSSPKIXTBSCertList_GetVersion +( + NSSPKIXTBSCertList *certList +); + +/* + * NSSPKIXTBSCertList_SetVersion + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_PKIX_VERSION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertList_SetVersion +( + NSSPKIXTBSCertList *certList, + NSSPKIXVersion version +); + +/* + * NSSPKIXTBSCertList_GetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +NSSPKIXTBSCertList_GetSignature +( + NSSPKIXTBSCertList *certList, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertList_SetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertList_SetSignature +( + NSSPKIXTBSCertList *certList, + NSSPKIXAlgorithmIdentifier *algid, +); + +/* + * NSSPKIXTBSCertList_GetIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +NSSPKIXTBSCertList_GetIssuer +( + NSSPKIXTBSCertList *certList, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertList_SetIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertList_SetIssuer +( + NSSPKIXTBSCertList *certList, + NSSPKIXName *issuer +); + +/* + * NSSPKIXTBSCertList_GetThisUpdate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid NSSPKIXTime upon success + * {we need to rethink NSSPKIXTime} + */ + +NSS_EXTERN NSSPKIXTime +NSSPKIXTBSCertList_GetThisUpdate +( + NSSPKIXTBSCertList *certList +); + +/* + * NSSPKIXTBSCertList_SetThisUpdate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_VALUE_TOO_LARGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertList_SetThisUpdate +( + NSSPKIXTBSCertList *certList, + NSSPKIXTime thisUpdate +); + +/* + * NSSPKIXTBSCertList_HasNextUpdate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXTBSCertList_HasNextUpdate +( + NSSPKIXTBSCertList *certList, + PRStatus *statusOpt +); + +/* + * NSSPKIXTBSCertList_GetNextUpdate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid NSSPKIXTime upon success + * {we need to rethink NSSPKIXTime} + */ + +NSS_EXTERN NSSPKIXTime +NSSPKIXTBSCertList_GetNextUpdate +( + NSSPKIXTBSCertList *certList +); + +/* + * NSSPKIXTBSCertList_SetNextUpdate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_VALUE_TOO_SMALL + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertList_SetNextUpdate +( + NSSPKIXTBSCertList *certList, + NSSPKIXTime nextUpdate +); + +/* + * NSSPKIXTBSCertList_RemoveNextUpdate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_HAS_NO_NEXT_UPDATE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertList_RemoveNextUpdate +( + NSSPKIXTBSCertList *certList +); + +/* + * NSSPKIXTBSCertList_GetRevokedCertificates + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificates upon succes + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificates * +NSSPKIXTBSCertList_GetRevokedCertificates +( + NSSPKIXTBSCertList *certList, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertList_SetRevokedCertificates + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATES + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertList_SetRevokedCertificates +( + NSSPKIXTBSCertList *certList, + NSSPKIXrevokedCertificates *revoked +); + +/* + * NSSPKIXTBSCertList_HasCrlExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXTBSCertList_HasCrlExtensions +( + NSSPKIXTBSCertList *certList, + PRStatus *statusOpt +); + +/* + * NSSPKIXTBSCertList_GetCrlExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXExtensions upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensions * +NSSPKIXTBSCertList_GetCrlExtensions +( + NSSPKIXTBSCertList *certList, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTBSCertList_SetCrlExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_PKIX_EXTENSIONS + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertList_SetCrlExtensions +( + NSSPKIXTBSCertList *certList, + NSSPKIXExtensions *extensions +); + +/* + * NSSPKIXTBSCertList_RemoveCrlExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_HAS_NO_EXTENSIONS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTBSCertList_RemoveCrlExtensions +( + NSSPKIXTBSCertList *certList +); + +/* + * NSSPKIXTBSCertList_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXTBSCertList_Equal +( + NSSPKIXTBSCertList *one, + NSSPKIXTBSCertList *two, + PRStatus *statusOpt +); + +/* + * NSSPKIXTBSCertList_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertList * +NSSPKIXTBSCertList_Duplicate +( + NSSPKIXTBSCertList *certList, + NSSArena *arenaOpt +); + +/* + * revokedCertificates + * + * This is a "helper type" to simplify handling of TBSCertList objects. + * + * revokedCertificates SEQUENCE OF SEQUENCE { + * userCertificate CertificateSerialNumber, + * revocationDate Time, + * crlEntryExtensions Extensions OPTIONAL + * -- if present, shall be v2 + * } OPTIONAL, + * + * The public calls for the type: + * + * NSSPKIXrevokedCertificates_Decode + * NSSPKIXrevokedCertificates_Create + * NSSPKIXrevokedCertificates_Encode + * NSSPKIXrevokedCertificates_Destroy + * NSSPKIXrevokedCertificates_GetRevokedCertificateCount + * NSSPKIXrevokedCertificates_GetRevokedCertificates + * NSSPKIXrevokedCertificates_SetRevokedCertificates + * NSSPKIXrevokedCertificates_GetRevokedCertificate + * NSSPKIXrevokedCertificates_SetRevokedCertificate + * NSSPKIXrevokedCertificates_InsertRevokedCertificate + * NSSPKIXrevokedCertificates_AppendRevokedCertificate + * NSSPKIXrevokedCertificates_RemoveRevokedCertificate + * NSSPKIXrevokedCertificates_Equal + * NSSPKIXrevokedCertificates_Duplicate + * + */ + +/* + * NSSPKIXrevokedCertificates_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificates upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificates * +NSSPKIXrevokedCertificates_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXrevokedCertificates_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_REVOKED_CERTIFICATE + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificates upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificates * +NSSPKIXrevokedCertificates_Create +( + NSSArena *arenaOpt, + NSSPKIXrevokedCertificate *rc1, + ... +); + +/* + * NSSPKIXrevokedCertificates_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXrevokedCertificates_Destroy +( + NSSPKIXrevokedCertificates *rcs +); + +/* + * NSSPKIXrevokedCertificates_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXrevokedCertificates_Encode +( + NSSPKIXrevokedCertificates *rcs, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXrevokedCertificates_GetRevokedCertificateCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXrevokedCertificates_GetRevokedCertificateCount +( + NSSPKIXrevokedCertificates *rcs +); + +/* + * NSSPKIXrevokedCertificates_GetRevokedCertificates + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXrevokedCertificate pointers + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificate ** +NSSPKIXrevokedCertificates_GetRevokedCertificates +( + NSSPKIXrevokedCertificates *rcs, + NSSPKIXrevokedCertificate *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXrevokedCertificates_SetRevokedCertificates + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_REVOKED_CERTIFICATE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXrevokedCertificates_SetRevokedCertificates +( + NSSPKIXrevokedCertificates *rcs, + NSSPKIXrevokedCertificate *rc[], + PRInt32 countOpt +); + +/* + * NSSPKIXrevokedCertificates_GetRevokedCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificate * +NSSPKIXrevokedCertificates_GetRevokedCertificate +( + NSSPKIXrevokedCertificates *rcs, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXrevokedCertificates_SetRevokedCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_REVOKED_CERTIFICATE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXrevokedCertificates_SetRevokedCertificate +( + NSSPKIXrevokedCertificates *rcs, + PRInt32 i, + NSSPKIXrevokedCertificate *rc +); + +/* + * NSSPKIXrevokedCertificates_InsertRevokedCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_REVOKED_CERTIFICATE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXrevokedCertificates_InsertRevokedCertificate +( + NSSPKIXrevokedCertificates *rcs, + PRInt32 i, + NSSPKIXrevokedCertificate *rc +); + +/* + * NSSPKIXrevokedCertificates_AppendRevokedCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_REVOKED_CERTIFICATE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXrevokedCertificates_AppendRevokedCertificate +( + NSSPKIXrevokedCertificates *rcs, + PRInt32 i, + NSSPKIXrevokedCertificate *rc +); + +/* + * NSSPKIXrevokedCertificates_RemoveRevokedCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXrevokedCertificates_RemoveRevokedCertificate +( + NSSPKIXrevokedCertificates *rcs, + PRInt32 i +); + +/* + * NSSPKIXrevokedCertificates_FindRevokedCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_REVOKED_CERTIFICATE + * + * Return value: + * The index of the specified revoked certificate upon success + * -1 upon failure + */ + +NSS_EXTERN PRInt32 +NSSPKIXrevokedCertificates_FindRevokedCertificate +( + NSSPKIXrevokedCertificates *rcs, + NSSPKIXrevokedCertificate *rc +); + +/* + * NSSPKIXrevokedCertificates_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXrevokedCertificates_Equal +( + NSSPKIXrevokedCertificates *one, + NSSPKIXrevokedCertificates *two, + PRStatus *statusOpt +); + +/* + * NSSPKIXrevokedCertificates_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificates upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificates * +NSSPKIXrevokedCertificates_Duplicate +( + NSSPKIXrevokedCertificates *rcs, + NSSArena *arenaOpt +); + +/* + * revokedCertificate + * + * This is a "helper type" to simplify handling of TBSCertList objects. + * + * SEQUENCE { + * userCertificate CertificateSerialNumber, + * revocationDate Time, + * crlEntryExtensions Extensions OPTIONAL + * -- if present, shall be v2 + * } OPTIONAL, + * + * The public calls for this type: + * + * NSSPKIXrevokedCertificate_Decode + * NSSPKIXrevokedCertificate_Create + * NSSPKIXrevokedCertificate_Encode + * NSSPKIXrevokedCertificate_Destroy + * NSSPKIXrevokedCertificate_GetUserCertificate + * NSSPKIXrevokedCertificate_SetUserCertificate + * NSSPKIXrevokedCertificate_GetRevocationDate + * NSSPKIXrevokedCertificate_SetRevocationDate + * NSSPKIXrevokedCertificate_HasCrlEntryExtensions + * NSSPKIXrevokedCertificate_GetCrlEntryExtensions + * NSSPKIXrevokedCertificate_SetCrlEntryExtensions + * NSSPKIXrevokedCertificate_RemoveCrlEntryExtensions + * NSSPKIXrevokedCertificate_Equal + * NSSPKIXrevokedCertificate_Duplicate + * + */ + + +/* + * NSSPKIXrevokedCertificate_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificate * +NSSPKIXrevokedCertificate_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXrevokedCertificate_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_SERIAL_NUMBER + * NSS_ERROR_INVALID_PKIX_TIME + * NSS_ERROR_INVALID_PKIX_EXTENSIONS + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificate * +NSSPKIXrevokedCertificate_Create +( + NSSArena *arenaOpt, + NSSPKIXCertificateSerialNumber *userCertificate, + NSSPKIXTime *revocationDate, + NSSPKIXExtensions *crlEntryExtensionsOpt +); + +/* + * NSSPKIXrevokedCertificate_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXrevokedCertificate_Destroy +( + NSSPKIXrevokedCertificate *rc +); + +/* + * NSSPKIXrevokedCertificate_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXrevokedCertificate_Encode +( + NSSPKIXrevokedCertificate *rc, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXrevokedCertificate_GetUserCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXCertificateSerialNumber upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificateSerialNumber * +NSSPKIXrevokedCertificate_GetUserCertificate +( + NSSPKIXrevokedCertificate *rc, + NSSArena *arenaOpt +); + +/* + * NSSPKIXrevokedCertificate_SetUserCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_SERIAL_NUMBER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXrevokedCertificate_SetUserCertificate +( + NSSPKIXrevokedCertificate *rc, + NSSPKIXCertificateSerialNumber *csn +); + +/* + * NSSPKIXrevokedCertificate_GetRevocationDate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXTime upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTime * +NSSPKIXrevokedCertificate_GetRevocationDate +( + NSSPKIXrevokedCertificate *rc, + NSSArena *arenaOpt +); + +/* + * NSSPKIXrevokedCertificate_SetRevocationDate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_TIME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXrevokedCertificate_SetRevocationDate +( + NSSPKIXrevokedCertificate *rc, + NSSPKIXTime *revocationDate +); + +/* + * NSSPKIXrevokedCertificate_HasCrlEntryExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXrevokedCertificate_HasCrlEntryExtensions +( + NSSPKIXrevokedCertificate *rc, + PRStatus *statusOpt +); + +/* + * NSSPKIXrevokedCertificate_GetCrlEntryExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_NO_EXTENSIONS + * + * Return value: + * A valid pointer to an NSSPKIXExtensions upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensions * +NSSPKIXrevokedCertificate_GetCrlEntryExtensions +( + NSSPKIXrevokedCertificate *rc, + NSSArena *arenaOpt +); + +/* + * NSSPKIXrevokedCertificate_SetCrlEntryExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_EXTENSIONS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXrevokedCertificate_SetCrlEntryExtensions +( + NSSPKIXrevokedCertificate *rc, + NSSPKIXExtensions *crlEntryExtensions +); + +/* + * NSSPKIXrevokedCertificate_RemoveCrlEntryExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_NO_EXTENSIONS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXrevokedCertificate_RemoveCrlEntryExtensions +( + NSSPKIXrevokedCertificate *rc +); + +/* + * NSSPKIXrevokedCertificate_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXrevokedCertificate_Equal +( + NSSPKIXrevokedCertificate *one, + NSSPKIXrevokedCertificate *two, + PRStatus *statusOpt +); + +/* + * NSSPKIXrevokedCertificate_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificate * +NSSPKIXrevokedCertificate_Duplicate +( + NSSPKIXrevokedCertificate *rc, + NSSArena *arenaOpt +); + +/* + * AlgorithmIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * (1988 syntax) + * + * AlgorithmIdentifier ::= SEQUENCE { + * algorithm OBJECT IDENTIFIER, + * parameters ANY DEFINED BY algorithm OPTIONAL } + * -- contains a value of the type + * -- registered for use with the + * -- algorithm object identifier value + * + * The public calls for this type: + * + * NSSPKIXAlgorithmIdentifier_Decode + * NSSPKIXAlgorithmIdentifier_Create + * NSSPKIXAlgorithmIdentifier_Encode + * NSSPKIXAlgorithmIdentifier_Destroy + * NSSPKIXAlgorithmIdentifier_GetAlgorithm + * NSSPKIXAlgorithmIdentifier_SetAlgorithm + * NSSPKIXAlgorithmIdentifier_GetParameters + * NSSPKIXAlgorithmIdentifier_SetParameters + * NSSPKIXAlgorithmIdentifier_Compare + * NSSPKIXAlgorithmIdentifier_Duplicate + * { algorithm-specific parameter types and accessors ? } + * + */ + +/* + * NSSPKIXAlgorithmIdentifier_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +NSSPKIXAlgorithmIdentifier_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXAlgorithmIdentifier_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_POINTER + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +NSSPKIXAlgorithmIdentifier_Create +( + NSSArena *arenaOpt, + NSSOID *algorithm, + NSSItem *parameters +); + +/* + * NSSPKIXAlgorithmIdentifier_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAlgorithmIdentifier_Destroy +( + NSSPKIXAlgorithmIdentifier *algid +); + +/* + * NSSPKIXAlgorithmIdentifier_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXAlgorithmIdentifier_Encode +( + NSSPKIXAlgorithmIdentifier *algid, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAlgorithmIdentifier_GetAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSOID pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSOID * +NSSPKIXAlgorithmIdentifier_GetAlgorithm +( + NSSPKIXAlgorithmIdentifier *algid +); + +/* + * NSSPKIXAlgorithmIdentifier_SetAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_OID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAlgorithmIdentifier_SetAlgorithm +( + NSSPKIXAlgorithmIdentifier *algid, + NSSOID *algorithm +); + +/* + * NSSPKIXAlgorithmIdentifier_GetParameters + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +NSSPKIXAlgorithmIdentifier_GetParameters +( + NSSPKIXAlgorithmIdentifier *algid, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAlgorithmIdentifier_SetParameters + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_POINTER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAlgorithmIdentifier_SetParameters +( + NSSPKIXAlgorithmIdentifier *algid, + NSSItem *parameters +); + +/* + * NSSPKIXAlgorithmIdentifier_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXAlgorithmIdentifier_Equal +( + NSSPKIXAlgorithmIdentifier *algid1, + NSSPKIXAlgorithmIdentifier *algid2, + PRStatus *statusOpt +); + +/* + * NSSPKIXAlgorithmIdentifier_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +NSSPKIXAlgorithmIdentifier_Duplicate +( + NSSPKIXAlgorithmIdentifier *algid, + NSSArena *arenaOpt +); + +/* + * { algorithm-specific parameter types and accessors ? } + */ + +/* + * ORAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ORAddress ::= SEQUENCE { + * built-in-standard-attributes BuiltInStandardAttributes, + * built-in-domain-defined-attributes + * BuiltInDomainDefinedAttributes OPTIONAL, + * -- see also teletex-domain-defined-attributes + * extension-attributes ExtensionAttributes OPTIONAL } + * -- The OR-address is semantically absent from the OR-name if the + * -- built-in-standard-attribute sequence is empty and the + * -- built-in-domain-defined-attributes and extension-attributes are + * -- both omitted. + * + * The public calls for this type: + * + * NSSPKIXORAddress_Decode + * NSSPKIXORAddress_Create + * NSSPKIXORAddress_Destroy + * NSSPKIXORAddress_Encode + * NSSPKIXORAddress_GetBuiltInStandardAttributes + * NSSPKIXORAddress_SetBuiltInStandardAttributes + * NSSPKIXORAddress_HasBuiltInDomainDefinedAttributes + * NSSPKIXORAddress_GetBuiltInDomainDefinedAttributes + * NSSPKIXORAddress_SetBuiltInDomainDefinedAttributes + * NSSPKIXORAddress_RemoveBuiltInDomainDefinedAttributes + * NSSPKIXORAddress_HasExtensionsAttributes + * NSSPKIXORAddress_GetExtensionsAttributes + * NSSPKIXORAddress_SetExtensionsAttributes + * NSSPKIXORAddress_RemoveExtensionsAttributes + * NSSPKIXORAddress_Equal + * NSSPKIXORAddress_Duplicate + * + */ + +/* + * NSSPKIXORAddress_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXORAddres upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXORAddress * +NSSPKIXORAddress_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXORAddress_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_EXTENSIONS_ATTRIBUTES + * + * Return value: + * A valid pointer to an NSSPKIXORAddres upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXORAddress * +NSSPKIXORAddress_Create +( + NSSArena *arenaOpt, + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXBuiltInDomainDefinedAttributes *biddaOpt, + NSSPKIXExtensionAttributes *eaOpt +); + +/* + * NSSPKIXORAddress_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXORAddress_Destroy +( + NSSPKIXORAddress *ora +); + +/* + * NSSPKIXORAddress_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXORAddress_Encode +( + NSSPKIXORAddress *ora, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXORAddress_GetBuiltInStandardAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInStandardAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInStandardAttributes * +NSSPKIXORAddress_GetBuiltInStandardAttributes +( + NSSPKIXORAddress *ora, + NSSArena *arenaOpt +); + +/* + * NSSPKIXORAddress_SetBuiltInStandardAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXORAddress_SetBuiltInStandardAttributes +( + NSSPKIXORAddress *ora, + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * NSSPKIXORAddress_HasBuiltInDomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXORAddress_HasBuiltInDomainDefinedAttributes +( + NSSPKIXORAddress *ora, + PRStatus *statusOpt +); + +/* + * NSSPKIXORAddress_GetBuiltInDomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_NO_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttributes upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttributes * +NSSPKIXORAddress_GetBuiltInDomainDefinedAttributes +( + NSSPKIXORAddress *ora, + NSSArena *arenaOpt +); + +/* + * NSSPKIXORAddress_SetBuiltInDomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXORAddress_SetBuiltInDomainDefinedAttributes +( + NSSPKIXORAddress *ora, + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * NSSPKIXORAddress_RemoveBuiltInDomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_NO_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXORAddress_RemoveBuiltInDomainDefinedAttributes +( + NSSPKIXORAddress *ora +); + +/* + * NSSPKIXORAddress_HasExtensionsAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXORAddress_HasExtensionsAttributes +( + NSSPKIXORAddress *ora, + PRStatus *statusOpt +); + +/* + * NSSPKIXORAddress_GetExtensionsAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_NO_EXTENSION_ATTRIBUTES + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttributes * +NSSPKIXORAddress_GetExtensionsAttributes +( + NSSPKIXORAddress *ora, + NSSArena *arenaOpt +); + +/* + * NSSPKIXORAddress_SetExtensionsAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXORAddress_SetExtensionsAttributes +( + NSSPKIXORAddress *ora, + NSSPKIXExtensionAttributes *eaOpt +); + +/* + * NSSPKIXORAddress_RemoveExtensionsAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_NO_EXTENSION_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXORAddress_RemoveExtensionsAttributes +( + NSSPKIXORAddress *ora +); + +/* + * NSSPKIXORAddress_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXORAddress_Equal +( + NSSPKIXORAddress *ora1, + NSSPKIXORAddress *ora2, + PRStatus *statusOpt +); + +/* + * NSSPKIXORAddress_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXORAddres upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXORAddress * +NSSPKIXORAddress_Duplicate +( + NSSPKIXORAddress *ora, + NSSArena *arenaOpt +); + +/* + * BuiltInStandardAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BuiltInStandardAttributes ::= SEQUENCE { + * country-name CountryName OPTIONAL, + * administration-domain-name AdministrationDomainName OPTIONAL, + * network-address [0] NetworkAddress OPTIONAL, + * -- see also extended-network-address + * terminal-identifier [1] TerminalIdentifier OPTIONAL, + * private-domain-name [2] PrivateDomainName OPTIONAL, + * organization-name [3] OrganizationName OPTIONAL, + * -- see also teletex-organization-name + * numeric-user-identifier [4] NumericUserIdentifier OPTIONAL, + * personal-name [5] PersonalName OPTIONAL, + * -- see also teletex-personal-name + * organizational-unit-names [6] OrganizationalUnitNames OPTIONAL + * -- see also teletex-organizational-unit-names -- } + * + * The public calls for this type: + * + * NSSPKIXBuiltInStandardAttributes_Decode + * NSSPKIXBuiltInStandardAttributes_Create + * NSSPKIXBuiltInStandardAttributes_Destroy + * NSSPKIXBuiltInStandardAttributes_Encode + * NSSPKIXBuiltInStandardAttributes_HasCountryName + * NSSPKIXBuiltInStandardAttributes_GetCountryName + * NSSPKIXBuiltInStandardAttributes_SetCountryName + * NSSPKIXBuiltInStandardAttributes_RemoveCountryName + * NSSPKIXBuiltInStandardAttributes_HasAdministrationDomainName + * NSSPKIXBuiltInStandardAttributes_GetAdministrationDomainName + * NSSPKIXBuiltInStandardAttributes_SetAdministrationDomainName + * NSSPKIXBuiltInStandardAttributes_RemoveAdministrationDomainName + * NSSPKIXBuiltInStandardAttributes_HasNetworkAddress + * NSSPKIXBuiltInStandardAttributes_GetNetworkAddress + * NSSPKIXBuiltInStandardAttributes_SetNetworkAddress + * NSSPKIXBuiltInStandardAttributes_RemoveNetworkAddress + * NSSPKIXBuiltInStandardAttributes_HasTerminalIdentifier + * NSSPKIXBuiltInStandardAttributes_GetTerminalIdentifier + * NSSPKIXBuiltInStandardAttributes_SetTerminalIdentifier + * NSSPKIXBuiltInStandardAttributes_RemoveTerminalIdentifier + * NSSPKIXBuiltInStandardAttributes_HasPrivateDomainName + * NSSPKIXBuiltInStandardAttributes_GetPrivateDomainName + * NSSPKIXBuiltInStandardAttributes_SetPrivateDomainName + * NSSPKIXBuiltInStandardAttributes_RemovePrivateDomainName + * NSSPKIXBuiltInStandardAttributes_HasOrganizationName + * NSSPKIXBuiltInStandardAttributes_GetOrganizationName + * NSSPKIXBuiltInStandardAttributes_SetOrganizationName + * NSSPKIXBuiltInStandardAttributes_RemoveOrganizationName + * NSSPKIXBuiltInStandardAttributes_HasNumericUserIdentifier + * NSSPKIXBuiltInStandardAttributes_GetNumericUserIdentifier + * NSSPKIXBuiltInStandardAttributes_SetNumericUserIdentifier + * NSSPKIXBuiltInStandardAttributes_RemoveNumericUserIdentifier + * NSSPKIXBuiltInStandardAttributes_HasPersonalName + * NSSPKIXBuiltInStandardAttributes_GetPersonalName + * NSSPKIXBuiltInStandardAttributes_SetPersonalName + * NSSPKIXBuiltInStandardAttributes_RemovePersonalName + * NSSPKIXBuiltInStandardAttributes_HasOrganizationLUnitNames + * NSSPKIXBuiltInStandardAttributes_GetOrganizationLUnitNames + * NSSPKIXBuiltInStandardAttributes_SetOrganizationLUnitNames + * NSSPKIXBuiltInStandardAttributes_RemoveOrganizationLUnitNames + * NSSPKIXBuiltInStandardAttributes_Equal + * NSSPKIXBuiltInStandardAttributes_Duplicate + * + */ + +/* + * NSSPKIXBuiltInStandardAttributes_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInStandardAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInStandardAttributes * +NSSPKIXBuiltInStandardAttributes_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXBuiltInStandardAttributes_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_COUNTRY_NAME + * NSS_ERROR_INVALID_PKIX_ADMINISTRATION_DOMAIN_NAME + * NSS_ERROR_INVALID_PKIX_NETWORK_ADDRESS + * NSS_ERROR_INVALID_PKIX_TERMINAL_IDENTIFIER + * NSS_ERROR_INVALID_PKIX_PRIVATE_DOMAIN_NAME + * NSS_ERROR_INVALID_PKIX_ORGANIZATION_NAME + * NSS_ERROR_INVALID_PKIX_NUMERIC_USER_IDENTIFIER + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInStandardAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInStandardAttributes * +NSSPKIXBuiltInStandardAttributes_Create +( + NSSArena *arenaOpt, + NSSPKIXCountryName *countryNameOpt, + NSSPKIXAdministrationDomainName *administrationDomainNameOpt, + NSSPKIXNetworkAddress *networkAddressOpt, + NSSPKIXTerminalIdentifier *terminalIdentifierOpt, + NSSPKIXPrivateDomainName *privateDomainNameOpt, + NSSPKIXOrganizationName *organizationNameOpt, + NSSPKIXNumericUserIdentifier *numericUserIdentifierOpt, + NSSPKIXPersonalName *personalNameOpt, + NSSPKIXOrganizationalUnitNames *organizationalUnitNamesOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_Destroy +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * NSSPKIXBuiltInStandardAttributes_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXBuiltInStandardAttributes_Encode +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_HasCountryName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXBuiltInStandardAttributes_HasCountryName +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_GetCountryName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCountryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCountryName * +NSSPKIXBuiltInStandardAttributes_GetCountryName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_SetCountryName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_COUNTRY_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_SetCountryName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXCountryName *countryName +); + +/* + * NSSPKIXBuiltInStandardAttributes_RemoveCountryName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_COUNTRY_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_RemoveCountryName +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * NSSPKIXBuiltInStandardAttributes_HasAdministrationDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXBuiltInStandardAttributes_HasAdministrationDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_GetAdministrationDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAdministrationDomainName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAdministrationDomainName * +NSSPKIXBuiltInStandardAttributes_GetAdministrationDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_SetAdministrationDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_ADMINISTRATION_DOMAIN_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_SetAdministrationDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXAdministrationDomainName *administrationDomainName +); + +/* + * NSSPKIXBuiltInStandardAttributes_RemoveAdministrationDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_ADMINISTRATION_DOMAIN_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_RemoveAdministrationDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * NSSPKIXBuiltInStandardAttributes_HasNetworkAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXBuiltInStandardAttributes_HasNetworkAddress +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_GetNetworkAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNetworkAddress * +NSSPKIXBuiltInStandardAttributes_GetNetworkAddress +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_SetNetworkAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_NETWORK_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_SetNetworkAddress +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXNetworkAddress *networkAddress +); + +/* + * NSSPKIXBuiltInStandardAttributes_RemoveNetworkAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_NETWORK_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_RemoveNetworkAddress +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * NSSPKIXBuiltInStandardAttributes_HasTerminalIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXBuiltInStandardAttributes_HasTerminalIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_GetTerminalIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTerminalIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTerminalIdentifier * +NSSPKIXBuiltInStandardAttributes_GetTerminalIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_SetTerminalIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_TERMINAL_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_SetTerminalIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXTerminalIdentifier *terminalIdentifier +); + +/* + * NSSPKIXBuiltInStandardAttributes_RemoveTerminalIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_TERMINAL_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_RemoveTerminalIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * NSSPKIXBuiltInStandardAttributes_HasPrivateDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXBuiltInStandardAttributes_HasPrivateDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_GetPrivateDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPrivateDomainName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPrivateDomainName * +NSSPKIXBuiltInStandardAttributes_GetPrivateDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_SetPrivateDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_PRIVATE_DOMAIN_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_SetPrivateDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXPrivateDomainName *privateDomainName +); + +/* + * NSSPKIXBuiltInStandardAttributes_RemovePrivateDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_PRIVATE_DOMAIN_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_RemovePrivateDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * NSSPKIXBuiltInStandardAttributes_HasOrganizationName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXBuiltInStandardAttributes_HasOrganizationName +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_GetOrganizationName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationName * +NSSPKIXBuiltInStandardAttributes_GetOrganizationName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_SetOrganizationName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_ORGANIZATION_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_SetOrganizationName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXOrganizationName *organizationName +); + +/* + * NSSPKIXBuiltInStandardAttributes_RemoveOrganizationName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_ORGANIZATION_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_RemoveOrganizationName +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * NSSPKIXBuiltInStandardAttributes_HasNumericUserIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXBuiltInStandardAttributes_HasNumericUserIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_GetNumericUserIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNumericUserIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNumericUserIdentifier * +NSSPKIXBuiltInStandardAttributes_GetNumericUserIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_SetNumericUserIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_NUMERIC_USER_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_SetNumericUserIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXNumericUserIdentifier *numericUserIdentifier +); + +/* + * NSSPKIXBuiltInStandardAttributes_RemoveNumericUserIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_NUMERIC_USER_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_RemoveNumericUserIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * NSSPKIXBuiltInStandardAttributes_HasPersonalName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXBuiltInStandardAttributes_HasPersonalName +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_GetPersonalName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPersonalName * +NSSPKIXBuiltInStandardAttributes_GetPersonalName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_SetPersonalName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_SetPersonalName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXPersonalName *personalName +); + +/* + * NSSPKIXBuiltInStandardAttributes_RemovePersonalName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_RemovePersonalName +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * NSSPKIXBuiltInStandardAttributes_HasOrganizationLUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXBuiltInStandardAttributes_HasOrganizationLUnitNames +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_GetOrganizationLUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitNames * +NSSPKIXBuiltInStandardAttributes_GetOrganizationLUnitNames +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_SetOrganizationLUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_SetOrganizationLUnitNames +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXOrganizationalUnitNames *organizationalUnitNames +); + +/* + * NSSPKIXBuiltInStandardAttributes_RemoveOrganizationLUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInStandardAttributes_RemoveOrganizationLUnitNames +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * NSSPKIXBuiltInStandardAttributes_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXBuiltInStandardAttributes_Equal +( + NSSPKIXBuiltInStandardAttributes *bisa1, + NSSPKIXBuiltInStandardAttributes *bisa2, + PRStatus *statusOpt +); + +/* + * NSSPKIXBuiltInStandardAttributes_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInStandardAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInStandardAttributes * +NSSPKIXBuiltInStandardAttributes_Duplicate +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * CountryName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CountryName ::= [APPLICATION 1] CHOICE { + * x121-dcc-code NumericString + * (SIZE (ub-country-name-numeric-length)), + * iso-3166-alpha2-code PrintableString + * (SIZE (ub-country-name-alpha-length)) } + * + * The public calls for this type: + * + * NSSPKIXCountryName_Decode + * NSSPKIXCountryName_CreateFromUTF8 + * NSSPKIXCountryName_Encode + * + */ + +/* + * NSSPKIXCountryName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCountryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCountryName * +NSSPKIXCountryName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXCountryName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCountryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCountryName * +NSSPKIXCountryName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXCountryName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_COUNTRY_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXCountryName_Encode +( + NSSPKIXCountryName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * AdministrationDomainName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AdministrationDomainName ::= [APPLICATION 2] CHOICE { + * numeric NumericString (SIZE (0..ub-domain-name-length)), + * printable PrintableString (SIZE (0..ub-domain-name-length)) } + * + * The public calls for this type: + * + * NSSPKIXAdministrationDomainName_Decode + * NSSPKIXAdministrationDomainName_CreateFromUTF8 + * NSSPKIXAdministrationDomainName_Encode + * + */ + +/* + * NSSPKIXAdministrationDomainName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAdministrationDomainName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAdministrationDomainName * +NSSPKIXAdministrationDomainName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXAdministrationDomainName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAdministrationDomainName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAdministrationDomainName * +NSSPKIXAdministrationDomainName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXAdministrationDomainName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ADMINISTRATION_DOMAIN_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXAdministrationDomainName_Encode +( + NSSPKIXAdministrationDomainName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X121Address + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X121Address ::= NumericString (SIZE (1..ub-x121-address-length)) + * + * The public calls for this type: + * + * NSSPKIXX121Address_Decode + * NSSPKIXX121Address_CreateFromUTF8 + * NSSPKIXX121Address_Encode + * + */ + +/* + * NSSPKIXX121Address_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX121Address upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX121Address * +NSSPKIXX121Address_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXX121Address_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX121Address upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX121Address * +NSSPKIXX121Address_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXX121Address_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_X121_ADDRESS + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXX121Address_Encode +( + NSSPKIXX121Address *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NetworkAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NetworkAddress ::= X121Address -- see also extended-network-address + * + * The public calls for this type: + * + * NSSPKIXNetworkAddress_Decode + * NSSPKIXNetworkAddress_CreateFromUTF8 + * NSSPKIXNetworkAddress_Encode + * + */ + +/* + * NSSPKIXNetworkAddress_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNetworkAddress * +NSSPKIXNetworkAddress_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXNetworkAddress_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNetworkAddress * +NSSPKIXNetworkAddress_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXNetworkAddress_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NETWORK_ADDRESS + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXNetworkAddress_Encode +( + NSSPKIXNetworkAddress *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * TerminalIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TerminalIdentifier ::= PrintableString (SIZE (1..ub-terminal-id-length)) + * + * The public calls for this type: + * + * NSSPKIXTerminalIdentifier_Decode + * NSSPKIXTerminalIdentifier_CreateFromUTF8 + * NSSPKIXTerminalIdentifier_Encode + * + */ + +/* + * NSSPKIXTerminalIdentifier_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTerminalIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTerminalIdentifier * +NSSPKIXTerminalIdentifier_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXTerminalIdentifier_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTerminalIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTerminalIdentifier * +NSSPKIXTerminalIdentifier_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXTerminalIdentifier_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TERMINAL_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXTerminalIdentifier_Encode +( + NSSPKIXTerminalIdentifier *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PrivateDomainName + * + * -- fgmr comments -- + * + * PrivateDomainName ::= CHOICE { + * numeric NumericString (SIZE (1..ub-domain-name-length)), + * printable PrintableString (SIZE (1..ub-domain-name-length)) } + * + * The public calls for this type: + * + * NSSPKIXPrivateDomainName_Decode + * NSSPKIXPrivateDomainName_CreateFromUTF8 + * NSSPKIXPrivateDomainName_Encode + * + */ + +/* + * NSSPKIXPrivateDomainName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPrivateDomainName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPrivateDomainName * +NSSPKIXPrivateDomainName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXPrivateDomainName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPrivateDomainName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPrivateDomainName * +NSSPKIXPrivateDomainName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXPrivateDomainName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_DOMAIN_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXPrivateDomainName_Encode +( + NSSPKIXPrivateDomainName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * OrganizationName + * + * -- fgmr comments -- + * + * OrganizationName ::= PrintableString + * (SIZE (1..ub-organization-name-length)) + * + * The public calls for this type: + * + * NSSPKIXOrganizationName_Decode + * NSSPKIXOrganizationName_CreateFromUTF8 + * NSSPKIXOrganizationName_Encode + * + */ + +/* + * NSSPKIXOrganizationName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationName * +NSSPKIXOrganizationName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXOrganizationName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationName * +NSSPKIXOrganizationName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXOrganizationName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATION_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXOrganizationName_Encode +( + NSSPKIXOrganizationName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NumericUserIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NumericUserIdentifier ::= NumericString + * (SIZE (1..ub-numeric-user-id-length)) + * + * The public calls for this type: + * + * NSSPKIXNumericUserIdentifier_Decode + * NSSPKIXNumericUserIdentifier_CreateFromUTF8 + * NSSPKIXNumericUserIdentifier_Encode + * + */ + +/* + * NSSPKIXNumericUserIdentifier_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNumericUserIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNumericUserIdentifier * +NSSPKIXNumericUserIdentifier_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXNumericUserIdentifier_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_UTF8 + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNumericUserIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNumericUserIdentifier * +NSSPKIXNumericUserIdentifier_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXNumericUserIdentifier_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NUMERIC_USER_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXNumericUserIdentifier_Encode +( + NSSPKIXNumericUserIdentifier *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PersonalName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PersonalName ::= SET { + * surname [0] PrintableString (SIZE (1..ub-surname-length)), + * given-name [1] PrintableString + * (SIZE (1..ub-given-name-length)) OPTIONAL, + * initials [2] PrintableString (SIZE (1..ub-initials-length)) OPTIONAL, + * generation-qualifier [3] PrintableString + * (SIZE (1..ub-generation-qualifier-length)) OPTIONAL } + * + * The public calls for this type: + * + * NSSPKIXPersonalName_Decode + * NSSPKIXPersonalName_Create + * NSSPKIXPersonalName_Destroy + * NSSPKIXPersonalName_Encode + * NSSPKIXPersonalName_GetSurname + * NSSPKIXPersonalName_SetSurname + * NSSPKIXPersonalName_HasGivenName + * NSSPKIXPersonalName_GetGivenName + * NSSPKIXPersonalName_SetGivenName + * NSSPKIXPersonalName_RemoveGivenName + * NSSPKIXPersonalName_HasInitials + * NSSPKIXPersonalName_GetInitials + * NSSPKIXPersonalName_SetInitials + * NSSPKIXPersonalName_RemoveInitials + * NSSPKIXPersonalName_HasGenerationQualifier + * NSSPKIXPersonalName_GetGenerationQualifier + * NSSPKIXPersonalName_SetGenerationQualifier + * NSSPKIXPersonalName_RemoveGenerationQualifier + * NSSPKIXPersonalName_Equal + * NSSPKIXPersonalName_Duplicate + * + */ + +/* + * NSSPKIXPersonalName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPersonalName * +NSSPKIXPersonalName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXPersonalName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPersonalName * +NSSPKIXPersonalName_Create +( + NSSArena *arenaOpt, + NSSUTF8 *surname, + NSSUTF8 *givenNameOpt, + NSSUTF8 *initialsOpt, + NSSUTF8 *generationQualifierOpt +); + +/* + * NSSPKIXPersonalName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPersonalName_Destroy +( + NSSPKIXPersonalName *personalName +); + +/* + * NSSPKIXPersonalName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXPersonalName_Encode +( + NSSPKIXPersonalName *personalName, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPersonalName_GetSurname + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXPersonalName_GetSurname +( + NSSPKIXPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPersonalName_SetSurname + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPersonalName_SetSurname +( + NSSPKIXPersonalName *personalName, + NSSUTF8 *surname +); + +/* + * NSSPKIXPersonalName_HasGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXPersonalName_HasGivenName +( + NSSPKIXPersonalName *personalName, + PRStatus *statusOpt +); + +/* + * NSSPKIXPersonalName_GetGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_GIVEN_NAME + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXPersonalName_GetGivenName +( + NSSPKIXPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPersonalName_SetGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPersonalName_SetGivenName +( + NSSPKIXPersonalName *personalName, + NSSUTF8 *givenName +); + +/* + * NSSPKIXPersonalName_RemoveGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_HAS_NO_GIVEN_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPersonalName_RemoveGivenName +( + NSSPKIXPersonalName *personalName +); + +/* + * NSSPKIXPersonalName_HasInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXPersonalName_HasInitials +( + NSSPKIXPersonalName *personalName, + PRStatus *statusOpt +); + +/* + * NSSPKIXPersonalName_GetInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXPersonalName_GetInitials +( + NSSPKIXPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPersonalName_SetInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPersonalName_SetInitials +( + NSSPKIXPersonalName *personalName, + NSSUTF8 *initials +); + +/* + * NSSPKIXPersonalName_RemoveInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPersonalName_RemoveInitials +( + NSSPKIXPersonalName *personalName +); + +/* + * NSSPKIXPersonalName_HasGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXPersonalName_HasGenerationQualifier +( + NSSPKIXPersonalName *personalName, + PRStatus *statusOpt +); + +/* + * NSSPKIXPersonalName_GetGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXPersonalName_GetGenerationQualifier +( + NSSPKIXPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPersonalName_SetGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPersonalName_SetGenerationQualifier +( + NSSPKIXPersonalName *personalName, + NSSUTF8 *generationQualifier +); + +/* + * NSSPKIXPersonalName_RemoveGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPersonalName_RemoveGenerationQualifier +( + NSSPKIXPersonalName *personalName +); + +/* + * NSSPKIXPersonalName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXPersonalName_Equal +( + NSSPKIXPersonalName *personalName1, + NSSPKIXPersonalName *personalName2, + PRStatus *statusOpt +); + +/* + * NSSPKIXPersonalName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * A valid pointer to an NSSPKIXPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPersonalName * +NSSPKIXPersonalName_Duplicate +( + NSSPKIXPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * OrganizationalUnitNames + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * OrganizationalUnitNames ::= SEQUENCE SIZE (1..ub-organizational-units) + * OF OrganizationalUnitName + * + * The public calls for the type: + * + * NSSPKIXOrganizationalUnitNames_Decode + * NSSPKIXOrganizationalUnitNames_Create + * NSSPKIXOrganizationalUnitNames_Destroy + * NSSPKIXOrganizationalUnitNames_Encode + * NSSPKIXOrganizationalUnitNames_GetOrganizationalUnitNameCount + * NSSPKIXOrganizationalUnitNames_GetOrganizationalUnitNames + * NSSPKIXOrganizationalUnitNames_SetOrganizationalUnitNames + * NSSPKIXOrganizationalUnitNames_GetOrganizationalUnitName + * NSSPKIXOrganizationalUnitNames_SetOrganizationalUnitName + * NSSPKIXOrganizationalUnitNames_InsertOrganizationalUnitName + * NSSPKIXOrganizationalUnitNames_AppendOrganizationalUnitName + * NSSPKIXOrganizationalUnitNames_RemoveOrganizationalUnitName + * NSSPKIXOrganizationalUnitNames_FindOrganizationalUnitName + * NSSPKIXOrganizationalUnitNames_Equal + * NSSPKIXOrganizationalUnitNames_Duplicate + * + */ + +/* + * NSSPKIXOrganizationalUnitNames_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitNames * +NSSPKIXOrganizationalUnitNames_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXOrganizationalUnitNames_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitNames * +NSSPKIXOrganizationalUnitNames_Create +( + NSSArena *arenaOpt, + NSSPKIXOrganizationalUnitName *ou1, + ... +); + +/* + * NSSPKIXOrganizationalUnitNames_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXOrganizationalUnitNames_Destroy +( + NSSPKIXOrganizationalUnitNames *ous +); + +/* + * NSSPKIXOrganizationalUnitNames_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXOrganizationalUnitNames_Encode +( + NSSPKIXOrganizationalUnitNames *ous, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXOrganizationalUnitNames_GetOrganizationalUnitNameCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXOrganizationalUnitNames_GetOrganizationalUnitNameCount +( + NSSPKIXOrganizationalUnitNames *ous +); + +/* + * NSSPKIXOrganizationalUnitNames_GetOrganizationalUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXOrganizationalUnitName + * pointers upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitName ** +NSSPKIXOrganizationalUnitNames_GetOrganizationalUnitNames +( + NSSPKIXOrganizationalUnitNames *ous, + NSSPKIXOrganizationalUnitName *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXOrganizationalUnitNames_SetOrganizationalUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXOrganizationalUnitNames_SetOrganizationalUnitNames +( + NSSPKIXOrganizationalUnitNames *ous, + NSSPKIXOrganizationalUnitName *ou[], + PRInt32 count +); + +/* + * NSSPKIXOrganizationalUnitNames_GetOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitName * +NSSPKIXOrganizationalUnitNames_GetOrganizationalUnitName +( + NSSPKIXOrganizationalUnitNames *ous, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXOrganizationalUnitNames_SetOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXOrganizationalUnitNames_SetOrganizationalUnitName +( + NSSPKIXOrganizationalUnitNames *ous, + PRInt32 i, + NSSPKIXOrganizationalUnitName *ou +); + +/* + * NSSPKIXOrganizationalUnitNames_InsertOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXOrganizationalUnitNames_InsertOrganizationalUnitName +( + NSSPKIXOrganizationalUnitNames *ous, + PRInt32 i, + NSSPKIXOrganizationalUnitName *ou +); + +/* + * NSSPKIXOrganizationalUnitNames_AppendOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXOrganizationalUnitNames_AppendOrganizationalUnitName +( + NSSPKIXOrganizationalUnitNames *ous, + NSSPKIXOrganizationalUnitName *ou +); + +/* + * NSSPKIXOrganizationalUnitNames_RemoveOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXOrganizationalUnitNames_RemoveOrganizationalUnitName +( + NSSPKIXOrganizationalUnitNames *ous, + PRInt32 i +); + +/* + * NSSPKIXOrganizationalUnitNames_FindOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * + * Return value: + * The index of the specified revoked certificate upon success + * -1 upon failure + */ + +NSS_EXTERN PRIntn +NSSPKIXOrganizationalUnitNames_FindOrganizationalUnitName +( + NSSPKIXOrganizationalUnitNames *ous, + NSSPKIXOrganizationalUnitName *ou +); + +/* + * NSSPKIXOrganizationalUnitNames_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXOrganizationalUnitNames_Equal +( + NSSPKIXOrganizationalUnitNames *ous1, + NSSPKIXOrganizationalUnitNames *ous2, + PRStatus *statusOpt +); + +/* + * NSSPKIXOrganizationalUnitNames_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitNames * +NSSPKIXOrganizationalUnitNames_Duplicate +( + NSSPKIXOrganizationalUnitNames *ous, + NSSArena *arenaOpt +); + +/* + * OrganizationalUnitName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * OrganizationalUnitName ::= PrintableString (SIZE + * (1..ub-organizational-unit-name-length)) + * + * The public calls for this type: + * + * NSSPKIXOrganizationalUnitName_Decode + * NSSPKIXOrganizationalUnitName_CreateFromUTF8 + * NSSPKIXOrganizationalUnitName_Encode + * + */ + +/* + * NSSPKIXOrganizationalUnitName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitName * +NSSPKIXOrganizationalUnitName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXOrganizationalUnitName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitName * +NSSPKIXOrganizationalUnitName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXOrganizationalUnitName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXOrganizationalUnitName_Encode +( + NSSPKIXOrganizationalUnitName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * BuiltInDomainDefinedAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BuiltInDomainDefinedAttributes ::= SEQUENCE SIZE + * (1..ub-domain-defined-attributes) OF + * BuiltInDomainDefinedAttribute + * + * The public calls for this type: + * + * NSSPKIXBuiltInDomainDefinedAttributes_Decode + * NSSPKIXBuiltInDomainDefinedAttributes_Create + * NSSPKIXBuiltInDomainDefinedAttributes_Destroy + * NSSPKIXBuiltInDomainDefinedAttributes_Encode + * NSSPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttributeCount + * NSSPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttributes + * NSSPKIXBuiltInDomainDefinedAttributes_SetBuiltIndomainDefinedAttributes + * NSSPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttribute + * NSSPKIXBuiltInDomainDefinedAttributes_SetBuiltIndomainDefinedAttribute + * NSSPKIXBuiltInDomainDefinedAttributes_InsertBuiltIndomainDefinedAttribute + * NSSPKIXBuiltInDomainDefinedAttributes_AppendBuiltIndomainDefinedAttribute + * NSSPKIXBuiltInDomainDefinedAttributes_RemoveBuiltIndomainDefinedAttribute + * NSSPKIXBuiltInDomainDefinedAttributes_Equal + * NSSPKIXBuiltInDomainDefinedAttributes_Duplicate + * + */ + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttributes + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttributes * +NSSPKIXBuiltInDomainDefinedAttributes_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttributes + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttributes * +NSSPKIXBuiltInDomainDefinedAttributes_Create +( + NSSArena *arenaOpt, + NSSPKIXBuiltInDomainDefinedAttribute *bidda1, + ... +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInDomainDefinedAttributes_Destroy +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXBuiltInDomainDefinedAttributes_Encode +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttributeCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttributeCount +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXBuiltInDomainDefinedAttribute + * pointers upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttribute ** +NSSPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttributes +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + NSSPKIXBuiltInDomainDefinedAttribut *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_SetBuiltIndomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInDomainDefinedAttributes_SetBuiltIndomainDefinedAttributes +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + NSSPKIXBuiltInDomainDefinedAttribut *bidda[], + PRInt32 count +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttribute * +NSSPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttribute +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_SetBuiltIndomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInDomainDefinedAttributes_SetBuiltIndomainDefinedAttribute +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + PRInt32 i, + NSSPKIXBuiltInDomainDefinedAttribute *bidda +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_InsertBuiltIndomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInDomainDefinedAttributes_InsertBuiltIndomainDefinedAttribute +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + PRInt32 i, + NSSPKIXBuiltInDomainDefinedAttribute *bidda +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_AppendBuiltIndomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInDomainDefinedAttributes_AppendBuiltIndomainDefinedAttribute +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + NSSPKIXBuiltInDomainDefinedAttribute *bidda +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_RemoveBuiltIndomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInDomainDefinedAttributes_RemoveBuiltIndomainDefinedAttribute +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + PRInt32 i +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_FindBuiltIndomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * The index of the specified revoked certificate upon success + * -1 upon failure + */ + +NSS_EXTERN PRInt32 +NSSPKIXBuiltInDomainDefinedAttributes_FindBuiltIndomainDefinedAttribute +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + NSSPKIXBuiltInDomainDefinedAttribute *bidda +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXBuiltInDomainDefinedAttributes_Equal +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas1, + NSSPKIXBuiltInDomainDefinedAttributes *biddas2, + PRStatus *statusOpt +); + +/* + * NSSPKIXBuiltInDomainDefinedAttributes_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttributes + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttributes * +NSSPKIXBuiltInDomainDefinedAttributes_Duplicate +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + NSSArena *arenaOpt +); + +/* + * BuiltInDomainDefinedAttribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BuiltInDomainDefinedAttribute ::= SEQUENCE { + * type PrintableString (SIZE + * (1..ub-domain-defined-attribute-type-length)), + * value PrintableString (SIZE + * (1..ub-domain-defined-attribute-value-length))} + * + * The public calls for this type: + * + * NSSPKIXBuiltInDomainDefinedAttribute_Decode + * NSSPKIXBuiltInDomainDefinedAttribute_Create + * NSSPKIXBuiltInDomainDefinedAttribute_Destroy + * NSSPKIXBuiltInDomainDefinedAttribute_Encode + * NSSPKIXBuiltInDomainDefinedAttribute_GetType + * NSSPKIXBuiltInDomainDefinedAttribute_SetType + * NSSPKIXBuiltInDomainDefinedAttribute_GetValue + * NSSPKIXBuiltInDomainDefinedAttribute_SetValue + * NSSPKIXBuiltInDomainDefinedAttribute_Equal + * NSSPKIXBuiltInDomainDefinedAttribute_Duplicate + * + */ + +/* + * NSSPKIXBuiltInDomainDefinedAttribute_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttribute * +NSSPKIXBuiltInDomainDefinedAttribute_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXBuiltInDomainDefinedAttribute_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttribute * +NSSPKIXBuiltInDomainDefinedAttribute_Create +( + NSSArena *arenaOpt, + NSSUTF8 *type, + NSSUTF8 *value +); + +/* + * NSSPKIXBuiltInDomainDefinedAttribute_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInDomainDefinedAttribute_Destroy +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda +); + +/* + * NSSPKIXBuiltInDomainDefinedAttribute_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXBuiltInDomainDefinedAttribute_Encode +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInDomainDefinedAttribute_GetType + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXBuiltInDomainDefinedAttribute_GetType +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInDomainDefinedAttribute_SetType + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInDomainDefinedAttribute_SetType +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda, + NSSUTF8 *type +); + +/* + * NSSPKIXBuiltInDomainDefinedAttribute_GetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXBuiltInDomainDefinedAttribute_GetValue +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBuiltInDomainDefinedAttribute_SetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBuiltInDomainDefinedAttribute_SetValue +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda, + NSSUTF8 *value +); + +/* + * NSSPKIXBuiltInDomainDefinedAttribute_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXBuiltInDomainDefinedAttribute_Equal +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda1, + NSSPKIXBuiltInDomainDefinedAttribute *bidda2, + PRStatus *statusOpt +); + +/* + * NSSPKIXBuiltInDomainDefinedAttribute_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttribute * +NSSPKIXBuiltInDomainDefinedAttribute_Duplicate +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda, + NSSArena *arenaOpt +); + +/* + * ExtensionAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtensionAttributes ::= SET SIZE (1..ub-extension-attributes) OF + * ExtensionAttribute + * + * The public calls for this type: + * + * NSSPKIXExtensionAttributes_Decode + * NSSPKIXExtensionAttributes_Create + * NSSPKIXExtensionAttributes_Destroy + * NSSPKIXExtensionAttributes_Encode + * NSSPKIXExtensionAttributes_GetExtensionAttributeCount + * NSSPKIXExtensionAttributes_GetExtensionAttributes + * NSSPKIXExtensionAttributes_SetExtensionAttributes + * NSSPKIXExtensionAttributes_GetExtensionAttribute + * NSSPKIXExtensionAttributes_SetExtensionAttribute + * NSSPKIXExtensionAttributes_InsertExtensionAttribute + * NSSPKIXExtensionAttributes_AppendExtensionAttribute + * NSSPKIXExtensionAttributes_RemoveExtensionAttribute + * NSSPKIXExtensionAttributes_FindExtensionAttribute + * NSSPKIXExtensionAttributes_Equal + * NSSPKIXExtensionAttributes_Duplicate + * + */ + +/* + * NSSPKIXExtensionAttributes_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttributes * +NSSPKIXExtensionAttributes_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXExtensionAttributes_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttributes * +NSSPKIXExtensionAttributes_Create +( + NSSArena *arenaOpt, + NSSPKIXExtensionAttribute ea1, + ... +); + +/* + * NSSPKIXExtensionAttributes_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtensionAttributes_Destroy +( + NSSPKIXExtensionAttributes *eas +); + +/* + * NSSPKIXExtensionAttributes_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXExtensionAttributes_Encode +( + NSSPKIXExtensionAttributes *eas + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXExtensionAttributes_GetExtensionAttributeCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXExtensionAttributes_GetExtensionAttributeCount +( + NSSPKIXExtensionAttributes *eas +); + +/* + * NSSPKIXExtensionAttributes_GetExtensionAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXExtensionAttribute pointers + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttribute ** +NSSPKIXExtensionAttributes_GetExtensionAttributes +( + NSSPKIXExtensionAttributes *eas, + NSSPKIXExtensionAttribute *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXExtensionAttributes_SetExtensionAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * NSS_ERROR_INVALID_POINTER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtensionAttributes_SetExtensionAttributes +( + NSSPKIXExtensionAttributes *eas, + NSSPKIXExtensionAttribute *ea[], + PRInt32 count +); + +/* + * NSSPKIXExtensionAttributes_GetExtensionAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttribute upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttribute * +NSSPKIXExtensionAttributes_GetExtensionAttribute +( + NSSPKIXExtensionAttributes *eas, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXExtensionAttributes_SetExtensionAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtensionAttributes_SetExtensionAttribute +( + NSSPKIXExtensionAttributes *eas, + PRInt32 i, + NSSPKIXExtensionAttribute *ea +); + +/* + * NSSPKIXExtensionAttributes_InsertExtensionAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtensionAttributes_InsertExtensionAttribute +( + NSSPKIXExtensionAttributes *eas, + PRInt32 i, + NSSPKIXExtensionAttribute *ea +); + +/* + * NSSPKIXExtensionAttributes_AppendExtensionAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtensionAttributes_AppendExtensionAttribute +( + NSSPKIXExtensionAttributes *eas, + NSSPKIXExtensionAttribute *ea +); + +/* + * NSSPKIXExtensionAttributes_RemoveExtensionAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtensionAttributes_RemoveExtensionAttribute +( + NSSPKIXExtensionAttributes *eas, + PRInt32 i, +); + +/* + * NSSPKIXExtensionAttributes_FindExtensionAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * A nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXExtensionAttributes_FindExtensionAttribute +( + NSSPKIXExtensionAttributes *eas, + NSSPKIXExtensionAttribute *ea +); + +/* + * NSSPKIXExtensionAttributes_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXExtensionAttributes_Equal +( + NSSPKIXExtensionAttributes *eas1, + NSSPKIXExtensionAttributes *eas2, + PRStatus *statusOpt +); + +/* + * NSSPKIXExtensionAttributes_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttributes * +NSSPKIXExtensionAttributes_Duplicate +( + NSSPKIXExtensionAttributes *eas, + NSSArena *arenaOpt +); + +/* + * fgmr + * There should be accessors to search the ExtensionAttributes and + * return the value for a specific value, etc. + */ + +/* + * ExtensionAttribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtensionAttribute ::= SEQUENCE { + * extension-attribute-type [0] INTEGER (0..ub-extension-attributes), + * extension-attribute-value [1] + * ANY DEFINED BY extension-attribute-type } + * + * The public calls for this type: + * + * NSSPKIXExtensionAttribute_Decode + * NSSPKIXExtensionAttribute_Create + * NSSPKIXExtensionAttribute_Destroy + * NSSPKIXExtensionAttribute_Encode + * NSSPKIXExtensionAttribute_GetExtensionsAttributeType + * NSSPKIXExtensionAttribute_SetExtensionsAttributeType + * NSSPKIXExtensionAttribute_GetExtensionsAttributeValue + * NSSPKIXExtensionAttribute_SetExtensionsAttributeValue + * NSSPKIXExtensionAttribute_Equal + * NSSPKIXExtensionAttribute_Duplicate + * + */ + +/* + * NSSPKIXExtensionAttribute_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttribute upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttribute * +NSSPKIXExtensionAttribute_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXExtensionAttribute_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE_TYPE + * NSS_ERROR_INVALID_POINTER + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttribute upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttribute * +NSSPKIXExtensionAttribute_Create +( + NSSArena *arenaOpt, + NSSPKIXExtensionAttributeType type, + NSSItem *value +); + +/* + * NSSPKIXExtensionAttribute_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtensionAttribute_Destroy +( + NSSPKIXExtensionAttribute *ea +); + +/* + * NSSPKIXExtensionAttribute_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXExtensionAttribute_Encode +( + NSSPKIXExtensionAttribute *ea, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXExtensionAttribute_GetExtensionsAttributeType + * + * -- fgmr comments -- + * {One of these objects created from BER generated by a program + * adhering to a later version of the PKIX standards might have + * a value not mentioned in the enumeration definition. This isn't + * a bug.} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * A member of the NSSPKIXExtensionAttributeType enumeration + * upon success + * NSSPKIXExtensionAttributeType_NSSinvalid upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttributeType +NSSPKIXExtensionAttribute_GetExtensionsAttributeType +( + NSSPKIXExtensionAttribute *ea +); + +/* + * NSSPKIXExtensionAttribute_SetExtensionsAttributeType + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtensionAttribute_SetExtensionsAttributeType +( + NSSPKIXExtensionAttribute *ea, + NSSPKIXExtensionAttributeType type +); + +/* + * NSSPKIXExtensionAttribute_GetExtensionsAttributeValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +NSSPKIXExtensionAttribute_GetExtensionsAttributeValue +( + NSSPKIXExtensionAttribute *ea, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXExtensionAttribute_SetExtensionsAttributeValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtensionAttribute_SetExtensionsAttributeValue +( + NSSPKIXExtensionAttribute *ea, + NSSItem *value +); + +/* + * NSSPKIXExtensionAttribute_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXExtensionAttribute_Equal +( + NSSPKIXExtensionAttribute *ea1, + NSSPKIXExtensionAttribute *ea2, + PRStatus *statusOpt +); + +/* + * NSSPKIXExtensionAttribute_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttribute upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttribute * +NSSPKIXExtensionAttribute_Duplicate +( + NSSPKIXExtensionAttribute *ea, + NSSArena *arenaOpt +); + +/* + * CommonName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CommonName ::= PrintableString (SIZE (1..ub-common-name-length)) + * + * The public calls for this type: + * + * NSSPKIXCommonName_Decode + * NSSPKIXCommonName_CreateFromUTF8 + * NSSPKIXCommonName_Encode + * + */ + +/* + * NSSPKIXCommonName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCommonName * +NSSPKIXCommonName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXCommonName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCommonName * +NSSPKIXCommonName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXCommonName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_COMMON_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXCommonName_Encode +( + NSSPKIXCommonName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * TeletexCommonName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexCommonName ::= TeletexString (SIZE (1..ub-common-name-length)) + * + * The public calls for this type: + * + * NSSPKIXTeletexCommonName_Decode + * NSSPKIXTeletexCommonName_CreateFromUTF8 + * NSSPKIXTeletexCommonName_Encode + * + */ + +/* + * NSSPKIXTeletexCommonName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexCommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexCommonName * +NSSPKIXTeletexCommonName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXTeletexCommonName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexCommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexCommonName * +NSSPKIXTeletexCommonName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXTeletexCommonName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_COMMON_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXTeletexCommonName_Encode +( + NSSPKIXTeletexCommonName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * TeletexOrganizationName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexOrganizationName ::= + * TeletexString (SIZE (1..ub-organization-name-length)) + * + * The public calls for this type: + * + * NSSPKIXTeletexOrganizationName_Decode + * NSSPKIXTeletexOrganizationName_CreateFromUTF8 + * NSSPKIXTeletexOrganizationName_Encode + * + */ + +/* + * NSSPKIXTeletexOrganizationName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationName * +NSSPKIXTeletexOrganizationName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXTeletexOrganizationName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationName * +NSSPKIXTeletexOrganizationName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXTeletexOrganizationName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATION_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXTeletexOrganizationName_Encode +( + NSSPKIXTeletexOrganizationName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * TeletexPersonalName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexPersonalName ::= SET { + * surname [0] TeletexString (SIZE (1..ub-surname-length)), + * given-name [1] TeletexString + * (SIZE (1..ub-given-name-length)) OPTIONAL, + * initials [2] TeletexString (SIZE (1..ub-initials-length)) OPTIONAL, + * generation-qualifier [3] TeletexString (SIZE + * (1..ub-generation-qualifier-length)) OPTIONAL } + * + * The public calls for this type: + * + * NSSPKIXTeletexPersonalName_Decode + * NSSPKIXTeletexPersonalName_Create + * NSSPKIXTeletexPersonalName_Destroy + * NSSPKIXTeletexPersonalName_Encode + * NSSPKIXTeletexPersonalName_GetSurname + * NSSPKIXTeletexPersonalName_SetSurname + * NSSPKIXTeletexPersonalName_HasGivenName + * NSSPKIXTeletexPersonalName_GetGivenName + * NSSPKIXTeletexPersonalName_SetGivenName + * NSSPKIXTeletexPersonalName_RemoveGivenName + * NSSPKIXTeletexPersonalName_HasInitials + * NSSPKIXTeletexPersonalName_GetInitials + * NSSPKIXTeletexPersonalName_SetInitials + * NSSPKIXTeletexPersonalName_RemoveInitials + * NSSPKIXTeletexPersonalName_HasGenerationQualifier + * NSSPKIXTeletexPersonalName_GetGenerationQualifier + * NSSPKIXTeletexPersonalName_SetGenerationQualifier + * NSSPKIXTeletexPersonalName_RemoveGenerationQualifier + * NSSPKIXTeletexPersonalName_Equal + * NSSPKIXTeletexPersonalName_Duplicate + * + */ + +/* + * NSSPKIXTeletexPersonalName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexPersonalName * +NSSPKIXTeletexPersonalName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXTeletexPersonalName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXTeletexPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexPersonalName * +NSSPKIXTeletexPersonalName_Create +( + NSSArena *arenaOpt, + NSSUTF8 *surname, + NSSUTF8 *givenNameOpt, + NSSUTF8 *initialsOpt, + NSSUTF8 *generationQualifierOpt +); + +/* + * NSSPKIXTeletexPersonalName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexPersonalName_Destroy +( + NSSPKIXTeletexPersonalName *personalName +); + +/* + * NSSPKIXTeletexPersonalName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXTeletexPersonalName_Encode +( + NSSPKIXTeletexPersonalName *personalName, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexPersonalName_GetSurname + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXTeletexPersonalName_GetSurname +( + NSSPKIXTeletexPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexPersonalName_SetSurname + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexPersonalName_SetSurname +( + NSSPKIXTeletexPersonalName *personalName, + NSSUTF8 *surname +); + +/* + * NSSPKIXTeletexPersonalName_HasGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXTeletexPersonalName_HasGivenName +( + NSSPKIXTeletexPersonalName *personalName, + PRStatus *statusOpt +); + +/* + * NSSPKIXTeletexPersonalName_GetGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXTeletexPersonalName_GetGivenName +( + NSSPKIXTeletexPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexPersonalName_SetGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexPersonalName_SetGivenName +( + NSSPKIXTeletexPersonalName *personalName, + NSSUTF8 *givenName +); + +/* + * NSSPKIXTeletexPersonalName_RemoveGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexPersonalName_RemoveGivenName +( + NSSPKIXTeletexPersonalName *personalName +); + +/* + * NSSPKIXTeletexPersonalName_HasInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXTeletexPersonalName_HasInitials +( + NSSPKIXTeletexPersonalName *personalName, + PRStatus *statusOpt +); + +/* + * NSSPKIXTeletexPersonalName_GetInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXTeletexPersonalName_GetInitials +( + NSSPKIXTeletexPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexPersonalName_SetInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexPersonalName_SetInitials +( + NSSPKIXTeletexPersonalName *personalName, + NSSUTF8 *initials +); + +/* + * NSSPKIXTeletexPersonalName_RemoveInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexPersonalName_RemoveInitials +( + NSSPKIXTeletexPersonalName *personalName +); + +/* + * NSSPKIXTeletexPersonalName_HasGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXTeletexPersonalName_HasGenerationQualifier +( + NSSPKIXTeletexPersonalName *personalName, + PRStatus *statusOpt +); + +/* + * NSSPKIXTeletexPersonalName_GetGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXTeletexPersonalName_GetGenerationQualifier +( + NSSPKIXTeletexPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexPersonalName_SetGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexPersonalName_SetGenerationQualifier +( + NSSPKIXTeletexPersonalName *personalName, + NSSUTF8 *generationQualifier +); + +/* + * NSSPKIXTeletexPersonalName_RemoveGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexPersonalName_RemoveGenerationQualifier +( + NSSPKIXTeletexPersonalName *personalName +); + +/* + * NSSPKIXTeletexPersonalName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXTeletexPersonalName_Equal +( + NSSPKIXTeletexPersonalName *personalName1, + NSSPKIXTeletexPersonalName *personalName2, + PRStatus *statusOpt +); + +/* + * NSSPKIXTeletexPersonalName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * A valid pointer to an NSSPKIXTeletexPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexPersonalName * +NSSPKIXTeletexPersonalName_Duplicate +( + NSSPKIXTeletexPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * TeletexOrganizationalUnitNames + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexOrganizationalUnitNames ::= SEQUENCE SIZE + * (1..ub-organizational-units) OF TeletexOrganizationalUnitName + * + * The public calls for the type: + * + * NSSPKIXTeletexOrganizationalUnitNames_Decode + * NSSPKIXTeletexOrganizationalUnitNames_Create + * NSSPKIXTeletexOrganizationalUnitNames_Destroy + * NSSPKIXTeletexOrganizationalUnitNames_Encode + * NSSPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitNameCount + * NSSPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitNames + * NSSPKIXTeletexOrganizationalUnitNames_SetTeletexOrganizationalUnitNames + * NSSPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitName + * NSSPKIXTeletexOrganizationalUnitNames_SetTeletexOrganizationalUnitName + * NSSPKIXTeletexOrganizationalUnitNames_InsertTeletexOrganizationalUnitName + * NSSPKIXTeletexOrganizationalUnitNames_AppendTeletexOrganizationalUnitName + * NSSPKIXTeletexOrganizationalUnitNames_RemoveTeletexOrganizationalUnitName + * NSSPKIXTeletexOrganizationalUnitNames_FindTeletexOrganizationalUnitName + * NSSPKIXTeletexOrganizationalUnitNames_Equal + * NSSPKIXTeletexOrganizationalUnitNames_Duplicate + * + */ + +/* + * NSSPKIXTeletexOrganizationalUnitNames_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitNames * +NSSPKIXTeletexOrganizationalUnitNames_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitNames * +NSSPKIXTeletexOrganizationalUnitNames_Create +( + NSSArena *arenaOpt, + NSSPKIXTeletexOrganizationalUnitName *ou1, + ... +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexOrganizationalUnitNames_Destroy +( + NSSPKIXTeletexOrganizationalUnitNames *ous +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXTeletexOrganizationalUnitNames_Encode +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitNameCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitNameCount +( + NSSPKIXTeletexOrganizationalUnitNames *ous +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXTeletexOrganizationalUnitName + * pointers upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitName ** +NSSPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitNames +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + NSSPKIXTeletexOrganizationalUnitName *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_SetTeletexOrganizationalUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexOrganizationalUnitNames_SetTeletexOrganizationalUnitNames +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + NSSPKIXTeletexOrganizationalUnitName *ou[], + PRInt32 count +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitName * +NSSPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitName +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_SetTeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexOrganizationalUnitNames_SetTeletexOrganizationalUnitName +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + PRInt32 i, + NSSPKIXTeletexOrganizationalUnitName *ou +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_InsertTeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexOrganizationalUnitNames_InsertTeletexOrganizationalUnitName +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + PRInt32 i, + NSSPKIXTeletexOrganizationalUnitName *ou +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_AppendTeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexOrganizationalUnitNames_AppendTeletexOrganizationalUnitName +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + NSSPKIXTeletexOrganizationalUnitName *ou +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_RemoveTeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexOrganizationalUnitNames_RemoveTeletexOrganizationalUnitName +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + PRInt32 i +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_FindTeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * + * Return value: + * The index of the specified revoked certificate upon success + * -1 upon failure + */ + +NSS_EXTERN PRInt32 +NSSPKIXTeletexOrganizationalUnitNames_FindTeletexOrganizationalUnitName +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + NSSPKIXTeletexOrganizationalUnitName *ou +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXTeletexOrganizationalUnitNames_Equal +( + NSSPKIXTeletexOrganizationalUnitNames *ous1, + NSSPKIXTeletexOrganizationalUnitNames *ous2, + PRStatus *statusOpt +); + +/* + * NSSPKIXTeletexOrganizationalUnitNames_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitNames * +NSSPKIXTeletexOrganizationalUnitNames_Duplicate +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + NSSArena *arenaOpt +); + +/* + * TeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexOrganizationalUnitName ::= TeletexString + * (SIZE (1..ub-organizational-unit-name-length)) + * + * The public calls for this type: + * + * NSSPKIXTeletexOrganizationalUnitName_Decode + * NSSPKIXTeletexOrganizationalUnitName_CreateFromUTF8 + * NSSPKIXTeletexOrganizationalUnitName_Encode + * + */ + +/* + * NSSPKIXTeletexOrganizationalUnitName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitName * +NSSPKIXTeletexOrganizationalUnitName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXTeletexOrganizationalUnitName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitName * +NSSPKIXTeletexOrganizationalUnitName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXTeletexOrganizationalUnitName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXTeletexOrganizationalUnitName_Encode +( + NSSPKIXTeletexOrganizationalUnitName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PDSName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PDSName ::= PrintableString (SIZE (1..ub-pds-name-length)) + * + * The public calls for this type: + * + * NSSPKIXPDSName_Decode + * NSSPKIXPDSName_CreateFromUTF8 + * NSSPKIXPDSName_Encode + * + */ + +/* + * NSSPKIXPDSName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPDSName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPDSName * +NSSPKIXPDSName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXPDSName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPDSName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPDSName * +NSSPKIXPDSName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXPDSName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXPDSName_Encode +( + NSSPKIXPDSName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PhysicalDeliveryCountryName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PhysicalDeliveryCountryName ::= CHOICE { + * x121-dcc-code NumericString (SIZE (ub-country-name-numeric-length)), + * iso-3166-alpha2-code PrintableString + * (SIZE (ub-country-name-alpha-length)) } + * + * The public calls for this type: + * + * NSSPKIXPhysicalDeliveryCountryName_Decode + * NSSPKIXPhysicalDeliveryCountryName_CreateFromUTF8 + * NSSPKIXPhysicalDeliveryCountryName_Encode + * + */ + +/* + * NSSPKIXPhysicalDeliveryCountryName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPhysicalDeliveryCountryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPhysicalDeliveryCountryName * +NSSPKIXPhysicalDeliveryCountryName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXPhysicalDeliveryCountryName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPhysicalDeliveryCountryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPhysicalDeliveryCountryName * +NSSPKIXPhysicalDeliveryCountryName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXPhysicalDeliveryCountryName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PHYSICAL_DELIVERY_COUNTRY_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXPhysicalDeliveryCountryName_Encode +( + NSSPKIXPhysicalDeliveryCountryName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PostalCode + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PostalCode ::= CHOICE { + * numeric-code NumericString (SIZE (1..ub-postal-code-length)), + * printable-code PrintableString (SIZE (1..ub-postal-code-length)) } + * + * The public calls for this type: + * + * NSSPKIXPostalCode_Decode + * NSSPKIXPostalCode_CreateFromUTF8 + * NSSPKIXPostalCode_Encode + * + */ + +/* + * NSSPKIXPostalCode_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPostalCode upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPostalCode * +NSSPKIXPostalCode_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXPostalCode_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPostalCode upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPostalCode * +NSSPKIXPostalCode_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXPostalCode_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POSTAL_CODE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXPostalCode_Encode +( + NSSPKIXPostalCode *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PDSParameter + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PDSParameter ::= SET { + * printable-string PrintableString + * (SIZE(1..ub-pds-parameter-length)) OPTIONAL, + * teletex-string TeletexString + * (SIZE(1..ub-pds-parameter-length)) OPTIONAL } + * + * The public calls for this type: + * + * NSSPKIXPDSParameter_Decode + * NSSPKIXPDSParameter_CreateFromUTF8 + * NSSPKIXPDSParameter_Create + * NSSPKIXPDSParameter_Delete + * NSSPKIXPDSParameter_Encode + * NSSPKIXPDSParameter_GetUTF8Encoding + * NSSPKIXPDSParameter_HasPrintableString + * NSSPKIXPDSParameter_GetPrintableString + * NSSPKIXPDSParameter_SetPrintableString + * NSSPKIXPDSParameter_RemovePrintableString + * NSSPKIXPDSParameter_HasTeletexString + * NSSPKIXPDSParameter_GetTeletexString + * NSSPKIXPDSParameter_SetTeletexString + * NSSPKIXPDSParameter_RemoveTeletexString + * NSSPKIXPDSParameter_Equal + * NSSPKIXPDSParameter_Duplicate + */ + +/* + * NSSPKIXPDSParameter_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPDSParameter upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPDSParameter * +NSSPKIXPDSParameter_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXPDSParameter_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPDSParameter upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPDSParameter * +NSSPKIXPDSParameter_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXPDSParameter_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXPDSParameter upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPDSParameter * +NSSPKIXPDSParameter_Create +( + NSSArena *arenaOpt, + NSSUTF8 *printableStringOpt, + NSSUTF8 *teletexStringOpt +); + +/* + * NSSPKIXPDSParameter_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPDSParameter_Destroy +( + NSSPKIXPDSParameter *p +); + +/* + * NSSPKIXPDSParameter_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXPDSParameter_Encode +( + NSSPKIXPDSParameter *p, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPDSParameter_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXPDSParameter_GetUTF8Encoding +( + NSSPKIXPDSParameter *p, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPDSParameter_HasPrintableString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXPDSParameter_HasPrintableString +( + NSSPKIXPDSParameter *p, + PRStatus *statusOpt +); + +/* + * NSSPKIXPDSParameter_GetPrintableString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXPDSParameter_GetPrintableString +( + NSSPKIXPDSParameter *p, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPDSParameter_SetPrintableString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPDSParameter_SetPrintableString +( + NSSPKIXPDSParameter *p, + NSSUTF8 *printableString +); + +/* + * NSSPKIXPDSParameter_RemovePrintableString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPDSParameter_RemovePrintableString +( + NSSPKIXPDSParameter *p +); + +/* + * NSSPKIXPDSParameter_HasTeletexString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXPDSParameter_HasTeletexString +( + NSSPKIXPDSParameter *p, + PRStatus *statusOpt +); + +/* + * NSSPKIXPDSParameter_GetTeletexString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXPDSParameter_GetTeletexString +( + NSSPKIXPDSParameter *p, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPDSParameter_SetTeletexString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPDSParameter_SetTeletexString +( + NSSPKIXPDSParameter *p, + NSSUTF8 *teletexString +); + +/* + * NSSPKIXPDSParameter_RemoveTeletexString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPDSParameter_RemoveTeletexString +( + NSSPKIXPDSParameter *p +); + +/* + * NSSPKIXPDSParameter_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXPDSParameter_Equal +( + NSSPKIXPDSParameter *p1, + NSSPKIXPDSParameter *p2, + PRStatus *statusOpt +); + +/* + * NSSPKIXPDSParameter_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPDSParameter upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPDSParameter * +NSSPKIXPDSParameter_Duplicate +( + NSSPKIXPDSParameter *p, + NSSArena *arenaOpt +); + +/* + * fgmr: what about these PDS types? + * + * PhysicalDeliveryOfficeName + * + * PhysicalDeliveryOfficeNumber + * + * ExtensionORAddressComponents + * + * PhysicalDeliveryPersonalName + * + * PhysicalDeliveryOrganizationName + * + * ExtensionPhysicalDeliveryAddressComponents + * + * StreetAddress + * + * PostOfficeBoxAddress + * + * PosteRestanteAddress + * + * UniquePostalName + * + * LocalPostalAttributes + * + */ + +/* + * UnformattedPostalAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * UnformattedPostalAddress ::= SET { + * printable-address SEQUENCE SIZE (1..ub-pds-physical-address-lines) OF + * PrintableString (SIZE (1..ub-pds-parameter-length)) OPTIONAL, + * teletex-string TeletexString + * (SIZE (1..ub-unformatted-address-length)) OPTIONAL } + * + * The public calls for the type: + * + * + */ + +/* + * ExtendedNetworkAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtendedNetworkAddress ::= CHOICE { + * e163-4-address SEQUENCE { + * number [0] NumericString (SIZE (1..ub-e163-4-number-length)), + * sub-address [1] NumericString + * (SIZE (1..ub-e163-4-sub-address-length)) OPTIONAL }, + * psap-address [0] PresentationAddress } + * + * The public calls for the type: + * + * NSSPKIXExtendedNetworkAddress_Decode + * NSSPKIXExtendedNetworkAddress_Create + * NSSPKIXExtendedNetworkAddress_Destroy + * NSSPKIXExtendedNetworkAddress_Encode + * NSSPKIXExtendedNetworkAddress_GetChoice + * NSSPKIXExtendedNetworkAddress_Get + * NSSPKIXExtendedNetworkAddress_GetE1634Address + * NSSPKIXExtendedNetworkAddress_GetPsapAddress + * NSSPKIXExtendedNetworkAddress_Set + * NSSPKIXExtendedNetworkAddress_SetE163Address + * NSSPKIXExtendedNetworkAddress_SetPsapAddress + * NSSPKIXExtendedNetworkAddress_Equal + * NSSPKIXExtendedNetworkAddress_Duplicate + * + */ + +/* + * NSSPKIXExtendedNetworkAddress_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtendedNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtendedNetworkAddress * +NSSPKIXExtendedNetworkAddress_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXExtendedNetworkAddress_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_INVALID_PKIX_PRESENTATION_ADDRESS + * + * Return value: + * A valid pointer to an NSSPKIXExtendedNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtendedNetworkAddress * +NSSPKIXExtendedNetworkAddress_Create +( + NSSArena *arenaOpt, + NSSPKIXExtendedNetworkAddressChoice choice, + void *address +); + +/* + * NSSPKIXExtendedNetworkAddress_CreateFromE1634Address + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * + * Return value: + * A valid pointer to an NSSPKIXExtendedNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtendedNetworkAddress * +NSSPKIXExtendedNetworkAddress_CreateFromE1634Address +( + NSSArena *arenaOpt, + NSSPKIXe1634Address *e1634address +); + +/* + * NSSPKIXExtendedNetworkAddress_CreateFromPresentationAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_PRESENTATION_ADDRESS + * + * Return value: + * A valid pointer to an NSSPKIXExtendedNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtendedNetworkAddress * +NSSPKIXExtendedNetworkAddress_CreateFromPresentationAddress +( + NSSArena *arenaOpt, + NSSPKIXPresentationAddress *presentationAddress +); + +/* + * NSSPKIXExtendedNetworkAddress_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtendedNetworkAddress_Destroy +( + NSSPKIXExtendedNetworkAddress *ena +); + +/* + * NSSPKIXExtendedNetworkAddress_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXExtendedNetworkAddress_Encode +( + NSSPKIXExtendedNetworkAddress *ena, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXExtendedNetworkAddress_GetChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * + * Return value: + * A valid element of the NSSPKIXExtendedNetworkAddressChoice upon + * success + * The value NSSPKIXExtendedNetworkAddress_NSSinvalid upon failure + */ + +NSS_EXTERN NSSPKIXExtendedNetworkAddressChoice +NSSPKIXExtendedNetworkAddress_GetChoice +( + NSSPKIXExtendedNetworkAddress *ena +); + +/* + * NSSPKIXExtendedNetworkAddress_GetSpecifiedChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A pointer... + * NULL upon failure + */ + +NSS_EXTERN void * +NSSPKIXExtendedNetworkAddress_GetSpecifiedChoice +( + NSSPKIXExtendedNetworkAddress *ena, + NSSPKIXExtendedNetworkAddressChoice which, + NSSArena *arenaOpt +); + +/* + * NSSPKIXExtendedNetworkAddress_GetE1634Address + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A valid pointer to an NSSPKIXe1643Address upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXe1643Address * +NSSPKIXExtendedNetworkAddress_GetE1634Address +( + NSSPKIXExtendedNetworkAddress *ena, + NSSArena *arenaOpt +); + +/* + * NSSPKIXExtendedNetworkAddress_GetPresentationAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A valid pointer to an NSSPKIXPresentationAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPresentationAddress * +NSSPKIXExtendedNetworkAddress_GetPresentationAddress +( + NSSPKIXExtendedNetworkAddress *ena, + NSSArena *arenaOpt +); + +/* + * NSSPKIXExtendedNetworkAddress_SetSpecifiedChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_INVALID_PKIX_PRESENTATION_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtendedNetworkAddress_SetSpecifiedChoice +( + NSSPKIXExtendedNetworkAddress *ena, + NSSPKIXExtendedNetworkAddressChoice which, + void *address +); + +/* + * NSSPKIXExtendedNetworkAddress_SetE163Address + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtendedNetworkAddress_SetE163Address +( + NSSPKIXExtendedNetworkAddress *ena, + NSSPKIXe1634Address *e1634address +); + +/* + * NSSPKIXExtendedNetworkAddress_SetPresentationAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_PRESENTATION_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtendedNetworkAddress_SetPresentationAddress +( + NSSPKIXExtendedNetworkAddress *ena, + NSSPKIXPresentationAddress *presentationAddress +); + +/* + * NSSPKIXExtendedNetworkAddress_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXExtendedNetworkAddress_Equal +( + NSSPKIXExtendedNetworkAddress *ena1, + NSSPKIXExtendedNetworkAddress *ena2, + PRStatus *statusOpt +); + +/* + * NSSPKIXExtendedNetworkAddress_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtendedNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtendedNetworkAddress * +NSSPKIXExtendedNetworkAddress_Duplicate +( + NSSPKIXExtendedNetworkAddress *ena, + NSSArena *arenaOpt +); + +/* + * e163-4-address + * + * Helper structure for ExtendedNetworkAddress. + * -- fgmr comments -- + * + * From RFC 2459: + * + * e163-4-address SEQUENCE { + * number [0] NumericString (SIZE (1..ub-e163-4-number-length)), + * sub-address [1] NumericString + * (SIZE (1..ub-e163-4-sub-address-length)) OPTIONAL }, + * + * The public calls for the type: + * + * NSSPKIXe1634Address_Decode + * NSSPKIXe1634Address_Create + * NSSPKIXe1634Address_Destroy + * NSSPKIXe1634Address_Encode + * NSSPKIXe1634Address_GetNumber + * NSSPKIXe1634Address_SetNumber + * NSSPKIXe1634Address_HasSubAddress + * NSSPKIXe1634Address_GetSubAddress + * NSSPKIXe1634Address_SetSubAddress + * NSSPKIXe1634Address_RemoveSubAddress + * NSSPKIXe1634Address_Equal + * NSSPKIXe1634Address_Duplicate + * + */ + +/* + * NSSPKIXe1634Address_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXe1634Address upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXe1634Address * +NSSPKIXe1634Address_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXe1634Address_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXe1634Address upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXe1634Address * +NSSPKIXe1634Address_Create +( + NSSArena *arenaOpt, + NSSUTF8 *number, + NSSUTF8 *subAddressOpt +); + +/* + * NSSPKIXe1634Address_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXe1634Address_Destroy +( + NSSPKIXe1634Address *e +); + +/* + * NSSPKIXe1634Address_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXe1634Address_Encode +( + NSSPKIXe1634Address *e, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXe1634Address_GetNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXe1634Address_GetNumber +( + NSSPKIXe1634Address *e, + NSSArena *arenaOpt +); + +/* + * NSSPKIXe1634Address_SetNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXe1634Address_SetNumber +( + NSSPKIXe1634Address *e, + NSSUTF8 *number +); + +/* + * NSSPKIXe1634Address_HasSubAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXe1634Address_HasSubAddress +( + NSSPKIXe1634Address *e, + PRStatus *statusOpt +); + +/* + * NSSPKIXe1634Address_GetSubAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXe1634Address_GetSubAddress +( + NSSPKIXe1634Address *e, + NSSArena *arenaOpt +); + +/* + * NSSPKIXe1634Address_SetSubAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXe1634Address_SetSubAddress +( + NSSPKIXe1634Address *e, + NSSUTF8 *subAddress +); + +/* + * NSSPKIXe1634Address_RemoveSubAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXe1634Address_RemoveSubAddress +( + NSSPKIXe1634Address *e +); + +/* + * NSSPKIXe1634Address_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXe1634Address_Equal +( + NSSPKIXe1634Address *e1, + NSSPKIXe1634Address *e2, + PRStatus *statusOpt +); + +/* + * NSSPKIXe1634Address_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXe1634Address upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXe1634Address * +NSSPKIXe1634Address_Duplicate +( + NSSPKIXe1634Address *e, + NSSArena *arenaOpt +); + +/* + * PresentationAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PresentationAddress ::= SEQUENCE { + * pSelector [0] EXPLICIT OCTET STRING OPTIONAL, + * sSelector [1] EXPLICIT OCTET STRING OPTIONAL, + * tSelector [2] EXPLICIT OCTET STRING OPTIONAL, + * nAddresses [3] EXPLICIT SET SIZE (1..MAX) OF OCTET STRING } + * + * The public calls for the type: + * + * NSSPKIXPresentationAddress_Decode + * NSSPKIXPresentationAddress_Create + * NSSPKIXPresentationAddress_Destroy + * NSSPKIXPresentationAddress_Encode + * NSSPKIXPresentationAddress_HasPSelector + * NSSPKIXPresentationAddress_GetPSelector + * NSSPKIXPresentationAddress_SetPSelector + * NSSPKIXPresentationAddress_RemovePSelector + * NSSPKIXPresentationAddress_HasSSelector + * NSSPKIXPresentationAddress_GetSSelector + * NSSPKIXPresentationAddress_SetSSelector + * NSSPKIXPresentationAddress_RemoveSSelector + * NSSPKIXPresentationAddress_HasTSelector + * NSSPKIXPresentationAddress_GetTSelector + * NSSPKIXPresentationAddress_SetTSelector + * NSSPKIXPresentationAddress_RemoveTSelector + * NSSPKIXPresentationAddress_HasNAddresses + * NSSPKIXPresentationAddress_GetNAddresses + * NSSPKIXPresentationAddress_SetNAddresses + * NSSPKIXPresentationAddress_RemoveNAddresses + *{NAddresses must be more complex than that} + * NSSPKIXPresentationAddress_Compare + * NSSPKIXPresentationAddress_Duplicate + * + */ + +/* + * TeletexDomainDefinedAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexDomainDefinedAttributes ::= SEQUENCE SIZE + * (1..ub-domain-defined-attributes) OF TeletexDomainDefinedAttribute + * + * The public calls for the type: + * + * NSSPKIXTeletexDomainDefinedAttributes_Decode + * NSSPKIXTeletexDomainDefinedAttributes_Create + * NSSPKIXTeletexDomainDefinedAttributes_Destroy + * NSSPKIXTeletexDomainDefinedAttributes_Encode + * NSSPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttributeCount + * NSSPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttributes + * NSSPKIXTeletexDomainDefinedAttributes_SetTeletexDomainDefinedAttributes + * NSSPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttribute + * NSSPKIXTeletexDomainDefinedAttributes_SetTeletexDomainDefinedAttribute + * NSSPKIXTeletexDomainDefinedAttributes_InsertTeletexDomainDefinedAttribute + * NSSPKIXTeletexDomainDefinedAttributes_AppendTeletexDomainDefinedAttribute + * NSSPKIXTeletexDomainDefinedAttributes_RemoveTeletexDomainDefinedAttribute + * NSSPKIXTeletexDomainDefinedAttributes_FindTeletexDomainDefinedAttribute + * NSSPKIXTeletexDomainDefinedAttributes_Equal + * NSSPKIXTeletexDomainDefinedAttributes_Duplicate + * + */ + +/* + * NSSPKIXTeletexDomainDefinedAttributes_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttributes + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttributes * +NSSPKIXTeletexDomainDefinedAttributes_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttributes + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttributes * +NSSPKIXTeletexDomainDefinedAttributes_Create +( + NSSArena *arenaOpt, + NSSPKIXTeletexDomainDefinedAttribute *tdda1, + ... +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexDomainDefinedAttributes_Destroy +( + NSSPKIXTeletexDomainDefinedAttributes *tddas +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXTeletexDomainDefinedAttributes_Encode +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttributeCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttributeCount +( + NSSPKIXTeletexDomainDefinedAttributes *tddas +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXTeletexDomainDefinedAttribute + * pointers upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttribute ** +NSSPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttributes +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + NSSPKIXTeletexDomainDefinedAttribute *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_SetTeletexDomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexDomainDefinedAttributes_SetTeletexDomainDefinedAttributes +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + NSSPKIXTeletexDomainDefinedAttribute *tdda[], + PRInt32 count +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttribute upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttribute * +NSSPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttribute +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_SetTeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexDomainDefinedAttributes_SetTeletexDomainDefinedAttribute +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + PRInt32 i, + NSSPKIXTeletexDomainDefinedAttribute *tdda +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_InsertTeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexDomainDefinedAttributes_InsertTeletexDomainDefinedAttribute +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + PRInt32 i, + NSSPKIXTeletexDomainDefinedAttribute *tdda +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_AppendTeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexDomainDefinedAttributes_AppendTeletexDomainDefinedAttribute +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + NSSPKIXTeletexDomainDefinedAttribute *tdda +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_RemoveTeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexDomainDefinedAttributes_RemoveTeletexDomainDefinedAttribute +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + PRInt32 i +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_FindTeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * The nonnegative integer upon success + * -1 upon failure + */ + +NSS_EXTERN PRInt32 +NSSPKIXTeletexDomainDefinedAttributes_FindTeletexDomainDefinedAttribute +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + NSSPKIXTeletexDomainDefinedAttribute *tdda +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXTeletexDomainDefinedAttributes_Equal +( + NSSPKIXTeletexDomainDefinedAttributes *tddas1, + NSSPKIXTeletexDomainDefinedAttributes *tddas2, + PRStatus *statusOpt +); + +/* + * NSSPKIXTeletexDomainDefinedAttributes_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttributes + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttributes * +NSSPKIXTeletexDomainDefinedAttributes_Duplicate +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + NSSArena *arenaOpt +); + +/* + * TeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexDomainDefinedAttribute ::= SEQUENCE { + * type TeletexString + * (SIZE (1..ub-domain-defined-attribute-type-length)), + * value TeletexString + * (SIZE (1..ub-domain-defined-attribute-value-length)) } + * + * The public calls for the type: + * + * NSSPKIXTeletexDomainDefinedAttribute_Decode + * NSSPKIXTeletexDomainDefinedAttribute_CreateFromUTF8 + * NSSPKIXTeletexDomainDefinedAttribute_Create + * NSSPKIXTeletexDomainDefinedAttribute_Destroy + * NSSPKIXTeletexDomainDefinedAttribute_Encode + * NSSPKIXTeletexDomainDefinedAttribute_GetUTF8Encoding + * NSSPKIXTeletexDomainDefinedAttribute_GetType + * NSSPKIXTeletexDomainDefinedAttribute_SetType + * NSSPKIXTeletexDomainDefinedAttribute_GetValue + * NSSPKIXTeletexDomainDefinedAttribute_GetValue + * NSSPKIXTeletexDomainDefinedAttribute_Equal + * NSSPKIXTeletexDomainDefinedAttribute_Duplicate + * + */ + +/* + * NSSPKIXTeletexDomainDefinedAttribute_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttribute * +NSSPKIXTeletexDomainDefinedAttribute_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXTeletexDomainDefinedAttribute_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttribute * +NSSPKIXTeletexDomainDefinedAttribute_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXTeletexDomainDefinedAttribute_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttribute * +NSSPKIXTeletexDomainDefinedAttribute_Create +( + NSSArena *arenaOpt, + NSSUTF8 *type, + NSSUTF8 *value +); + +/* + * NSSPKIXTeletexDomainDefinedAttribute_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexDomainDefinedAttribute_Destroy +( + NSSPKIXTeletexDomainDefinedAttribute *tdda +); + +/* + * NSSPKIXTeletexDomainDefinedAttribute_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXTeletexDomainDefinedAttribute_Encode +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexDomainDefinedAttribute_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXTeletexDomainDefinedAttribute_GetUTF8Encoding +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexDomainDefinedAttribute_GetType + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXTeletexDomainDefinedAttribute_GetType +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexDomainDefinedAttribute_SetType + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexDomainDefinedAttribute_SetType +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSUTF8 *type +); + +/* + * NSSPKIXTeletexDomainDefinedAttribute_GetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXTeletexDomainDefinedAttribute_GetValue +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSArena *arenaOpt +); + +/* + * NSSPKIXTeletexDomainDefinedAttribute_SetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXTeletexDomainDefinedAttribute_SetValue +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSUTF8 *value +); + +/* + * NSSPKIXTeletexDomainDefinedAttribute_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXTeletexDomainDefinedAttribute_Equal +( + NSSPKIXTeletexDomainDefinedAttribute *tdda1, + NSSPKIXTeletexDomainDefinedAttribute *tdda2, + PRStatus *statusOpt +); + +/* + * NSSPKIXTeletexDomainDefinedAttribute_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttribute * +NSSPKIXTeletexDomainDefinedAttribute_Duplicate +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSArena *arenaOpt +); + +/* + * AuthorityKeyIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AuthorityKeyIdentifier ::= SEQUENCE { + * keyIdentifier [0] KeyIdentifier OPTIONAL, + * authorityCertIssuer [1] GeneralNames OPTIONAL, + * authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL } + * -- authorityCertIssuer and authorityCertSerialNumber shall both + * -- be present or both be absent + * + * The public calls for the type: + * + * NSSPKIXAuthorityKeyIdentifier_Decode + * NSSPKIXAuthorityKeyIdentifier_Create + * NSSPKIXAuthorityKeyIdentifier_Destroy + * NSSPKIXAuthorityKeyIdentifier_Encode + * NSSPKIXAuthorityKeyIdentifier_HasKeyIdentifier + * NSSPKIXAuthorityKeyIdentifier_GetKeyIdentifier + * NSSPKIXAuthorityKeyIdentifier_SetKeyIdentifier + * NSSPKIXAuthorityKeyIdentifier_RemoveKeyIdentifier + * NSSPKIXAuthorityKeyIdentifier_HasAuthorityCertIssuerAndSerialNumber + * NSSPKIXAuthorityKeyIdentifier_RemoveAuthorityCertIssuerAndSerialNumber + * NSSPKIXAuthorityKeyIdentifier_GetAuthorityCertIssuer + * NSSPKIXAuthorityKeyIdentifier_GetAuthorityCertSerialNumber + * NSSPKIXAuthorityKeyIdentifier_SetAuthorityCertIssuerAndSerialNumber + * NSSPKIXAuthorityKeyIdentifier_Equal + * NSSPKIXAuthorityKeyIdentifier_Duplicate + * + */ + +/* + * NSSPKIXAuthorityKeyIdentifier_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAuthorityKeyIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAuthorityKeyIdentifier * +NSSPKIXAuthorityKeyIdentifier_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXAuthorityKeyIdentifier_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_ARGUMENTS + * + * Return value: + * A valid pointer to an NSSPKIXAuthorityKeyIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAuthorityKeyIdentifier * +NSSPKIXAuthorityKeyIdentifier_Create +( + NSSArena *arenaOpt, + NSSPKIXKeyIdentifier *keyIdentifierOpt, + NSSPKIXGeneralNames *authorityCertIssuerOpt, + NSSPKIXCertificateSerialNumber *authorityCertSerialNumberOpt +); + +/* + * NSSPKIXAuthorityKeyIdentifier_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAuthorityKeyIdentifier_Destroy +( + NSSPKIXAuthorityKeyIdentifier *aki +); + +/* + * NSSPKIXAuthorityKeyIdentifier_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXAuthorityKeyIdentifier_Encode +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAuthorityKeyIdentifier_HasKeyIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXAuthorityKeyIdentifier_HasKeyIdentifier +( + NSSPKIXAuthorityKeyIdentifier *aki, + PRStatus *statusOpt +); + +/* + * NSSPKIXAuthorityKeyIdentifier_GetKeyIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_KEY_IDENTIFIER + * + * Return value: + * A valid pointer to an NSSPKIXKeyIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXKeyIdentifier * +NSSPKIXAuthorityKeyIdentifier_GetKeyIdentifier +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSPKIXKeyIdentifier *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAuthorityKeyIdentifier_SetKeyIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAuthorityKeyIdentifier_SetKeyIdentifier +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSPKIXKeyIdentifier *keyIdentifier +); + +/* + * NSSPKIXAuthorityKeyIdentifier_RemoveKeyIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_HAS_NO_KEY_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAuthorityKeyIdentifier_RemoveKeyIdentifier +( + NSSPKIXAuthorityKeyIdentifier *aki +); + +/* + * NSSPKIXAuthorityKeyIdentifier_HasAuthorityCertIssuerAndSerialNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * + * Return value: + * PR_TRUE if it has them + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXAuthorityKeyIdentifier_HasAuthorityCertIssuerAndSerialNumber +( + NSSPKIXAuthorityKeyIdentifier *aki, + PRStatus *statusOpt +); + +/* + * NSSPKIXAuthorityKeyIdentifier_RemoveAuthorityCertIssuerAndSerialNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_HAS_NO_AUTHORITY_CERT_ISSUER_AND_SERIAL_NUMBER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAuthorityKeyIdentifier_RemoveAuthorityCertIssuerAndSerialNumber +( + NSSPKIXAuthorityKeyIdentifier *aki +); + +/* + * NSSPKIXAuthorityKeyIdentifier_GetAuthorityCertIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_AUTHORITY_CERT_ISSUER_AND_SERIAL_NUMBER + * + * Return value: + * A valid pointer to an NSSPKIXGeneralNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralNames * +NSSPKIXAuthorityKeyIdentifier_GetAuthorityCertIssuer +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAuthorityKeyIdentifier_GetAuthorityCertSerialNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_AUTHORITY_CERT_ISSUER_AND_SERIAL_NUMBER + * + * Return value: + * A valid pointer to an NSSPKIXCertificateSerialNumber upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificateSerialNumber * +NSSPKIXAuthorityKeyIdentifier_GetAuthorityCertSerialNumber +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSPKIXCertificateSerialNumber *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAuthorityKeyIdentifier_SetAuthorityCertIssuerAndSerialNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAuthorityKeyIdentifier_SetAuthorityCertIssuerAndSerialNumber +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSPKIXGeneralNames *issuer, + NSSPKIXCertificateSerialNumber *serialNumber +); + +/* + * NSSPKIXAuthorityKeyIdentifier_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXAuthorityKeyIdentifier_Equal +( + NSSPKIXAuthorityKeyIdentifier *aki1, + NSSPKIXAuthorityKeyIdentifier *aki2, + PRStatus *statusOpt +); + +/* + * NSSPKIXAuthorityKeyIdentifier_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAuthorityKeyIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAuthorityKeyIdentifier * +NSSPKIXAuthorityKeyIdentifier_Duplicate +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSArena *arenaOpt +); + +/* + * KeyUsage + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * KeyUsage ::= BIT STRING { + * digitalSignature (0), + * nonRepudiation (1), + * keyEncipherment (2), + * dataEncipherment (3), + * keyAgreement (4), + * keyCertSign (5), + * cRLSign (6), + * encipherOnly (7), + * decipherOnly (8) } + * + * The public calls for the type: + * + * NSSPKIXKeyUsage_Decode + * NSSPKIXKeyUsage_CreateFromUTF8 + * NSSPKIXKeyUsage_CreateFromValue + * NSSPKIXKeyUsage_Destroy + * NSSPKIXKeyUsage_Encode + * NSSPKIXKeyUsage_GetUTF8Encoding + * NSSPKIXKeyUsage_GetValue + * NSSPKIXKeyUsage_SetValue + * { bitwise accessors? } + * NSSPKIXKeyUsage_Equal + * NSSPKIXKeyUsage_Duplicate + * + */ + +/* + * NSSPKIXKeyUsage_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXKeyUsage upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXKeyUsage * +NSSPKIXKeyUsage_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXKeyUsage_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXKeyUsage upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXKeyUsage * +NSSPKIXKeyUsage_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXKeyUsage_CreateFromValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE_VALUE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXKeyUsage upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXKeyUsage * +NSSPKIXKeyUsage_CreateFromValue +( + NSSArena *arenaOpt, + NSSPKIXKeyUsageValue value +); + +/* + * NSSPKIXKeyUsage_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXKeyUsage_Destroy +( + NSSPKIXKeyUsage *keyUsage +); + +/* + * NSSPKIXKeyUsage_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXKeyUsage_Encode +( + NSSPKIXKeyUsage *keyUsage, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXKeyUsage_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXKeyUsage_GetUTF8Encoding +( + NSSPKIXKeyUsage *keyUsage, + NSSArena *arenaOpt +); + +/* + * NSSPKIXKeyUsage_GetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * + * Return value: + * A set of NSSKeyUsageValue values OR-d together upon success + * NSSKeyUsage_NSSinvalid upon failure + */ + +NSS_EXTERN NSSKeyUsageValue +NSSPKIXKeyUsage_GetValue +( + NSSPKIXKeyUsage *keyUsage +); + +/* + * NSSPKIXKeyUsage_SetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * NSS_ERROR_INVALID_PKIX_KEY_USAGE_VALUE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXKeyUsage_SetValue +( + NSSPKIXKeyUsage *keyUsage, + NSSPKIXKeyUsageValue value +); + +/* + * NSSPKIXKeyUsage_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXKeyUsage_Equal +( + NSSPKIXKeyUsage *keyUsage1, + NSSPKIXKeyUsage *keyUsage2, + PRStatus *statusOpt +); + +/* + * NSSPKIXKeyUsage_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXKeyUsage upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXKeyUsage * +NSSPKIXKeyUsage_Duplicate +( + NSSPKIXKeyUsage *keyUsage, + NSSArena *arenaOpt +); + +/* + * PrivateKeyUsagePeriod + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PrivateKeyUsagePeriod ::= SEQUENCE { + * notBefore [0] GeneralizedTime OPTIONAL, + * notAfter [1] GeneralizedTime OPTIONAL } + * -- either notBefore or notAfter shall be present + * + * The public calls for the type: + * + * NSSPKIXPrivateKeyUsagePeriod_Decode + * NSSPKIXPrivateKeyUsagePeriod_Create + * NSSPKIXPrivateKeyUsagePeriod_Destroy + * NSSPKIXPrivateKeyUsagePeriod_Encode + * NSSPKIXPrivateKeyUsagePeriod_HasNotBefore + * NSSPKIXPrivateKeyUsagePeriod_GetNotBefore + * NSSPKIXPrivateKeyUsagePeriod_SetNotBefore + * NSSPKIXPrivateKeyUsagePeriod_RemoveNotBefore + * NSSPKIXPrivateKeyUsagePeriod_HasNotAfter + * NSSPKIXPrivateKeyUsagePeriod_GetNotAfter + * NSSPKIXPrivateKeyUsagePeriod_SetNotAfter + * NSSPKIXPrivateKeyUsagePeriod_RemoveNotAfter + * NSSPKIXPrivateKeyUsagePeriod_Equal + * NSSPKIXPrivateKeyUsagePeriod_Duplicate + * + */ + +/* + * NSSPKIXPrivateKeyUsagePeriod_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPrivateKeyUsagePeriod upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPrivateKeyUsagePeriod * +NSSPKIXPrivateKeyUsagePeriod_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXPrivateKeyUsagePeriod_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_TIME + * NSS_ERROR_INVALID_ARGUMENTS + * + * Return value: + * A valid pointer to an NSSPKIXPrivateKeyUsagePeriod upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPrivateKeyUsagePeriod * +NSSPKIXPrivateKeyUsagePeriod_Create +( + NSSArena *arenaOpt, + NSSTime *notBeforeOpt, + NSSTime *notAfterOpt +); + +/* + * NSSPKIXPrivateKeyUsagePeriod_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPrivateKeyUsagePeriod_Destroy +( + NSSPKIXPrivateKeyUsagePeriod *period +); + +/* + * NSSPKIXPrivateKeyUsagePeriod_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_DATA + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXPrivateKeyUsagePeriod_Encode +( + NSSPKIXPrivateKeyUsagePeriod *period, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPrivateKeyUsagePeriod_HasNotBefore + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXPrivateKeyUsagePeriod_HasNotBefore +( + NSSPKIXPrivateKeyUsagePeriod *period, + PRStatus *statusOpt +); + +/* + * NSSPKIXPrivateKeyUsagePeriod_GetNotBefore + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_NOT_BEFORE + * + * Return value: + * NSSTime {fgmr!} + * NULL upon failure + */ + +NSS_EXTERN NSSTime * +NSSPKIXPrivateKeyUsagePeriod_GetNotBefore +( + NSSPKIXPrivateKeyUsagePeriod *period, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPrivateKeyUsagePeriod_SetNotBefore + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_INVALID_TIME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPrivateKeyUsagePeriod_SetNotBefore +( + NSSPKIXPrivateKeyUsagePeriod *period, + NSSTime *notBefore +); + +/* + * NSSPKIXPrivateKeyUsagePeriod_RemoveNotBefore + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_HAS_NO_NOT_BEFORE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPrivateKeyUsagePeriod_RemoveNotBefore +( + NSSPKIXPrivateKeyUsagePeriod *period +); + +/* + * NSSPKIXPrivateKeyUsagePeriod_HasNotAfter + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXPrivateKeyUsagePeriod_HasNotAfter +( + NSSPKIXPrivateKeyUsagePeriod *period, + PRStatus *statusOpt +); + +/* + * NSSPKIXPrivateKeyUsagePeriod_GetNotAfter + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_NOT_AFTER + * + * Return value: + * NSSTime {fgmr!} + * NULL upon failure + */ + +NSS_EXTERN NSSTime * +NSSPKIXPrivateKeyUsagePeriod_GetNotAfter +( + NSSPKIXPrivateKeyUsagePeriod *period, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPrivateKeyUsagePeriod_SetNotAfter + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_INVALID_TIME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPrivateKeyUsagePeriod_SetNotAfter +( + NSSPKIXPrivateKeyUsagePeriod *period, + NSSTime *notAfter +); + +/* + * NSSPKIXPrivateKeyUsagePeriod_RemoveNotAfter + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_HAS_NO_NOT_AFTER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPrivateKeyUsagePeriod_RemoveNotAfter +( + NSSPKIXPrivateKeyUsagePeriod *period +); + +/* + * NSSPKIXPrivateKeyUsagePeriod_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXPrivateKeyUsagePeriod_Equal +( + NSSPKIXPrivateKeyUsagePeriod *period1, + NSSPKIXPrivateKeyUsagePeriod *period2, + PRStatus *statusOpt +); + +/* + * NSSPKIXPrivateKeyUsagePeriod_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPrivateKeyUsagePeriod upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPrivateKeyUsagePeriod * +NSSPKIXPrivateKeyUsagePeriod_Duplicate +( + NSSPKIXPrivateKeyUsagePeriod *period, + NSSArena *arenaOpt +); + +/* + * CertificatePolicies + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CertificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation + * + * The public calls for the type: + * + * NSSPKIXCertificatePolicies_Decode + * NSSPKIXCertificatePolicies_Create + * NSSPKIXCertificatePolicies_Destroy + * NSSPKIXCertificatePolicies_Encode + * NSSPKIXCertificatePolicies_GetPolicyInformationCount + * NSSPKIXCertificatePolicies_GetPolicyInformations + * NSSPKIXCertificatePolicies_SetPolicyInformations + * NSSPKIXCertificatePolicies_GetPolicyInformation + * NSSPKIXCertificatePolicies_SetPolicyInformation + * NSSPKIXCertificatePolicies_InsertPolicyInformation + * NSSPKIXCertificatePolicies_AppendPolicyInformation + * NSSPKIXCertificatePolicies_RemovePolicyInformation + * NSSPKIXCertificatePolicies_FindPolicyInformation + * NSSPKIXCertificatePolicies_Equal + * NSSPKIXCertificatePolicies_Duplicate + * + */ + +/* + * NSSPKIXCertificatePolicies_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCertificatePolicies upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificatePolicies * +NSSPKIXCertificatePolicies_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXCertificatePolicies_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * + * Return value: + * A valid pointer to an NSSPKIXCertificatePolicies upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificatePolicies * +NSSPKIXCertificatePolicies_Create +( + NSSArena *arenaOpt, + NSSPKIXPolicyInformation *pi1, + ... +); + +/* + * NSSPKIXCertificatePolicies_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificatePolicies_Destroy +( + NSSPKIXCertificatePolicies *cp +); + +/* + * NSSPKIXCertificatePolicies_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXCertificatePolicies_Encode +( + NSSPKIXCertificatePolicies *cp, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCertificatePolicies_GetPolicyInformationCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXCertificatePolicies_GetPolicyInformationCount +( + NSSPKIXCertificatePolicies *cp +); + +/* + * NSSPKIXCertificatePolicies_GetPolicyInformations + * + * We regret the function name. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXPolicyInformation pointers + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyInformation ** +NSSPKIXCertificatePolicies_GetPolicyInformations +( + NSSPKIXCertificatePolicies *cp, + NSSPKIXPolicyInformation *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCertificatePolicies_SetPolicyInformations + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificatePolicies_SetPolicyInformations +( + NSSPKIXCertificatePolicies *cp, + NSSPKIXPolicyInformation *pi[], + PRInt32 count +); + +/* + * NSSPKIXCertificatePolicies_GetPolicyInformation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyInformation upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyInformation * +NSSPKIXCertificatePolicies_GetPolicyInformation +( + NSSPKIXCertificatePolicies *cp, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCertificatePolicies_SetPolicyInformation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificatePolicies_SetPolicyInformation +( + NSSPKIXCertificatePolicies *cp, + PRInt32 i, + NSSPKIXPolicyInformation *pi +); + +/* + * NSSPKIXCertificatePolicies_InsertPolicyInformation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificatePolicies_InsertPolicyInformation +( + NSSPKIXCertificatePolicies *cp, + PRInt32 i, + NSSPKIXPolicyInformation *pi +); + +/* + * NSSPKIXCertificatePolicies_AppendPolicyInformation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificatePolicies_AppendPolicyInformation +( + NSSPKIXCertificatePolicies *cp, + NSSPKIXPolicyInformation *pi +); + +/* + * NSSPKIXCertificatePolicies_RemovePolicyInformation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCertificatePolicies_RemovePolicyInformation +( + NSSPKIXCertificatePolicies *cp, + PRInt32 i +); + +/* + * NSSPKIXCertificatePolicies_FindPolicyInformation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * + * Return value: + * The nonnegative integer upon success + * -1 upon failure + */ + +NSS_EXTERN PRInt32 +NSSPKIXCertificatePolicies_FindPolicyInformation +( + NSSPKIXCertificatePolicies *cp, + NSSPKIXPolicyInformation *pi +); + +/* + * NSSPKIXCertificatePolicies_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXCertificatePolicies_Equal +( + NSSPKIXCertificatePolicies *cp1, + NSSPKIXCertificatePolicies *cp2, + PRStatus *statusOpt +); + +/* + * NSSPKIXCertificatePolicies_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCertificatePolicies upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificatePolicies * +NSSPKIXCertificatePolicies_Duplicate +( + NSSPKIXCertificatePolicies *cp, + NSSArena *arenaOpt +); + +/* + * PolicyInformation + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyInformation ::= SEQUENCE { + * policyIdentifier CertPolicyId, + * policyQualifiers SEQUENCE SIZE (1..MAX) OF + * PolicyQualifierInfo OPTIONAL } + * + * The public calls for the type: + * + * NSSPKIXPolicyInformation_Decode + * NSSPKIXPolicyInformation_Create + * NSSPKIXPolicyInformation_Destroy + * NSSPKIXPolicyInformation_Encode + * NSSPKIXPolicyInformation_GetPolicyIdentifier + * NSSPKIXPolicyInformation_SetPolicyIdentifier + * NSSPKIXPolicyInformation_GetPolicyQualifierCount + * NSSPKIXPolicyInformation_GetPolicyQualifiers + * NSSPKIXPolicyInformation_SetPolicyQualifiers + * NSSPKIXPolicyInformation_GetPolicyQualifier + * NSSPKIXPolicyInformation_SetPolicyQualifier + * NSSPKIXPolicyInformation_InsertPolicyQualifier + * NSSPKIXPolicyInformation_AppendPolicyQualifier + * NSSPKIXPolicyInformation_RemovePolicyQualifier + * NSSPKIXPolicyInformation_Equal + * NSSPKIXPolicyInformation_Duplicate + * { and accessors by specific policy qualifier ID } + * + */ + +/* + * NSSPKIXPolicyInformation_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyInformation upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyInformation * +NSSPKIXPolicyInformation_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXPolicyInformation_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * + * Return value: + * A valid pointer to an NSSPKIXPolicyInformation upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyInformation * +NSSPKIXPolicyInformation_Create +( + NSSArena *arenaOpt, + NSSPKIXCertPolicyId *id, + NSSPKIXPolicyQualifierInfo *pqi1, + ... +); + +/* + * NSSPKIXPolicyInformation_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyInformation_Destroy +( + NSSPKIXPolicyInformation *pi +); + +/* + * NSSPKIXPolicyInformation_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXPolicyInformation_Encode +( + NSSPKIXPolicyInformation *pi, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPolicyInformation_GetPolicyIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid OID upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertPolicyId * +NSSPKIXPolicyInformation_GetPolicyIdentifier +( + NSSPKIXPolicyInformation *pi +); + +/* + * NSSPKIXPolicyInformation_SetPolicyIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyInformation_SetPolicyIdentifier +( + NSSPKIXPolicyInformation *pi, + NSSPKIXCertPolicyIdentifier *cpi +); + +/* + * NSSPKIXPolicyInformation_GetPolicyQualifierCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXPolicyInformation_GetPolicyQualifierCount +( + NSSPKIXPolicyInformation *pi +); + +/* + * NSSPKIXPolicyInformation_GetPolicyQualifiers + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXPolicyQualifierInfo pointers + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyQualifierInfo ** +NSSPKIXPolicyInformation_GetPolicyQualifiers +( + NSSPKIXPolicyInformation *pi, + NSSPKIXPolicyQualifierInfo *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPolicyInformation_SetPolicyQualifiers + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyInformation_SetPolicyQualifiers +( + NSSPKIXPolicyInformation *pi, + NSSPKIXPolicyQualifierInfo *pqi[], + PRInt32 count +); + +/* + * NSSPKIXPolicyInformation_GetPolicyQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyQualifierInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyQualifierInfo * +NSSPKIXPolicyInformation_GetPolicyQualifier +( + NSSPKIXPolicyInformation *pi, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPolicyInformation_SetPolicyQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyInformation_SetPolicyQualifier +( + NSSPKIXPolicyInformation *pi, + PRInt32 i, + NSSPKIXPolicyQualifierInfo *pqi +); + +/* + * NSSPKIXPolicyInformation_InsertPolicyQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyInformation_InsertPolicyQualifier +( + NSSPKIXPolicyInformation *pi, + PRInt32 i, + NSSPKIXPolicyQualifierInfo *pqi +); + +/* + * NSSPKIXPolicyInformation_AppendPolicyQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyInformation_AppendPolicyQualifier +( + NSSPKIXPolicyInformation *pi, + PRInt32 i, + NSSPKIXPolicyQualifierInfo *pqi +); + +/* + * NSSPKIXPolicyInformation_RemovePolicyQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyInformation_RemovePolicyQualifier +( + NSSPKIXPolicyInformation *pi, + PRInt32 i +); + +/* + * NSSPKIXPolicyInformation_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXPolicyInformation_Equal +( + NSSPKIXPolicyInformation *pi1, + NSSPKIXPolicyInformation *pi2, + PRStatus *statusOpt +); + +/* + * NSSPKIXPolicyInformation_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyInformation upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyInformation * +NSSPKIXPolicyInformation_Duplicate +( + NSSPKIXPolicyInformation *pi, + NSSArena *arenaOpt +); + +/* + * { and accessors by specific policy qualifier ID } + * + */ + +/* + * PolicyQualifierInfo + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyQualifierInfo ::= SEQUENCE { + * policyQualifierId PolicyQualifierId, + * qualifier ANY DEFINED BY policyQualifierId } + * + * The public calls for the type: + * + * NSSPKIXPolicyQualifierInfo_Decode + * NSSPKIXPolicyQualifierInfo_Create + * NSSPKIXPolicyQualifierInfo_Destroy + * NSSPKIXPolicyQualifierInfo_Encode + * NSSPKIXPolicyQualifierInfo_GetPolicyQualifierID + * NSSPKIXPolicyQualifierInfo_SetPolicyQualifierID + * NSSPKIXPolicyQualifierInfo_GetQualifier + * NSSPKIXPolicyQualifierInfo_SetQualifier + * NSSPKIXPolicyQualifierInfo_Equal + * NSSPKIXPolicyQualifierInfo_Duplicate + * { and accessors by specific qualifier id/type } + * + */ + +/* + * NSSPKIXPolicyQualifierInfo_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyQualifierInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyQualifierInfo * +NSSPKIXPolicyQualifierInfo_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXPolicyQualifierInfo_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_ID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXPolicyQualifierInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyQualifierInfo * +NSSPKIXPolicyQualifierInfo_Create +( + NSSArena *arenaOpt, + NSSPKIXPolicyQualifierId *policyQualifierId, + NSSItem *qualifier +); + +/* + * NSSPKIXPolicyQualifierInfo_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyQualifierInfo_Destroy +( + NSSPKIXPolicyQualifierInfo *pqi +); + +/* + * NSSPKIXPolicyQualifierInfo_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXPolicyQualifierInfo_Encode +( + NSSPKIXPolicyQualifierInfo *pqi, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPolicyQualifierInfo_GetPolicyQualifierId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXPolicyQualifierId (an NSSOID) upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyQualifierId * +NSSPKIXPolicyQualifierInfo_GetPolicyQualifierId +( + NSSPKIXPolicyQualifierInfo *pqi, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPolicyQualifierInfo_SetPolicyQualifierId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_ID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyQualifierInfo_SetPolicyQualifierId +( + NSSPKIXPolicyQualifierInfo *pqi, + NSSPKIXPolicyQualifierId *pqid +); + +/* + * NSSPKIXPolicyQualifierInfo_GetQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +NSSPKIXPolicyQualifierInfo_GetQualifier +( + NSSPKIXPolicyQualifierInfo *pqi, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPolicyQualifierInfo_SetQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyQualifierInfo_SetQualifier +( + NSSPKIXPolicyQualifierInfo *pqi, + NSSItem *qualifier +); + +/* + * NSSPKIXPolicyQualifierInfo_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXPolicyQualifierInfo_Equal +( + NSSPKIXPolicyQualifierInfo *pqi1, + NSSPKIXPolicyQualifierInfo *pqi2, + PRStatus *statusOpt +); + +/* + * NSSPKIXPolicyQualifierInfo_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyQualifierInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyQualifierInfo * +NSSPKIXPolicyQualifierInfo_Duplicate +( + NSSPKIXPolicyQualifierInfo *pqi, + NSSArena *arenaOpt +); + +/* + * { and accessors by specific qualifier id/type } + * + */ + +/* + * CPSuri + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CPSuri ::= IA5String + * + * The public calls for this type: + * + * NSSPKIXCPSuri_Decode + * NSSPKIXCPSuri_CreateFromUTF8 + * NSSPKIXCPSuri_Encode + * + */ + +/* + * NSSPKIXCPSuri_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCPSuri upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCPSuri * +NSSPKIXCPSuri_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXCPSuri_CreateFromUTF8 + * + * { basically just enforces the length and charset limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCPSuri upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCPSuri * +NSSPKIXCPSuri_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXCPSuri_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CPS_URI + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXCPSuri_Encode +( + NSSPKIXCPSuri *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * UserNotice + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * UserNotice ::= SEQUENCE { + * noticeRef NoticeReference OPTIONAL, + * explicitText DisplayText OPTIONAL} + * + * The public calls for this type: + * + * NSSPKIXUserNotice_Decode + * NSSPKIXUserNotice_Create + * NSSPKIXUserNotice_Destroy + * NSSPKIXUserNotice_Encode + * NSSPKIXUserNotice_HasNoticeRef + * NSSPKIXUserNotice_GetNoticeRef + * NSSPKIXUserNotice_SetNoticeRef + * NSSPKIXUserNotice_RemoveNoticeRef + * NSSPKIXUserNotice_HasExplicitText + * NSSPKIXUserNotice_GetExplicitText + * NSSPKIXUserNotice_SetExplicitText + * NSSPKIXUserNotice_RemoveExplicitText + * NSSPKIXUserNotice_Equal + * NSSPKIXUserNotice_Duplicate + * + */ + + +/* + * NSSPKIXUserNotice_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXUserNotice upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXUserNotice * +NSSPKIXUserNotice_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXUserNotice_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_INVALID_PKIX_DISPLAY_TEXT + * + * Return value: + * A valid pointer to an NSSPKIXUserNotice upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXUserNotice * +NSSPKIXUserNotice_Create +( + NSSArena *arenaOpt, + NSSPKIXNoticeReference *noticeRef, + NSSPKIXDisplayText *explicitText +); + +/* + * NSSPKIXUserNotice_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXUserNotice_Destroy +( + NSSPKIXUserNotice *userNotice +); + +/* + * NSSPKIXUserNotice_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXUserNotice_Encode +( + NSSPKIXUserNotice *userNotice, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXUserNotice_HasNoticeRef + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXUserNotice_HasNoticeRef +( + NSSPKIXUserNotice *userNotice, + PRStatus *statusOpt +); + +/* + * NSSPKIXUserNotice_GetNoticeRef + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_NOTICE_REF + * + * Return value: + * A valid pointer to an NSSPKIXNoticeReference upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNoticeReference * +NSSPKIXUserNotice_GetNoticeRef +( + NSSPKIXUserNotice *userNotice, + NSSArena *arenaOpt +); + +/* + * NSSPKIXUserNotice_SetNoticeRef + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXUserNotice_SetNoticeRef +( + NSSPKIXUserNotice *userNotice, + NSSPKIXNoticeReference *noticeRef +); + +/* + * NSSPKIXUserNotice_RemoveNoticeRef + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_HAS_NO_NOTICE_REF + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXUserNotice_RemoveNoticeRef +( + NSSPKIXUserNotice *userNotice +); + +/* + * NSSPKIXUserNotice_HasExplicitText + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * + * Return value: + * PR_TRUE if it has some + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXUserNotice_HasExplicitText +( + NSSPKIXUserNotice *userNotice, + PRStatus *statusOpt +); + +/* + * NSSPKIXUserNotice_GetExplicitText + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_EXPLICIT_TEXT + * + * Return value: + * A valid pointer to an NSSPKIXDisplayText string upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDisplayText * +NSSPKIXUserNotice_GetExplicitText +( + NSSPKIXUserNotice *userNotice, + NSSArena *arenaOpt +); + +/* + * NSSPKIXUserNotice_SetExplicitText + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_INVALID_PKIX_DISPLAY_TEXT + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXUserNotice_SetExplicitText +( + NSSPKIXUserNotice *userNotice, + NSSPKIXDisplayText *explicitText +); + +/* + * NSSPKIXUserNotice_RemoveExplicitText + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_HAS_NO_EXPLICIT_TEXT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXUserNotice_RemoveExplicitText +( + NSSPKIXUserNotice *userNotice +); + +/* + * NSSPKIXUserNotice_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXUserNotice_Equal +( + NSSPKIXUserNotice *userNotice1, + NSSPKIXUserNotice *userNotice2, + PRStatus *statusOpt +); + +/* + * NSSPKIXUserNotice_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXUserNotice upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXUserNotice * +NSSPKIXUserNotice_Duplicate +( + NSSPKIXUserNotice *userNotice, + NSSArena *arenaOpt +); + +/* + * NoticeReference + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NoticeReference ::= SEQUENCE { + * organization DisplayText, + * noticeNumbers SEQUENCE OF INTEGER } + * + * The public calls for this type: + * + * NSSPKIXNoticeReference_Decode + * NSSPKIXNoticeReference_Create + * NSSPKIXNoticeReference_Destroy + * NSSPKIXNoticeReference_Encode + * NSSPKIXNoticeReference_GetOrganization + * NSSPKIXNoticeReference_SetOrganization + * NSSPKIXNoticeReference_GetNoticeNumberCount + * NSSPKIXNoticeReference_GetNoticeNumbers + * NSSPKIXNoticeReference_SetNoticeNumbers + * NSSPKIXNoticeReference_GetNoticeNumber + * NSSPKIXNoticeReference_SetNoticeNumber + * NSSPKIXNoticeReference_InsertNoticeNumber + * NSSPKIXNoticeReference_AppendNoticeNumber + * NSSPKIXNoticeReference_RemoveNoticeNumber + * { maybe number-exists-p gettor? } + * NSSPKIXNoticeReference_Equal + * NSSPKIXNoticeReference_Duplicate + * + */ + +/* + * NSSPKIXNoticeReference_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNoticeReference upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNoticeReference * +NSSPKIXNoticeReference_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXNoticeReference_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_DISPLAY_TEXT + * + * Return value: + * A valid pointer to an NSSPKIXNoticeReference upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNoticeReference * +NSSPKIXNoticeReference_Create +( + NSSArena *arenaOpt, + NSSPKIXDisplayText *organization, + PRUint32 noticeCount, + PRInt32 noticeNumber1, + ... +); + +/* + * { fgmr -- or should the call that takes PRInt32 be _CreateFromValues, + * and the _Create call take NSSBER integers? } + */ + +/* + * NSSPKIXNoticeReference_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXNoticeReference_Destroy +( + NSSPKIXNoticeReference *nr +); + +/* + * NSSPKIXNoticeReference_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXNoticeReference_Encode +( + NSSPKIXNoticeReference *nr, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXNoticeReference_GetOrganization + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXDisplayText string upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDisplayText * +NSSPKIXNoticeReference_GetOrganization +( + NSSPKIXNoticeReference *nr, + NSSArena *arenaOpt +); + +/* + * NSSPKIXNoticeReference_SetOrganization + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_INVALID_PKIX_DISPLAY_TEXT + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXNoticeReference_SetOrganization +( + NSSPKIXNoticeReference *nr, + NSSPKIXDisplayText *organization +); + +/* + * NSSPKIXNoticeReference_GetNoticeNumberCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXNoticeReference_GetNoticeNumberCount +( + NSSPKIXNoticeReference *nr +); + +/* + * NSSPKIXNoticeReference_GetNoticeNumbers + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of PRInt32 values upon success + * NULL upon failure + */ + +NSS_EXTERN PRInt32 * +NSSPKIXNoticeReference_GetNoticeNumbers +( + NSSPKIXNoticeReference *nr, + PRInt32 rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXNoticeReference_SetNoticeNumbers + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXNoticeReference_SetNoticeNumbers +( + NSSPKIXNoticeReference *nr, + PRInt32 noticeNumbers[], + PRInt32 count +); + +/* + * NSSPKIXNoticeReference_GetNoticeNumber + * + * -- fgmr comments -- + * Because there is no natural "invalid" notice number value, we must + * pass the number by reference, and return an explicit status value. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_POINTER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXNoticeReference_GetNoticeNumber +( + NSSPKIXNoticeReference *nr, + PRInt32 i, + PRInt32 *noticeNumberP +); + +/* + * NSSPKIXNoticeReference_SetNoticeNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXNoticeReference_SetNoticeNumber +( + NSSPKIXNoticeReference *nr, + PRInt32 i, + PRInt32 noticeNumber +); + +/* + * NSSPKIXNoticeReference_InsertNoticeNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXNoticeReference_InsertNoticeNumber +( + NSSPKIXNoticeReference *nr, + PRInt32 i, + PRInt32 noticeNumber +); + +/* + * NSSPKIXNoticeReference_AppendNoticeNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXNoticeReference_AppendNoticeNumber +( + NSSPKIXNoticeReference *nr, + PRInt32 noticeNumber +); + +/* + * NSSPKIXNoticeReference_RemoveNoticeNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXNoticeReference_RemoveNoticeNumber +( + NSSPKIXNoticeReference *nr, + PRInt32 i +); + +/* + * { maybe number-exists-p gettor? } + */ + +/* + * NSSPKIXNoticeReference_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXNoticeReference_Equal +( + NSSPKIXNoticeReference *nr1, + NSSPKIXNoticeReference *nr2, + PRStatus *statusOpt +); + +/* + * NSSPKIXNoticeReference_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNoticeReference upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNoticeReference * +NSSPKIXNoticeReference_Duplicate +( + NSSPKIXNoticeReference *nr, + NSSArena *arenaOpt +); + +/* + * DisplayText + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DisplayText ::= CHOICE { + * visibleString VisibleString (SIZE (1..200)), + * bmpString BMPString (SIZE (1..200)), + * utf8String UTF8String (SIZE (1..200)) } + * + * The public calls for this type: + * + * NSSPKIXDisplayText_Decode + * NSSPKIXDisplayText_CreateFromUTF8 + * NSSPKIXDisplayText_Encode + * + */ + +/* + * NSSPKIXDisplayText_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDisplayText upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDisplayText * +NSSPKIXDisplayText_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXDisplayText_CreateFromUTF8 + * + * { basically just enforces the length and charset limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDisplayText upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDisplayText * +NSSPKIXDisplayText_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXDisplayText_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISPLAY_TEXT + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXDisplayText_Encode +( + NSSPKIXDisplayText *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PolicyMappings + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE { + * issuerDomainPolicy CertPolicyId, + * subjectDomainPolicy CertPolicyId } + * + * The public calls for this type: + * + * NSSPKIXPolicyMappings_Decode + * NSSPKIXPolicyMappings_Create + * NSSPKIXPolicyMappings_Destroy + * NSSPKIXPolicyMappings_Encode + * NSSPKIXPolicyMappings_GetPolicyMappingCount + * NSSPKIXPolicyMappings_GetPolicyMappings + * NSSPKIXPolicyMappings_SetPolicyMappings + * NSSPKIXPolicyMappings_GetPolicyMapping + * NSSPKIXPolicyMappings_SetPolicyMapping + * NSSPKIXPolicyMappings_InsertPolicyMapping + * NSSPKIXPolicyMappings_AppendPolicyMapping + * NSSPKIXPolicyMappings_RemovePolicyMapping + * NSSPKIXPolicyMappings_FindPolicyMapping + * NSSPKIXPolicyMappings_Equal + * NSSPKIXPolicyMappings_Duplicate + * NSSPKIXPolicyMappings_IssuerDomainPolicyExists + * NSSPKIXPolicyMappings_SubjectDomainPolicyExists + * NSSPKIXPolicyMappings_FindIssuerDomainPolicy + * NSSPKIXPolicyMappings_FindSubjectDomainPolicy + * NSSPKIXPolicyMappings_MapIssuerToSubject + * NSSPKIXPolicyMappings_MapSubjectToIssuer + * { find's and map's: what if there's more than one? } + * + */ + +/* + * NSSPKIXPolicyMappings_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyMappings upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyMappings * +NSSPKIXPolicyMappings_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXPolicyMappings_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * + * Return value: + * A valid pointer to an NSSPKIXPolicyMappings upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyMappings * +NSSPKIXPolicyMappings_Decode +( + NSSArena *arenaOpt, + NSSPKIXpolicyMapping *policyMapping1, + ... +); + +/* + * NSSPKIXPolicyMappings_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyMappings_Destroy +( + NSSPKIXPolicyMappings *policyMappings +); + +/* + * NSSPKIXPolicyMappings_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_DATA + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXPolicyMappings_Encode +( + NSSPKIXPolicyMappings *policyMappings, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPolicyMappings_GetPolicyMappingCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXPolicyMappings_GetPolicyMappingCount +( + NSSPKIXPolicyMappings *policyMappings +); + +/* + * NSSPKIXPolicyMappings_GetPolicyMappings + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXpolicyMapping pointers upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXpolicyMapping ** +NSSPKIXPolicyMappings_GetPolicyMappings +( + NSSPKIXPolicyMappings *policyMappings + NSSPKIXpolicyMapping *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPolicyMappings_SetPolicyMappings + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyMappings_SetPolicyMappings +( + NSSPKIXPolicyMappings *policyMappings + NSSPKIXpolicyMapping *policyMapping[] + PRInt32 count +); + +/* + * NSSPKIXPolicyMappings_GetPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXpolicyMapping upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXpolicyMapping * +NSSPKIXPolicyMappings_GetPolicyMapping +( + NSSPKIXPolicyMappings *policyMappings + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPolicyMappings_SetPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyMappings_SetPolicyMapping +( + NSSPKIXPolicyMappings *policyMappings + PRInt32 i, + NSSPKIXpolicyMapping *policyMapping +); + +/* + * NSSPKIXPolicyMappings_InsertPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyMappings_InsertPolicyMapping +( + NSSPKIXPolicyMappings *policyMappings + PRInt32 i, + NSSPKIXpolicyMapping *policyMapping +); + +/* + * NSSPKIXPolicyMappings_AppendPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyMappings_AppendPolicyMapping +( + NSSPKIXPolicyMappings *policyMappings + NSSPKIXpolicyMapping *policyMapping +); + +/* + * NSSPKIXPolicyMappings_RemovePolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyMappings_RemovePolicyMapping +( + NSSPKIXPolicyMappings *policyMappings + PRInt32 i +); + +/* + * NSSPKIXPolicyMappings_FindPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXPolicyMappings_FindPolicyMapping +( + NSSPKIXPolicyMappings *policyMappings + NSSPKIXpolicyMapping *policyMapping +); + +/* + * NSSPKIXPolicyMappings_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXPolicyMappings_Equal +( + NSSPKIXPolicyMappings *policyMappings1, + NSSPKIXpolicyMappings *policyMappings2, + PRStatus *statusOpt +); + +/* + * NSSPKIXPolicyMappings_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXPolicyMappings upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyMappings * +NSSPKIXPolicyMappings_Duplicate +( + NSSPKIXPolicyMappings *policyMappings, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPolicyMappings_IssuerDomainPolicyExists + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * + * Return value: + * PR_TRUE if the specified domain policy OID exists + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXPolicyMappings_IssuerDomainPolicyExists +( + NSSPKIXPolicyMappings *policyMappings, + NSSPKIXCertPolicyId *issuerDomainPolicy, + PRStatus *statusOpt +); + +/* + * NSSPKIXPolicyMappings_SubjectDomainPolicyExists + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * + * Return value: + * PR_TRUE if the specified domain policy OID exists + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXPolicyMappings_SubjectDomainPolicyExists +( + NSSPKIXPolicyMappings *policyMappings, + NSSPKIXCertPolicyId *subjectDomainPolicy, + PRStatus *statusOpt +); + +/* + * NSSPKIXPolicyMappings_FindIssuerDomainPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXPolicyMappings_FindIssuerDomainPolicy +( + NSSPKIXPolicyMappings *policyMappings, + NSSPKIXCertPolicyId *issuerDomainPolicy +); + +/* + * NSSPKIXPolicyMappings_FindSubjectDomainPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXPolicyMappings_FindSubjectDomainPolicy +( + NSSPKIXPolicyMappings *policyMappings, + NSSPKIXCertPolicyId *issuerDomainPolicy +); + +/* + * NSSPKIXPolicyMappings_MapIssuerToSubject + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_NOT_FOUND + * + * Return value: + * A valid pointer to an NSSPKIXCertPolicyId upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertPolicyId * +NSSPKIXPolicyMappings_MapIssuerToSubject +( + NSSPKIXPolicyMappings *policyMappings, + NSSPKIXCertPolicyId *issuerDomainPolicy +); + +/* + * NSSPKIXPolicyMappings_MapSubjectToIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_NOT_FOUND + * + * Return value: + * A valid pointer to an NSSPKIXCertPolicyId upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertPolicyId * +NSSPKIXPolicyMappings_MapSubjectToIssuer +( + NSSPKIXPolicyMappings *policyMappings, + NSSPKIXCertPolicyId *issuerDomainPolicy +); + +/* + * policyMapping + * + * Helper structure for PolicyMappings + * + * SEQUENCE { + * issuerDomainPolicy CertPolicyId, + * subjectDomainPolicy CertPolicyId } + * + * The public calls for this type: + * + * NSSPKIXpolicyMapping_Decode + * NSSPKIXpolicyMapping_Create + * NSSPKIXpolicyMapping_Destroy + * NSSPKIXpolicyMapping_Encode + * NSSPKIXpolicyMapping_GetIssuerDomainPolicy + * NSSPKIXpolicyMapping_SetIssuerDomainPolicy + * NSSPKIXpolicyMapping_GetSubjectDomainPolicy + * NSSPKIXpolicyMapping_SetSubjectDomainPolicy + * NSSPKIXpolicyMapping_Equal + * NSSPKIXpolicyMapping_Duplicate + * + */ + +/* + * NSSPKIXpolicyMapping_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXpolicyMapping upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXpolicyMapping * +NSSPKIXpolicyMapping_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXpolicyMapping_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * + * Return value: + * A valid pointer to an NSSPKIXpolicyMapping upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXpolicyMapping * +NSSPKIXpolicyMapping_Create +( + NSSArena *arenaOpt, + NSSPKIXCertPolicyId *issuerDomainPolicy, + NSSPKIXCertPolicyId *subjectDomainPolicy +); + +/* + * NSSPKIXpolicyMapping_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXpolicyMapping_Destroy +( + NSSPKIXpolicyMapping *policyMapping +); + +/* + * NSSPKIXpolicyMapping_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_DATA + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXpolicyMapping_Encode +( + NSSPKIXpolicyMapping *policyMapping, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXpolicyMapping_GetIssuerDomainPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXCertPolicyId OID upon success + * NULL upon faliure + */ + +NSS_EXTERN NSSPKIXCertPolicyId * +NSSPKIXpolicyMapping_GetIssuerDomainPolicy +( + NSSPKIXpolicyMapping *policyMapping +); + +/* + * NSSPKIXpolicyMapping_SetIssuerDomainPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXpolicyMapping_SetIssuerDomainPolicy +( + NSSPKIXpolicyMapping *policyMapping, + NSSPKIXCertPolicyId *issuerDomainPolicy +); + +/* + * NSSPKIXpolicyMapping_GetSubjectDomainPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXCertPolicyId OID upon success + * NULL upon faliure + */ + +NSS_EXTERN NSSPKIXCertPolicyId * +NSSPKIXpolicyMapping_GetSubjectDomainPolicy +( + NSSPKIXpolicyMapping *policyMapping +); + +/* + * NSSPKIXpolicyMapping_SetSubjectDomainPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXpolicyMapping_SetSubjectDomainPolicy +( + NSSPKIXpolicyMapping *policyMapping, + NSSPKIXCertPolicyId *subjectDomainPolicy +); + +/* + * NSSPKIXpolicyMapping_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXpolicyMapping_Equal +( + NSSPKIXpolicyMapping *policyMapping1, + NSSPKIXpolicyMapping *policyMapping2, + PRStatus *statusOpt +); + +/* + * NSSPKIXpolicyMapping_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXpolicyMapping upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXpolicyMapping * +NSSPKIXpolicyMapping_Duplicate +( + NSSPKIXpolicyMapping *policyMapping, + NSSArena *arenaOpt +); + +/* + * GeneralName + * + * This structure contains a union of the possible general names, + * of which there are several. + * + * From RFC 2459: + * + * GeneralName ::= CHOICE { + * otherName [0] AnotherName, + * rfc822Name [1] IA5String, + * dNSName [2] IA5String, + * x400Address [3] ORAddress, + * directoryName [4] Name, + * ediPartyName [5] EDIPartyName, + * uniformResourceIdentifier [6] IA5String, + * iPAddress [7] OCTET STRING, + * registeredID [8] OBJECT IDENTIFIER } + * + * The public calls for this type: + * + * NSSPKIXGeneralName_Decode + * NSSPKIXGeneralName_CreateFromUTF8 + * NSSPKIXGeneralName_Create + * NSSPKIXGeneralName_CreateFromOtherName + * NSSPKIXGeneralName_CreateFromRfc822Name + * NSSPKIXGeneralName_CreateFromDNSName + * NSSPKIXGeneralName_CreateFromX400Address + * NSSPKIXGeneralName_CreateFromDirectoryName + * NSSPKIXGeneralName_CreateFromEDIPartyName + * NSSPKIXGeneralName_CreateFromUniformResourceIdentifier + * NSSPKIXGeneralName_CreateFromIPAddress + * NSSPKIXGeneralName_CreateFromRegisteredID + * NSSPKIXGeneralName_Destroy + * NSSPKIXGeneralName_Encode + * NSSPKIXGeneralName_GetUTF8Encoding + * NSSPKIXGeneralName_GetChoice + * NSSPKIXGeneralName_GetOtherName + * NSSPKIXGeneralName_GetRfc822Name + * NSSPKIXGeneralName_GetDNSName + * NSSPKIXGeneralName_GetX400Address + * NSSPKIXGeneralName_GetDirectoryName + * NSSPKIXGeneralName_GetEDIPartyName + * NSSPKIXGeneralName_GetUniformResourceIdentifier + * NSSPKIXGeneralName_GetIPAddress + * NSSPKIXGeneralName_GetRegisteredID + * NSSPKIXGeneralName_GetSpecifiedChoice + * NSSPKIXGeneralName_Equal + * NSSPKIXGeneralName_Duplicate + * (in pki1 I had specific attribute value gettors here too) + * + */ + +/* + * NSSPKIXGeneralName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXGeneralName_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * NSSPKIXGeneralName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME_CHOICE + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_INVALID_PKIX_IA5_STRING + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_INVALID_OID + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralName_Create +( + NSSArena *arenaOpt, + NSSPKIXGeneralNameChoice choice, + void *content +); + +/* + * NSSPKIXGeneralName_CreateFromOtherName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralName_CreateFromOtherName +( + NSSArena *arenaOpt, + NSSPKIXAnotherName *otherName +); + +/* + * NSSPKIXGeneralName_CreateFromRfc822Name + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_IA5_STRING + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralName_CreateFromRfc822Name +( + NSSArena *arenaOpt, + NSSUTF8 *rfc822Name +); + +/* + * NSSPKIXGeneralName_CreateFromDNSName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_IA5_STRING + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralName_CreateFromDNSName +( + NSSArena *arenaOpt, + NSSUTF8 *dNSName +); + +/* + * NSSPKIXGeneralName_CreateFromX400Address + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralName_CreateFromX400Address +( + NSSArena *arenaOpt, + NSSPKIXORAddress *x400Address +); + +/* + * NSSPKIXGeneralName_CreateFromDirectoryName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralName_CreateFromDirectoryName +( + NSSArena *arenaOpt, + NSSPKIXName *directoryName +); + +/* + * NSSPKIXGeneralName_CreateFromEDIPartyName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralName_CreateFromEDIPartyName +( + NSSArena *arenaOpt, + NSSPKIXEDIPartyName *ediPartyname +); + +/* + * NSSPKIXGeneralName_CreateFromUniformResourceIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_IA5_STRING + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralName_CreateFromUniformResourceIdentifier +( + NSSArena *arenaOpt, + NSSUTF8 *uniformResourceIdentifier +); + +/* + * NSSPKIXGeneralName_CreateFromIPAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralName_CreateFromIPAddress +( + NSSArena *arenaOpt, + NSSItem *iPAddress +); + +/* + * NSSPKIXGeneralName_CreateFromRegisteredID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralName_CreateFromRegisteredID +( + NSSArena *arenaOpt, + NSSOID *registeredID +); + +/* + * NSSPKIXGeneralName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralName_Destroy +( + NSSPKIXGeneralName *generalName +); + +/* + * NSSPKIXGeneralName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXGeneralName_Encode +( + NSSPKIXGeneralName *generalName, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralName_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXGeneralName_GetUTF8Encoding +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralName_GetChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * + * Return value: + * A valid NSSPKIXGeneralNameChoice value upon success + * NSSPKIXGeneralNameChoice_NSSinvalid upon failure + */ + +NSS_EXTERN NSSPKIXGeneralNameChoice +NSSPKIXGeneralName_GetChoice +( + NSSPKIXGeneralName *generalName +); + +/* + * NSSPKIXGeneralName_GetOtherName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAnotherName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAnotherName * +NSSPKIXGeneralName_GetOtherName +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralName_GetRfc822Name + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXGeneralName_GetRfc822Name +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralName_GetDNSName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXGeneralName_GetDNSName +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralName_GetX400Address + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXORAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXORAddress * +NSSPKIXGeneralName_GetX400Address +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralName_GetDirectoryName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +NSSPKIXGeneralName_GetDirectoryName +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralName_GetEDIPartyName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXEDIPartyName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXEDIPartyName * +NSSPKIXGeneralName_GetEDIPartyName +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralName_GetUniformResourceIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXGeneralName_GetUniformResourceIdentifier +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralName_GetIPAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +NSSPKIXGeneralName_GetIPAddress +( + NSSPKIXGeneralName *generalName, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralName_GetRegisteredID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSOID upon success + * NULL upon failure + */ + +NSS_EXTERN NSSOID * +NSSPKIXGeneralName_GetRegisteredID +( + NSSPKIXGeneralName *generalName +); + +/* + * NSSPKIXGeneralName_GetSpecifiedChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer upon success + * NULL upon failure + */ + +NSS_EXTERN void * +NSSPKIXGeneralName_GetSpecifiedChoice +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXGeneralName_Equal +( + NSSPKIXGeneralName *generalName1, + NSSPKIXGeneralName *generalName2, + PRStatus *statusOpt +); + +/* + * NSSPKIXGeneralName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralName_Duplicate +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * (in pki1 I had specific attribute value gettors here too) + * + */ + +/* + * GeneralNames + * + * This structure contains a sequence of GeneralName objects. + * + * From RFC 2459: + * + * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName + * + * The public calls for this type: + * + * NSSPKIXGeneralNames_Decode + * NSSPKIXGeneralNames_Create + * NSSPKIXGeneralNames_Destroy + * NSSPKIXGeneralNames_Encode + * NSSPKIXGeneralNames_GetGeneralNameCount + * NSSPKIXGeneralNames_GetGeneralNames + * NSSPKIXGeneralNames_SetGeneralNames + * NSSPKIXGeneralNames_GetGeneralName + * NSSPKIXGeneralNames_SetGeneralName + * NSSPKIXGeneralNames_InsertGeneralName + * NSSPKIXGeneralNames_AppendGeneralName + * NSSPKIXGeneralNames_RemoveGeneralName + * NSSPKIXGeneralNames_FindGeneralName + * NSSPKIXGeneralNames_Equal + * NSSPKIXGeneralNames_Duplicate + * + */ + +/* + * NSSPKIXGeneralNames_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralNames * +NSSPKIXGeneralNames_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXGeneralNames_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * + * Return value: + * A valid pointer to an NSSPKIXGeneralNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralNames * +NSSPKIXGeneralNames_Create +( + NSSArena *arenaOpt, + NSSPKIXGeneralName *generalName1, + ... +); + +/* + * NSSPKIXGeneralNames_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralNames_Destroy +( + NSSPKIXGeneralNames *generalNames +); + +/* + * NSSPKIXGeneralNames_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXGeneralNames_Encode +( + NSSPKIXGeneralNames *generalNames, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralNames_GetGeneralNameCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXGeneralNames_GetGeneralNameCount +( + NSSPKIXGeneralNames *generalNames +); + +/* + * NSSPKIXGeneralNames_GetGeneralNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXGeneralName pointers upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName ** +NSSPKIXGeneralNames_GetGeneralNames +( + NSSPKIXGeneralNames *generalNames, + NSSPKIXGeneralName *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralNames_SetGeneralNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralNames_SetGeneralNames +( + NSSPKIXGeneralNames *generalNames, + NSSPKIXGeneralName *generalName[], + PRInt32 count +); + +/* + * NSSPKIXGeneralNames_GetGeneralName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralNames_GetGeneralName +( + NSSPKIXGeneralNames *generalNames, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralNames_SetGeneralName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralNames_SetGeneralName +( + NSSPKIXGeneralNames *generalNames, + PRInt32 i, + NSSPKIXGeneralName *generalName +); + +/* + * NSSPKIXGeneralNames_InsertGeneralName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralNames_InsertGeneralName +( + NSSPKIXGeneralNames *generalNames, + PRInt32 i, + NSSPKIXGeneralName *generalName +); + +/* + * NSSPKIXGeneralNames_AppendGeneralName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralNames_AppendGeneralName +( + NSSPKIXGeneralNames *generalNames, + NSSPKIXGeneralName *generalName +); + +/* + * NSSPKIXGeneralNames_RemoveGeneralName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralNames_RemoveGeneralName +( + NSSPKIXGeneralNames *generalNames, + PRInt32 i +); + +/* + * NSSPKIXGeneralNames_FindGeneralName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXGeneralNames_FindGeneralName +( + NSSPKIXGeneralNames *generalNames, + NSSPKIXGeneralName *generalName +); + +/* + * NSSPKIXGeneralNames_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXGeneralNames_Equal +( + NSSPKIXGeneralNames *generalNames1, + NSSPKIXGeneralNames *generalNames2, + PRStatus *statusOpt +); + +/* + * NSSPKIXGeneralNames_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralNames * +NSSPKIXGeneralNames_Duplicate +( + NSSPKIXGeneralNames *generalNames, + NSSArena *arenaOpt +); + +/* + * AnotherName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AnotherName ::= SEQUENCE { + * type-id OBJECT IDENTIFIER, + * value [0] EXPLICIT ANY DEFINED BY type-id } + * + * The public calls for this type: + * + * NSSPKIXAnotherName_Decode + * NSSPKIXAnotherName_Create + * NSSPKIXAnotherName_Destroy + * NSSPKIXAnotherName_Encode + * NSSPKIXAnotherName_GetTypeId + * NSSPKIXAnotherName_SetTypeId + * NSSPKIXAnotherName_GetValue + * NSSPKIXAnotherName_SetValue + * NSSPKIXAnotherName_Equal + * NSSPKIXAnotherName_Duplicate + * + */ + +/* + * NSSPKIXAnotherName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAnotherName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAnotherName * +NSSPKIXAnotherName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXAnotherName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAnotherName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAnotherName * +NSSPKIXAnotherName_Create +( + NSSArena *arenaOpt, + NSSOID *typeId, + NSSItem *value +); + +/* + * NSSPKIXAnotherName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAnotherName_Destroy +( + NSSPKIXAnotherName *anotherName +); + +/* + * NSSPKIXAnotherName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXAnotherName_Encode +( + NSSPKIXAnotherName *anotherName, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAnotherName_GetTypeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSOID upon success + * NULL upon failure + */ + +NSS_EXTERN NSSOID * +NSSPKIXAnotherName_GetTypeId +( + NSSPKIXAnotherName *anotherName +); + +/* + * NSSPKIXAnotherName_SetTypeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_INVALID_OID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAnotherName_SetTypeId +( + NSSPKIXAnotherName *anotherName, + NSSOID *typeId +); + +/* + * NSSPKIXAnotherName_GetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +NSSPKIXAnotherName_GetValue +( + NSSPKIXAnotherName *anotherName, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAnotherName_SetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAnotherName_SetValue +( + NSSPKIXAnotherName *anotherName, + NSSItem *value +); + +/* + * NSSPKIXAnotherName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXAnotherName_Equal +( + NSSPKIXAnotherName *anotherName1, + NSSPKIXAnotherName *anotherName2, + PRStatus *statusOpt +); + +/* + * NSSPKIXAnotherName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAnotherName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAnotherName * +NSSPKIXAnotherName_Duplicate +( + NSSPKIXAnotherName *anotherName, + NSSArena *arenaOpt +); + +/* + * EDIPartyName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * + * EDIPartyName ::= SEQUENCE { + * nameAssigner [0] DirectoryString OPTIONAL, + * partyName [1] DirectoryString } + * + * The public calls for this type: + * + * NSSPKIXEDIPartyName_Decode + * NSSPKIXEDIPartyName_Create + * NSSPKIXEDIPartyName_Destroy + * NSSPKIXEDIPartyName_Encode + * NSSPKIXEDIPartyName_HasNameAssigner + * NSSPKIXEDIPartyName_GetNameAssigner + * NSSPKIXEDIPartyName_SetNameAssigner + * NSSPKIXEDIPartyName_RemoveNameAssigner + * NSSPKIXEDIPartyName_GetPartyName + * NSSPKIXEDIPartyName_SetPartyName + * NSSPKIXEDIPartyName_Equal + * NSSPKIXEDIPartyName_Duplicate + * + */ + +/* + * NSSPKIXEDIPartyName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXEDIPartyName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXEDIPartyName * +NSSPKIXEDIPartyName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXEDIPartyName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXEDIPartyName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXEDIPartyName * +NSSPKIXEDIPartyName_Create +( + NSSArena *arenaOpt, + NSSUTF8 *nameAssignerOpt, + NSSUTF8 *partyName +); + +/* + * NSSPKIXEDIPartyName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXEDIPartyName_Destroy +( + NSSPKIXEDIPartyName *ediPartyName +); + +/* + * NSSPKIXEDIPartyName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXEDIPartyName_Encode +( + NSSPKIXEDIPartyName *ediPartyName, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXEDIPartyName_HasNameAssigner + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXEDIPartyName_HasNameAssigner +( + NSSPKIXEDIPartyName *ediPartyName +); + +/* + * NSSPKIXEDIPartyName_GetNameAssigner + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_NAME_ASSIGNER + * + * Return value: + * A valid pointer to an NSSUTF8 string upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXEDIPartyName_GetNameAssigner +( + NSSPKIXEDIPartyName *ediPartyName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXEDIPartyName_SetNameAssigner + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXEDIPartyName_SetNameAssigner +( + NSSPKIXEDIPartyName *ediPartyName, + NSSUTF8 *nameAssigner +); + +/* + * NSSPKIXEDIPartyName_RemoveNameAssigner + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_HAS_NO_NAME_ASSIGNER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXEDIPartyName_RemoveNameAssigner +( + NSSPKIXEDIPartyName *ediPartyName +); + +/* + * NSSPKIXEDIPartyName_GetPartyName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 string upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +NSSPKIXEDIPartyName_GetPartyName +( + NSSPKIXEDIPartyName *ediPartyName, + NSSArena *arenaOpt +); + +/* + * NSSPKIXEDIPartyName_SetPartyName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXEDIPartyName_SetPartyName +( + NSSPKIXEDIPartyName *ediPartyName, + NSSUTF8 *partyName +); + +/* + * NSSPKIXEDIPartyName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXEDIPartyName_Equal +( + NSSPKIXEDIPartyName *ediPartyName1, + NSSPKIXEDIPartyName *ediPartyName2, + PRStatus *statusOpt +); + +/* + * NSSPKIXEDIPartyName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXEDIPartyName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXEDIPartyName * +NSSPKIXEDIPartyName_Duplicate +( + NSSPKIXEDIPartyName *ediPartyName, + NSSArena *arenaOpt +); + +/* + * SubjectDirectoryAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * SubjectDirectoryAttributes ::= SEQUENCE SIZE (1..MAX) OF Attribute + * + * The public calls for this type: + * + * NSSPKIXSubjectDirectoryAttributes_Decode + * NSSPKIXSubjectDirectoryAttributes_Create + * NSSPKIXSubjectDirectoryAttributes_Destroy + * NSSPKIXSubjectDirectoryAttributes_Encode + * NSSPKIXSubjectDirectoryAttributes_GetAttributeCount + * NSSPKIXSubjectDirectoryAttributes_GetAttributes + * NSSPKIXSubjectDirectoryAttributes_SetAttributes + * NSSPKIXSubjectDirectoryAttributes_GetAttribute + * NSSPKIXSubjectDirectoryAttributes_SetAttribute + * NSSPKIXSubjectDirectoryAttributes_InsertAttribute + * NSSPKIXSubjectDirectoryAttributes_AppendAttribute + * NSSPKIXSubjectDirectoryAttributes_RemoveAttribute + * NSSPKIXSubjectDirectoryAttributes_FindAttribute + * NSSPKIXSubjectDirectoryAttributes_Equal + * NSSPKIXSubjectDirectoryAttributes_Duplicate + * + */ + +/* + * NSSPKIXSubjectDirectoryAttributes_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXSubjectDirectoryAttributes upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectDirectoryAttributes * +NSSPKIXSubjectDirectoryAttributes_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXSubjectDirectoryAttributes_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXSubjectDirectoryAttributes upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectDirectoryAttributes * +NSSPKIXSubjectDirectoryAttributes_Create +( + NSSArena *arenaOpt, + NSSPKIXAttribute *attribute1, + ... +); + +/* + * NSSPKIXSubjectDirectoryAttributes_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXSubjectDirectoryAttributes_Destroy +( + NSSPKIXSubjectDirectoryAttributes *sda +); + +/* + * NSSPKIXSubjectDirectoryAttributes_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXSubjectDirectoryAttributes_Encode +( + NSSPKIXSubjectDirectoryAttributes *sda, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXSubjectDirectoryAttributes_GetAttributeCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXSubjectDirectoryAttributes_GetAttributeCount +( + NSSPKIXSubjectDirectoryAttributes *sda +); + +/* + * NSSPKIXSubjectDirectoryAttributes_GetAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXAttribute pointers upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttribute ** +NSSPKIXSubjectDirectoryAttributes_GetAttributes +( + NSSPKIXSubjectDirectoryAttributes *sda, + NSSPKIXAttribute *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXSubjectDirectoryAttributes_SetAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXSubjectDirectoryAttributes_SetAttributes +( + NSSPKIXSubjectDirectoryAttributes *sda, + NSSAttribute *attributes[], + PRInt32 count +); + +/* + * NSSPKIXSubjectDirectoryAttributes_GetAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon error + */ + +NSS_EXTERN NSSPKIXAttribute * +NSSPKIXSubjectDirectoryAttributes_GetAttribute +( + NSSPKIXSubjectDirectoryAttributes *sda, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXSubjectDirectoryAttributes_SetAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXSubjectDirectoryAttributes_SetAttribute +( + NSSPKIXSubjectDirectoryAttributes *sda, + PRInt32 i, + NSSPKIXAttribute *attribute +); + +/* + * NSSPKIXSubjectDirectoryAttributes_InsertAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXSubjectDirectoryAttributes_InsertAttribute +( + NSSPKIXSubjectDirectoryAttributes *sda, + PRInt32 i, + NSSPKIXAttribute *attribute +); + +/* + * NSSPKIXSubjectDirectoryAttributes_AppendAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXSubjectDirectoryAttributes_AppendAttribute +( + NSSPKIXSubjectDirectoryAttributes *sda, + NSSPKIXAttribute *attribute +); + +/* + * NSSPKIXSubjectDirectoryAttributes_RemoveAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXSubjectDirectoryAttributes_RemoveAttribute +( + NSSPKIXSubjectDirectoryAttributes *sda, + PRInt32 i +); + +/* + * NSSPKIXSubjectDirectoryAttributes_FindAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_ATTRIBUTE + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXSubjectDirectoryAttributes_FindAttribute +( + NSSPKIXSubjectDirectoryAttributes *sda, + NSSPKIXAttribute *attribute +); + +/* + * NSSPKIXSubjectDirectoryAttributes_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXSubjectDirectoryAttributes_Equal +( + NSSPKIXSubjectDirectoryAttributes *sda1, + NSSPKIXSubjectDirectoryAttributes *sda2, + PRStatus *statusOpt +); + +/* + * NSSPKIXSubjectDirectoryAttributes_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXSubjectDirectoryAttributes upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectDirectoryAttributes * +NSSPKIXSubjectDirectoryAttributes_Duplicate +( + NSSPKIXSubjectDirectoryAttributes *sda, + NSSArena *arenaOpt +); + +/* + * BasicConstraints + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BasicConstraints ::= SEQUENCE { + * cA BOOLEAN DEFAULT FALSE, + * pathLenConstraint INTEGER (0..MAX) OPTIONAL } + * + * The public calls for this type: + * + * NSSPKIXBasicConstraints_Decode + * NSSPKIXBasicConstraints_Create + * NSSPKIXBasicConstraints_Destroy + * NSSPKIXBasicConstraints_Encode + * NSSPKIXBasicConstraints_GetCA + * NSSPKIXBasicConstraints_SetCA + * NSSPKIXBasicConstraints_HasPathLenConstraint + * NSSPKIXBasicConstraints_GetPathLenConstraint + * NSSPKIXBasicConstraints_SetPathLenConstraint + * NSSPKIXBasicConstraints_RemovePathLenConstraint + * NSSPKIXBasicConstraints_Equal + * NSSPKIXBasicConstraints_Duplicate + * NSSPKIXBasicConstraints_CompareToPathLenConstraint + * + */ + +/* + * NSSPKIXBasicConstraints_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXBasicConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBasicConstraints * +NSSPKIXBasicConstraints_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXBasicConstraints_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * A valid pointer to an NSSPKIXBasicConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBasicConstraints * +NSSPKIXBasicConstraints_Create +( + NSSArena *arenaOpt, + PRBool ca, + PRInt32 pathLenConstraint +); + +/* + * NSSPKIXBasicConstraints_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBasicConstraints_Destroy +( + NSSPKIXBasicConstraints *basicConstraints +); + +/* + * NSSPKIXBasicConstraints_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXBasicConstraints_Encode +( + NSSPKIXBasicConstraints *basicConstraints, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBasicConstraints_GetCA + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * + * Return value: + * PR_TRUE if the CA bit is true + * PR_FALSE if it isn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXBasicConstraints_GetCA +( + NSSPKIXBasicConstraints *basicConstraints, + PRStatus *statusOpt +); + +/* + * NSSPKIXBasicConstraints_SetCA + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBasicConstraints_SetCA +( + NSSPKIXBasicConstraints *basicConstraints, + PRBool ca +); + +/* + * NSSPKIXBasicConstraints_HasPathLenConstraint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXBasicConstraints_HasPathLenConstraint +( + NSSPKIXBasicConstraints *basicConstraints, + PRStatus *statusOpt +); + +/* + * NSSPKIXBasicConstraints_GetPathLenConstraint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * NSS_ERROR_HAS_NO_PATH_LEN_CONSTRAINT + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXBasicConstraints_GetPathLenConstraint +( + NSSPKIXBasicConstraints *basicConstraints +); + +/* + * NSSPKIXBasicConstraints_SetPathLenConstraint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBasicConstraints_SetPathLenConstraint +( + NSSPKIXBasicConstraints *basicConstraints, + PRInt32 pathLenConstraint +); + +/* + * NSSPKIXBasicConstraints_RemovePathLenConstraint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * NSS_ERROR_HAS_NO_PATH_LEN_CONSTRAINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXBasicConstraints_RemovePathLenConstraint +( + NSSPKIXBasicConstraints *basicConstraints +); + +/* + * NSSPKIXBasicConstraints_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXBasicConstraints_Equal +( + NSSPKIXBasicConstraints *basicConstraints1, + NSSPKIXBasicConstraints *basicConstraints2, + PRStatus *statusOpt +); + +/* + * NSSPKIXBasicConstraints_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXBasicConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBasicConstraints * +NSSPKIXBasicConstraints_Duplicate +( + NSSPKIXBasicConstraints *basicConstraints, + NSSArena *arenaOpt +); + +/* + * NSSPKIXBasicConstraints_CompareToPathLenConstraint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * NSS_ERROR_HAS_NO_PATH_LEN_CONSTRAINT + * + * Return value: + * 1 if the specified value is greater than the pathLenConstraint + * 0 if the specified value equals the pathLenConstraint + * -1 if the specified value is less than the pathLenConstraint + * -2 upon error + */ + +NSS_EXTERN PRInt32 +NSSPKIXBasicConstraints_CompareToPathLenConstraint +( + NSSPKIXBasicConstraints *basicConstraints, + PRInt32 value +); + +/* + * NameConstraints + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NameConstraints ::= SEQUENCE { + * permittedSubtrees [0] GeneralSubtrees OPTIONAL, + * excludedSubtrees [1] GeneralSubtrees OPTIONAL } + * + * The public calls for this type: + * + * NSSPKIXNameConstraints_Decode + * NSSPKIXNameConstraints_Create + * NSSPKIXNameConstraints_Destroy + * NSSPKIXNameConstraints_Encode + * NSSPKIXNameConstraints_HasPermittedSubtrees + * NSSPKIXNameConstraints_GetPermittedSubtrees + * NSSPKIXNameConstraints_SetPermittedSubtrees + * NSSPKIXNameConstraints_RemovePermittedSubtrees + * NSSPKIXNameConstraints_HasExcludedSubtrees + * NSSPKIXNameConstraints_GetExcludedSubtrees + * NSSPKIXNameConstraints_SetExcludedSubtrees + * NSSPKIXNameConstraints_RemoveExcludedSubtrees + * NSSPKIXNameConstraints_Equal + * NSSPKIXNameConstraints_Duplicate + * { and the comparator functions } + * + */ + +/* + * NSSPKIXNameConstraints_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNameConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNameConstraints * +NSSPKIXNameConstraints_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXNameConstraints_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * + * Return value: + * A valid pointer to an NSSPKIXNameConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNameConstraints * +NSSPKIXNameConstraints_Create +( + NSSArena *arenaOpt, + NSSPKIXGeneralSubtrees *permittedSubtrees, + NSSPKIXGeneralSubtrees *excludedSubtrees +); + +/* + * NSSPKIXNameConstraints_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXNameConstraints_Destroy +( + NSSPKIXNameConstraints *nameConstraints +); + +/* + * NSSPKIXNameConstraints_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXNameConstraints_Encode +( + NSSPKIXNameConstraints *nameConstraints, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXNameConstraints_HasPermittedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXNameConstraints_HasPermittedSubtrees +( + NSSPKIXNameConstraints *nameConstraints, + PRStatus *statusOpt +); + +/* + * NSSPKIXNameConstraints_GetPermittedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_HAS_NO_PERMITTED_SUBTREES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtrees upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtrees * +NSSPKIXNameConstraints_GetPermittedSubtrees +( + NSSPKIXNameConstraints *nameConstraints, + NSSArena *arenaOpt +); + +/* + * NSSPKIXNameConstraints_SetPermittedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXNameConstraints_SetPermittedSubtrees +( + NSSPKIXNameConstraints *nameConstraints, + NSSPKIXGeneralSubtrees *permittedSubtrees +); + +/* + * NSSPKIXNameConstraints_RemovePermittedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_HAS_NO_PERMITTED_SUBTREES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXNameConstraints_RemovePermittedSubtrees +( + NSSPKIXNameConstraints *nameConstraints +); + +/* + * NSSPKIXNameConstraints_HasExcludedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXNameConstraints_HasExcludedSubtrees +( + NSSPKIXNameConstraints *nameConstraints, + PRStatus *statusOpt +); + +/* + * NSSPKIXNameConstraints_GetExcludedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_HAS_NO_EXCLUDED_SUBTREES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtrees upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtrees * +NSSPKIXNameConstraints_GetExcludedSubtrees +( + NSSPKIXNameConstraints *nameConstraints, + NSSArena *arenaOpt +); + +/* + * NSSPKIXNameConstraints_SetExcludedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXNameConstraints_SetExcludedSubtrees +( + NSSPKIXNameConstraints *nameConstraints, + NSSPKIXGeneralSubtrees *excludedSubtrees +); + +/* + * NSSPKIXNameConstraints_RemoveExcludedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_HAS_NO_EXCLUDED_SUBTREES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXNameConstraints_RemoveExcludedSubtrees +( + NSSPKIXNameConstraints *nameConstraints +); + +/* + * NSSPKIXNameConstraints_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXNameConstraints_Equal +( + NSSPKIXNameConstraints *nameConstraints1, + NSSPKIXNameConstraints *nameConstraints2, + PRStatus *statusOpt +); + +/* + * NSSPKIXNameConstraints_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXNameConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNameConstraints * +NSSPKIXNameConstraints_Duplicate +( + NSSPKIXNameConstraints *nameConstraints, + NSSArena *arenaOpt +); + +/* + * { and the comparator functions } + * + */ + +/* + * GeneralSubtrees + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree + * + * The public calls for this type: + * + * NSSPKIXGeneralSubtrees_Decode + * NSSPKIXGeneralSubtrees_Create + * NSSPKIXGeneralSubtrees_Destroy + * NSSPKIXGeneralSubtrees_Encode + * NSSPKIXGeneralSubtrees_GetGeneralSubtreeCount + * NSSPKIXGeneralSubtrees_GetGeneralSubtrees + * NSSPKIXGeneralSubtrees_SetGeneralSubtrees + * NSSPKIXGeneralSubtrees_GetGeneralSubtree + * NSSPKIXGeneralSubtrees_SetGeneralSubtree + * NSSPKIXGeneralSubtrees_InsertGeneralSubtree + * NSSPKIXGeneralSubtrees_AppendGeneralSubtree + * NSSPKIXGeneralSubtrees_RemoveGeneralSubtree + * NSSPKIXGeneralSubtrees_FindGeneralSubtree + * NSSPKIXGeneralSubtrees_Equal + * NSSPKIXGeneralSubtrees_Duplicate + * { and finders and comparators } + * + */ + +/* + * NSSPKIXGeneralSubtrees_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtrees upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtrees * +NSSPKIXGeneralSubtrees_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXGeneralSubtrees_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtrees upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtrees * +NSSPKIXGeneralSubtrees_Create +( + NSSArena *arenaOpt, + NSSPKIXGeneralSubtree *generalSubtree1, + ... +); + +/* + * NSSPKIXGeneralSubtrees_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralSubtrees_Destroy +( + NSSPKIXGeneralSubtrees *generalSubtrees +); + +/* + * NSSPKIXGeneralSubtrees_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXGeneralSubtrees_Encode +( + NSSPKIXGeneralSubtrees *generalSubtrees, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralSubtrees_GetGeneralSubtreeCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXGeneralSubtrees_GetGeneralSubtreeCount +( + NSSPKIXGeneralSubtrees *generalSubtrees +); + +/* + * NSSPKIXGeneralSubtrees_GetGeneralSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXGeneralSubtree pointers upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtree ** +NSSPKIXGeneralSubtrees_GetGeneralSubtrees +( + NSSPKIXGeneralSubtrees *generalSubtrees, + NSSPKIXGeneralSubtree *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralSubtrees_SetGeneralSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralSubtrees_SetGeneralSubtrees +( + NSSPKIXGeneralSubtrees *generalSubtrees, + NSSPKIXGeneralSubtree *generalSubtree[], + PRInt32 count +); + +/* + * NSSPKIXGeneralSubtrees_GetGeneralSubtree + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtree upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtree * +NSSPKIXGeneralSubtrees_GetGeneralSubtree +( + NSSPKIXGeneralSubtrees *generalSubtrees, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralSubtrees_SetGeneralSubtree + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralSubtrees_SetGeneralSubtree +( + NSSPKIXGeneralSubtrees *generalSubtrees, + PRInt32 i, + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * NSSPKIXGeneralSubtrees_InsertGeneralSubtree + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralSubtrees_InsertGeneralSubtree +( + NSSPKIXGeneralSubtrees *generalSubtrees, + PRInt32 i, + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * NSSPKIXGeneralSubtrees_AppendGeneralSubtree + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralSubtrees_AppendGeneralSubtree +( + NSSPKIXGeneralSubtrees *generalSubtrees, + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * NSSPKIXGeneralSubtrees_RemoveGeneralSubtree + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralSubtrees_RemoveGeneralSubtree +( + NSSPKIXGeneralSubtrees *generalSubtrees, + PRInt32 i +); + +/* + * NSSPKIXGeneralSubtrees_FindGeneralSubtree + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXGeneralSubtrees_FindGeneralSubtree +( + NSSPKIXGeneralSubtrees *generalSubtrees, + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * NSSPKIXGeneralSubtrees_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXGeneralSubtrees_Equal +( + NSSPKIXGeneralSubtrees *generalSubtrees1, + NSSPKIXGeneralSubtrees *generalSubtrees2, + PRStatus *statusOpt +); + +/* + * NSSPKIXGeneralSubtrees_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtrees upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtrees * +NSSPKIXGeneralSubtrees_Duplicate +( + NSSPKIXGeneralSubtrees *generalSubtrees, + NSSArena *arenaOpt +); + +/* + * { and finders and comparators } + * + */ + +/* + * GeneralSubtree + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * GeneralSubtree ::= SEQUENCE { + * base GeneralName, + * minimum [0] BaseDistance DEFAULT 0, + * maximum [1] BaseDistance OPTIONAL } + * + * The public calls for this type: + * + * NSSPKIXGeneralSubtree_Decode + * NSSPKIXGeneralSubtree_Create + * NSSPKIXGeneralSubtree_Destroy + * NSSPKIXGeneralSubtree_Encode + * NSSPKIXGeneralSubtree_GetBase + * NSSPKIXGeneralSubtree_SetBase + * NSSPKIXGeneralSubtree_GetMinimum + * NSSPKIXGeneralSubtree_SetMinimum + * NSSPKIXGeneralSubtree_HasMaximum + * NSSPKIXGeneralSubtree_GetMaximum + * NSSPKIXGeneralSubtree_SetMaximum + * NSSPKIXGeneralSubtree_RemoveMaximum + * NSSPKIXGeneralSubtree_Equal + * NSSPKIXGeneralSubtree_Duplicate + * NSSPKIXGeneralSubtree_DistanceInRange + * {other tests and comparators} + * + */ + +/* + * NSSPKIXGeneralSubtree_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtree upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtree * +NSSPKIXGeneralSubtree_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXGeneralSubtree_Create + * + * -- fgmr comments -- + * The optional maximum value may be omitted by specifying -1. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtree upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtree * +NSSPKIXGeneralSubtree_Create +( + NSSArena *arenaOpt, + NSSPKIXBaseDistance minimum, + NSSPKIXBaseDistance maximumOpt +); + +/* + * NSSPKIXGeneralSubtree_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralSubtree_Destroy +( + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * NSSPKIXGeneralSubtree_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXGeneralSubtree_Encode +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralSubtree_GetBase + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXGeneralSubtree_GetBase +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralSubtree_SetBase + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralSubtree_SetBase +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSPKIXGeneralName *base +); + +/* + * NSSPKIXGeneralSubtree_GetMinimum + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN NSSPKIXBaseDistance +NSSPKIXGeneralSubtree_GetMinimum +( + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * NSSPKIXGeneralSubtree_SetMinimum + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralSubtree_SetMinimum +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSPKIXBaseDistance *minimum +); + +/* + * NSSPKIXGeneralSubtree_HasMaximum + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXGeneralSubtree_HasMaximum +( + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * NSSPKIXGeneralSubtree_GetMaximum + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_HAS_NO_MAXIMUM_BASE_DISTANCE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN NSSPKIXBaseDistance +NSSPKIXGeneralSubtree_GetMaximum +( + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * NSSPKIXGeneralSubtree_SetMaximum + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralSubtree_SetMaximum +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSPKIXBaseDistance *maximum +); + +/* + * NSSPKIXGeneralSubtree_RemoveMaximum + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_HAS_NO_MAXIMUM_BASE_DISTANCE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXGeneralSubtree_RemoveMaximum +( + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * NSSPKIXGeneralSubtree_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXGeneralSubtree_Equal +( + NSSPKIXGeneralSubtree *generalSubtree1, + NSSPKIXGeneralSubtree *generalSubtree2, + PRStatus *statusOpt +); + +/* + * NSSPKIXGeneralSubtree_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtree upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtree * +NSSPKIXGeneralSubtree_Duplicate +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSArena *arenaOpt +); + +/* + * NSSPKIXGeneralSubtree_DistanceInRange + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * PR_TRUE if the specified value is within the minimum and maximum + * base distances + * PR_FALSE if it isn't + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXGeneralSubtree_DistanceInRange +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSPKIXBaseDistance value, + PRStatus *statusOpt +); + +/* + * {other tests and comparators} + * + */ + +/* + * PolicyConstraints + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyConstraints ::= SEQUENCE { + * requireExplicitPolicy [0] SkipCerts OPTIONAL, + * inhibitPolicyMapping [1] SkipCerts OPTIONAL } + * + * The public calls for this type: + * + * NSSPKIXPolicyConstraints_Decode + * NSSPKIXPolicyConstraints_Create + * NSSPKIXPolicyConstraints_Destroy + * NSSPKIXPolicyConstraints_Encode + * NSSPKIXPolicyConstraints_HasRequireExplicitPolicy + * NSSPKIXPolicyConstraints_GetRequireExplicitPolicy + * NSSPKIXPolicyConstraints_SetRequireExplicitPolicy + * NSSPKIXPolicyConstraints_RemoveRequireExplicitPolicy + * NSSPKIXPolicyConstraints_HasInhibitPolicyMapping + * NSSPKIXPolicyConstraints_GetInhibitPolicyMapping + * NSSPKIXPolicyConstraints_SetInhibitPolicyMapping + * NSSPKIXPolicyConstraints_RemoveInhibitPolicyMapping + * NSSPKIXPolicyConstraints_Equal + * NSSPKIXPolicyConstraints_Duplicate + * + */ + +/* + * NSSPKIXPolicyConstraints_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyConstraints * +NSSPKIXPolicyConstraints_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXPolicyConstraints_Create + * + * -- fgmr comments -- + * The optional values may be omitted by specifying -1. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * A valid pointer to an NSSPKIXPolicyConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyConstraints * +NSSPKIXPolicyConstraints_Create +( + NSSArena *arenaOpt, + NSSPKIXSkipCerts requireExplicitPolicy, + NSSPKIXSkipCerts inhibitPolicyMapping +); + +/* + * NSSPKIXPolicyConstraints_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyConstraints_Destroy +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * NSSPKIXPolicyConstraints_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXPolicyConstraints_Encode +( + NSSPKIXPolicyConstraints *policyConstraints, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXPolicyConstraints_HasRequireExplicitPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXPolicyConstraints_HasRequireExplicitPolicy +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * NSSPKIXPolicyConstraints_GetRequireExplicitPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_HAS_NO_REQUIRE_EXPLICIT_POLICY + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXPolicyConstraints_GetRequireExplicitPolicy +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * NSSPKIXPolicyConstraints_SetRequireExplicitPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyConstraints_SetRequireExplicitPolicy +( + NSSPKIXPolicyConstraints *policyConstraints, + NSSPKIXSkipCerts requireExplicitPolicy +); + +/* + * NSSPKIXPolicyConstraints_RemoveRequireExplicitPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_HAS_NO_REQUIRE_EXPLICIT_POLICY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyConstraints_RemoveRequireExplicitPolicy +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * NSSPKIXPolicyConstraints_HasInhibitPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXPolicyConstraints_HasInhibitPolicyMapping +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * NSSPKIXPolicyConstraints_GetInhibitPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_HAS_NO_INHIBIT_POLICY_MAPPING + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXPolicyConstraints_GetInhibitPolicyMapping +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * NSSPKIXPolicyConstraints_SetInhibitPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyConstraints_SetInhibitPolicyMapping +( + NSSPKIXPolicyConstraints *policyConstraints, + NSSPKIXSkipCerts inhibitPolicyMapping +); + +/* + * NSSPKIXPolicyConstraints_RemoveInhibitPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_HAS_NO_INHIBIT_POLICY_MAPPING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXPolicyConstraints_RemoveInhibitPolicyMapping +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * NSSPKIXPolicyConstraints_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXPolicyConstraints_Equal +( + NSSPKIXPolicyConstraints *policyConstraints1, + NSSPKIXPolicyConstraints *policyConstraints2, + PRStatus *statusOpt +); + +/* + * NSSPKIXPolicyConstraints_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyConstraints * +NSSPKIXPolicyConstraints_Duplicate +( + NSSPKIXPolicyConstraints *policyConstraints, + NSSArena *arenaOpt +); + +/* + * CRLDistPointsSyntax + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CRLDistPointsSyntax ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint + * + * The public calls for this type: + * + * NSSPKIXCRLDistPointsSyntax_Decode + * NSSPKIXCRLDistPointsSyntax_Create + * NSSPKIXCRLDistPointsSyntax_Destroy + * NSSPKIXCRLDistPointsSyntax_Encode + * NSSPKIXCRLDistPointsSyntax_GetDistributionPointCount + * NSSPKIXCRLDistPointsSyntax_GetDistributionPoints + * NSSPKIXCRLDistPointsSyntax_SetDistributionPoints + * NSSPKIXCRLDistPointsSyntax_GetDistributionPoint + * NSSPKIXCRLDistPointsSyntax_SetDistributionPoint + * NSSPKIXCRLDistPointsSyntax_InsertDistributionPoint + * NSSPKIXCRLDistPointsSyntax_AppendDistributionPoint + * NSSPKIXCRLDistPointsSyntax_RemoveDistributionPoint + * NSSPKIXCRLDistPointsSyntax_FindDistributionPoint + * NSSPKIXCRLDistPointsSyntax_Equal + * NSSPKIXCRLDistPointsSyntax_Duplicate + * + */ + +/* + * NSSPKIXCRLDistPointsSyntax_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCRLDistPointsSyntax upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCRLDistPointsSyntax * +NSSPKIXCRLDistPointsSyntax_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXCRLDistPointsSyntax_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * A valid pointer to an NSSPKIXCRLDistPointsSyntax upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCRLDistPointsSyntax * +NSSPKIXCRLDistPointsSyntax_Create +( + NSSArena *arenaOpt, + NSSPKIXDistributionPoint *distributionPoint1, + ... +); + +/* + * NSSPKIXCRLDistPointsSyntax_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCRLDistPointsSyntax_Destroy +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax +); + +/* + * NSSPKIXCRLDistPointsSyntax_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXCRLDistPointsSyntax_Encode +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCRLDistPointsSyntax_GetDistributionPointCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXCRLDistPointsSyntax_GetDistributionPointCount +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax +); + +/* + * NSSPKIXCRLDistPointsSyntax_GetDistributionPoints + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXDistributionPoint pointers + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPoints ** +NSSPKIXCRLDistPointsSyntax_GetDistributionPoints +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSDistributionPoint *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCRLDistPointsSyntax_SetDistributionPoints + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCRLDistPointsSyntax_SetDistributionPoints +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSDistributionPoint *distributionPoint[] + PRInt32 count +); + +/* + * NSSPKIXCRLDistPointsSyntax_GetDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPoint * +NSSPKIXCRLDistPointsSyntax_GetDistributionPoint +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSArena *arenaOpt +); + +/* + * NSSPKIXCRLDistPointsSyntax_SetDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCRLDistPointsSyntax_SetDistributionPoint +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + PRInt32 i, + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * NSSPKIXCRLDistPointsSyntax_InsertDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCRLDistPointsSyntax_InsertDistributionPoint +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + PRInt32 i, + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * NSSPKIXCRLDistPointsSyntax_AppendDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCRLDistPointsSyntax_AppendDistributionPoint +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * NSSPKIXCRLDistPointsSyntax_RemoveDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXCRLDistPointsSyntax_RemoveDistributionPoint +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + PRInt32 i +); + +/* + * NSSPKIXCRLDistPointsSyntax_FindDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXCRLDistPointsSyntax_FindDistributionPoint +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * NSSPKIXCRLDistPointsSyntax_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXCRLDistPointsSyntax_Equal +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax1, + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax2, + PRStatus *statusOpt +); + +/* + * NSSPKIXCRLDistPointsSyntax_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCRLDistPointsSyntax upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCRLDistPointsSyntax * +NSSPKIXCRLDistPointsSyntax_Duplicate +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSArena *arenaOpt +); + +/* + * DistributionPoint + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DistributionPoint ::= SEQUENCE { + * distributionPoint [0] DistributionPointName OPTIONAL, + * reasons [1] ReasonFlags OPTIONAL, + * cRLIssuer [2] GeneralNames OPTIONAL } + * + * The public calls for this type: + * + * NSSPKIXDistributionPoint_Decode + * NSSPKIXDistributionPoint_Create + * NSSPKIXDistributionPoint_Destroy + * NSSPKIXDistributionPoint_Encode + * NSSPKIXDistributionPoint_HasDistributionPoint + * NSSPKIXDistributionPoint_GetDistributionPoint + * NSSPKIXDistributionPoint_SetDistributionPoint + * NSSPKIXDistributionPoint_RemoveDistributionPoint + * NSSPKIXDistributionPoint_HasReasons + * NSSPKIXDistributionPoint_GetReasons + * NSSPKIXDistributionPoint_SetReasons + * NSSPKIXDistributionPoint_RemoveReasons + * NSSPKIXDistributionPoint_HasCRLIssuer + * NSSPKIXDistributionPoint_GetCRLIssuer + * NSSPKIXDistributionPoint_SetCRLIssuer + * NSSPKIXDistributionPoint_RemoveCRLIssuer + * NSSPKIXDistributionPoint_Equal + * NSSPKIXDistributionPoint_Duplicate + * + */ + +/* + * NSSPKIXDistributionPoint_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPoint * +NSSPKIXDistributionPoint_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXDistributionPoint_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPoint * +NSSPKIXDistributionPoint_Create +( + NSSArena *arenaOpt, + NSSPKIXDistributionPointName *distributionPoint, + NSSPKIXReasonFlags reasons, + NSSPKIXGeneralNames *cRLIssuer +); + +/* + * NSSPKIXDistributionPoint_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXDistributionPoint_Destroy +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * NSSPKIXDistributionPoint_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXDistributionPoint_Encode +( + NSSPKIXDistributionPoint *distributionPoint, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXDistributionPoint_HasDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXDistributionPoint_HasDistributionPoint +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * NSSPKIXDistributionPoint_GetDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +NSSPKIXDistributionPoint_GetDistributionPoint +( + NSSPKIXDistributionPoint *distributionPoint, + NSSArena *arenaOpt +); + +/* + * NSSPKIXDistributionPoint_SetDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXDistributionPoint_SetDistributionPoint +( + NSSPKIXDistributionPoint *distributionPoint, + NSSPKIXDistributionPointName *name +); + +/* + * NSSPKIXDistributionPoint_RemoveDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXDistributionPoint_RemoveDistributionPoint +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * NSSPKIXDistributionPoint_HasReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXDistributionPoint_HasReasons +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * NSSPKIXDistributionPoint_GetReasons + * + * It is unlikely that the reason flags are all zero; so zero is + * returned in error situations. + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_REASONS + * + * Return value: + * A valid nonzero NSSPKIXReasonFlags value upon success + * A valid zero NSSPKIXReasonFlags if the value is indeed zero + * Zero upon error + */ + +NSS_EXTERN NSSPKIXReasonFlags +NSSPKIXDistributionPoint_GetReasons +( + NSSPKIXDistributionPoint *distributionPoint, + PRStatus *statusOpt +); + +/* + * NSSPKIXDistributionPoint_SetReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXDistributionPoint_SetReasons +( + NSSPKIXDistributionPoint *distributionPoint, + NSSPKIXReasonFlags reasons +); + +/* + * NSSPKIXDistributionPoint_RemoveReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_REASONS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXDistributionPoint_RemoveReasons +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * NSSPKIXDistributionPoint_HasCRLIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXDistributionPoint_HasCRLIssuer +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * NSSPKIXDistributionPoint_GetCRLIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_CRL_ISSUER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralNames * +NSSPKIXDistributionPoint_GetCRLIssuer +( + NSSPKIXDistributionPoint *distributionPoint, + NSSArena *arenaOpt +); + +/* + * NSSPKIXDistributionPoint_SetCRLIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXDistributionPoint_SetCRLIssuer +( + NSSPKIXDistributionPoint *distributionPoint, + NSSPKIXGeneralNames *cRLIssuer +); + +/* + * NSSPKIXDistributionPoint_RemoveCRLIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_CRL_ISSUER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXDistributionPoint_RemoveCRLIssuer +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * NSSPKIXDistributionPoint_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXDistributionPoint_Equal +( + NSSPKIXDistributionPoint *distributionPoint1, + NSSPKIXDistributionPoint *distributionPoint2, + PRStatus *statusOpt +); + +/* + * NSSPKIXDistributionPoint_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPoint * +NSSPKIXDistributionPoint_Duplicate +( + NSSPKIXDistributionPoint *distributionPoint, + NSSArena *arenaOpt +); + +/* + * DistributionPointName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DistributionPointName ::= CHOICE { + * fullName [0] GeneralNames, + * nameRelativeToCRLIssuer [1] RelativeDistinguishedName } + * + * The public calls for this type: + * + * NSSPKIXDistributionPointName_Decode + * NSSPKIXDistributionPointName_Create + * NSSPKIXDistributionPointName_CreateFromFullName + * NSSPKIXDistributionPointName_CreateFromNameRelativeToCRLIssuer + * NSSPKIXDistributionPointName_Destroy + * NSSPKIXDistributionPointName_Encode + * NSSPKIXDistributionPointName_GetChoice + * NSSPKIXDistributionPointName_GetFullName + * NSSPKIXDistributionPointName_GetNameRelativeToCRLIssuer + * NSSPKIXDistributionPointName_Equal + * NSSPKIXDistributionPointName_Duplicate + * + */ + +/* + * NSSPKIXDistributionPointName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +NSSPKIXDistributionPointName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXDistributionPointName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME_CHOICE + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_PKIX_RELATIVE_DISTINGUISHED_NAME + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +NSSPKIXDistributionPointName_Create +( + NSSArena *arenaOpt, + NSSPKIXDistributionPointNameChoice which, + void *name +); + +/* + * NSSPKIXDistributionPointName_CreateFromFullName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +NSSPKIXDistributionPointName_CreateFromFullName +( + NSSArena *arenaOpt, + NSSPKIXGeneralNames *fullName +); + +/* + * NSSPKIXDistributionPointName_CreateFromNameRelativeToCRLIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RELATIVE_DISTINGUISHED_NAME + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +NSSPKIXDistributionPointName_CreateFromNameRelativeToCRLIssuer +( + NSSArena *arenaOpt, + NSSPKIXRelativeDistinguishedName *nameRelativeToCRLIssuer +); + +/* + * NSSPKIXDistributionPointName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXDistributionPointName_Destroy +( + NSSPKIXDistributionPointName *dpn +); + +/* + * NSSPKIXDistributionPointName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXDistributionPointName_Encode +( + NSSPKIXDistributionPointName *dpn, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXDistributionPointName_GetChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * + * Return value: + * A valid NSSPKIXDistributionPointNameChoice value upon success + * NSSPKIXDistributionPointNameChoice_NSSinvalid upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointNameChoice +NSSPKIXDistributionPointName_GetChoice +( + NSSPKIXDistributionPointName *dpn +); + +/* + * NSSPKIXDistributionPointName_GetFullName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralnames * +NSSPKIXDistributionPointName_GetFullName +( + NSSPKIXDistributionPointName *dpn, + NSSArena *arenaOpt +); + +/* + * NSSPKIXDistributionPointName_GetNameRelativeToCRLIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +NSSPKIXDistributionPointName_GetNameRelativeToCRLIssuer +( + NSSPKIXDistributionPointName *dpn, + NSSArena *arenaOpt +); + +/* + * NSSPKIXDistributionPointName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXDistributionPointName_Equal +( + NSSPKIXDistributionPointName *dpn1, + NSSPKIXDistributionPointName *dpn2, + PRStatus *statusOpt +); + +/* + * NSSPKIXDistributionPointName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +NSSPKIXDistributionPointName_Duplicate +( + NSSPKIXDistributionPointName *dpn, + NSSArena *arenaOpt +); + +/* + * ReasonFlags + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ReasonFlags ::= BIT STRING { + * unused (0), + * keyCompromise (1), + * cACompromise (2), + * affiliationChanged (3), + * superseded (4), + * cessationOfOperation (5), + * certificateHold (6) } + * + * The public calls for this type: + * + * NSSPKIXReasonFlags_Decode + * NSSPKIXReasonFlags_Create + * NSSPKIXReasonFlags_CreateFromMask + * NSSPKIXReasonFlags_Destroy + * NSSPKIXReasonFlags_Encode + * NSSPKIXReasonFlags_GetMask + * NSSPKIXReasonFlags_SetMask + * NSSPKIXReasonFlags_Equal + * NSSPKIXReasonFlags_Duplicate + * { bitwise accessors? } + * + */ + +/* + * NSSPKIXReasonFlags_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXReasonFlags upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXReasonFlags * +NSSPKIXReasonFlags_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXReasonFlags_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXReasonFlags upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXReasonFlags * +NSSPKIXReasonFlags_Create +( + NSSArena *arenaOpt, + PRBool keyCompromise, + PRBool cACompromise, + PRBool affiliationChanged, + PRBool superseded, + PRBool cessationOfOperation, + PRBool certificateHold +); + +/* + * NSSPKIXReasonFlags_CreateFromMask + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS_MASK + * + * Return value: + * A valid pointer to an NSSPKIXReasonFlags upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXReasonFlags * +NSSPKIXReasonFlags_CreateFromMask +( + NSSArena *arenaOpt, + NSSPKIXReasonFlagsMask why +); + +/* + * NSSPKIXReasonFlags_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXReasonFlags_Destroy +( + NSSPKIXReasonFlags *reasonFlags +); + +/* + * NSSPKIXReasonFlags_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXReasonFlags_Encode +( + NSSPKIXReasonFlags *reasonFlags, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXReasonFlags_GetMask + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * + * Return value: + * A valid mask of NSSPKIXReasonFlagsMask values upon success + * NSSPKIXReasonFlagsMask_NSSinvalid upon failure + */ + +NSS_EXTERN NSSPKIXReasonFlagsMask +NSSPKIXReasonFlags_GetMask +( + NSSPKIXReasonFlags *reasonFlags +); + +/* + * NSSPKIXReasonFlags_SetMask + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS_MASK + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXReasonFlags_SetMask +( + NSSPKIXReasonFlags *reasonFlags, + NSSPKIXReasonFlagsMask mask +); + +/* + * NSSPKIXReasonFlags_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXReasonFlags_Equal +( + NSSPKIXReasonFlags *reasonFlags1, + NSSPKIXReasonFlags *reasonFlags2, + PRStatus *statusOpt +); + +/* + * NSSPKIXReasonFlags_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXReasonFlags upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXReasonFlags * +NSSPKIXReasonFlags_Duplicate +( + NSSPKIXReasonFlags *reasonFlags, + NSSArena *arenaOpt +); + +/* + * { bitwise accessors? } + * + */ + +/* + * ExtKeyUsageSyntax + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId + * + * The public calls for this type: + * + * NSSPKIXExtKeyUsageSyntax_Decode + * NSSPKIXExtKeyUsageSyntax_Create + * NSSPKIXExtKeyUsageSyntax_Destroy + * NSSPKIXExtKeyUsageSyntax_Encode + * NSSPKIXExtKeyUsageSyntax_GetKeyPurposeIdCount + * NSSPKIXExtKeyUsageSyntax_GetKeyPurposeIds + * NSSPKIXExtKeyUsageSyntax_SetKeyPurposeIds + * NSSPKIXExtKeyUsageSyntax_GetKeyPurposeId + * NSSPKIXExtKeyUsageSyntax_SetKeyPurposeId + * NSSPKIXExtKeyUsageSyntax_InsertKeyPurposeId + * NSSPKIXExtKeyUsageSyntax_AppendKeyPurposeId + * NSSPKIXExtKeyUsageSyntax_RemoveKeyPurposeId + * NSSPKIXExtKeyUsageSyntax_FindKeyPurposeId + * NSSPKIXExtKeyUsageSyntax_Equal + * NSSPKIXExtKeyUsageSyntax_Duplicate + * + */ + +/* + * NSSPKIXExtKeyUsageSyntax_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtKeyUsageSyntax upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtKeyUsageSyntax * +NSSPKIXExtKeyUsageSyntax_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXExtKeyUsageSyntax_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_KEY_PURPOSE_ID + * + * Return value: + * A valid pointer to an NSSPKIXExtKeyUsageSyntax upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtKeyUsageSyntax * +NSSPKIXExtKeyUsageSyntax_Create +( + NSSArena *arenaOpt, + NSSPKIXKeyPurposeId *kpid1, + ... +); + +/* + * NSSPKIXExtKeyUsageSyntax_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtKeyUsageSyntax_Destroy +( + NSSPKIXExtKeyUsageSyntax *eku +); + +/* + * NSSPKIXExtKeyUsageSyntax_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXExtKeyUsageSyntax_Encode +( + NSSPKIXExtKeyUsageSyntax *eku, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXExtKeyUsageSyntax_GetKeyPurposeIdCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXExtKeyUsageSyntax_GetKeyPurposeIdCount +( + NSSPKIXExtKeyUsageSyntax *eku +); + +/* + * NSSPKIXExtKeyUsageSyntax_GetKeyPurposeIds + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXKeyPurposeId pointers upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXKeyPurposeId ** +NSSPKIXExtKeyUsageSyntax_GetKeyPurposeIds +( + NSSPKIXExtKeyUsageSyntax *eku, + NSSPKIXKeyPurposeId *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXExtKeyUsageSyntax_SetKeyPurposeIds + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_PKIX_KEY_PURPOSE_ID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtKeyUsageSyntax_SetKeyPurposeIds +( + NSSPKIXExtKeyUsageSyntax *eku, + NSSPKIXKeyPurposeId *ids[], + PRInt32 count +); + +/* + * NSSPKIXExtKeyUsageSyntax_GetKeyPurposeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXKeyPurposeId upon success + * NULL upon error + */ + +NSS_EXTERN NSSPKIXKeyPurposeId * +NSSPKIXExtKeyUsageSyntax_GetKeyPurposeId +( + NSSPKIXExtKeyUsageSyntax *eku, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXExtKeyUsageSyntax_SetKeyPurposeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_PKIX_KEY_PURPOSE_ID + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtKeyUsageSyntax_SetKeyPurposeId +( + NSSPKIXExtKeyUsageSyntax *eku, + PRInt32 i, + NSSPKIXKeyPurposeId *id +); + +/* + * NSSPKIXExtKeyUsageSyntax_InsertKeyPurposeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_PKIX_KEY_PURPOSE_ID + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtKeyUsageSyntax_InsertKeyPurposeId +( + NSSPKIXExtKeyUsageSyntax *eku, + PRInt32 i, + NSSPKIXKeyPurposeId *id +); + +/* + * NSSPKIXExtKeyUsageSyntax_AppendKeyPurposeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_PKIX_KEY_PURPOSE_ID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtKeyUsageSyntax_AppendKeyPurposeId +( + NSSPKIXExtKeyUsageSyntax *eku, + NSSPKIXKeyPurposeId *id +); + +/* + * NSSPKIXExtKeyUsageSyntax_RemoveKeyPurposeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXExtKeyUsageSyntax_RemoveKeyPurposeId +( + NSSPKIXExtKeyUsageSyntax *eku, + PRInt32 i +); + +/* + * NSSPKIXExtKeyUsageSyntax_FindKeyPurposeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_PKIX_KEY_PURPOSE_ID + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified key purpose id upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXExtKeyUsageSyntax_FindKeyPurposeId +( + NSSPKIXExtKeyUsageSyntax *eku, + NSSPKIXKeyPurposeId *id +); + +/* + * NSSPKIXExtKeyUsageSyntax_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXExtKeyUsageSyntax_Equal +( + NSSPKIXExtKeyUsageSyntax *eku1, + NSSPKIXExtKeyUsageSyntax *eku2, + PRStatus *statusOpt +); + +/* + * NSSPKIXExtKeyUsageSyntax_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXExtKeyUsageSyntax upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtKeyUsageSyntax * +NSSPKIXExtKeyUsageSyntax_Duplicate +( + NSSPKIXExtKeyUsageSyntax *eku, + NSSArena *arenaOpt +); + +/* + * AuthorityInfoAccessSyntax + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AuthorityInfoAccessSyntax ::= + * SEQUENCE SIZE (1..MAX) OF AccessDescription + * + * The public calls for this type: + * + * NSSPKIXAuthorityInfoAccessSyntax_Decode + * NSSPKIXAuthorityInfoAccessSyntax_Create + * NSSPKIXAuthorityInfoAccessSyntax_Destroy + * NSSPKIXAuthorityInfoAccessSyntax_Encode + * NSSPKIXAuthorityInfoAccessSyntax_GetAccessDescriptionCount + * NSSPKIXAuthorityInfoAccessSyntax_GetAccessDescriptions + * NSSPKIXAuthorityInfoAccessSyntax_SetAccessDescriptions + * NSSPKIXAuthorityInfoAccessSyntax_GetAccessDescription + * NSSPKIXAuthorityInfoAccessSyntax_SetAccessDescription + * NSSPKIXAuthorityInfoAccessSyntax_InsertAccessDescription + * NSSPKIXAuthorityInfoAccessSyntax_AppendAccessDescription + * NSSPKIXAuthorityInfoAccessSyntax_RemoveAccessDescription + * NSSPKIXAuthorityInfoAccessSyntax_FindAccessDescription + * NSSPKIXAuthorityInfoAccessSyntax_Equal + * NSSPKIXAuthorityInfoAccessSyntax_Duplicate + * + */ + +/* + * NSSPKIXAuthorityInfoAccessSyntax_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAuthorityInfoAccessSyntax upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAuthorityInfoAccessSyntax * +NSSPKIXAuthorityInfoAccessSyntax_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * + * Return value: + * A valid pointer to an NSSPKIXAuthorityInfoAccessSyntax upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAuthorityInfoAccessSyntax * +NSSPKIXAuthorityInfoAccessSyntax_Create +( + NSSArena *arenaOpt, + NSSPKIXAccessDescription *ad1, + ... +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAuthorityInfoAccessSyntax_Destroy +( + NSSPKIXAuthorityInfoAccessSyntax *aias +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXAuthorityInfoAccessSyntax_Encode +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_GetAccessDescriptionCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXAuthorityInfoAccessSyntax_GetAccessDescriptionCount +( + NSSPKIXAuthorityInfoAccessSyntax *aias +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_GetAccessDescriptions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXAccessDescription pointers + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAccessDescription ** +NSSPKIXAuthorityInfoAccessSyntax_GetAccessDescriptions +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + NSSPKIXAccessDescription *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_SetAccessDescriptions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAuthorityInfoAccessSyntax_SetAccessDescriptions +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + NSSPKIXAccessDescription *ad[], + PRInt32 count +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_GetAccessDescription + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAccessDescription upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAccessDescription * +NSSPKIXAuthorityInfoAccessSyntax_GetAccessDescription +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_SetAccessDescription + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAuthorityInfoAccessSyntax_SetAccessDescription +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + PRInt32 i, + NSSPKIXAccessDescription *ad +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_InsertAccessDescription + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAuthorityInfoAccessSyntax_InsertAccessDescription +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + PRInt32 i, + NSSPKIXAccessDescription *ad +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_AppendAccessDescription + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAuthorityInfoAccessSyntax_AppendAccessDescription +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + NSSPKIXAccessDescription *ad +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_RemoveAccessDescription + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAuthorityInfoAccessSyntax_RemoveAccessDescription +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + PRInt32 i +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_FindAccessDescription + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXAuthorityInfoAccessSyntax_FindAccessDescription +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + NSSPKIXAccessDescription *ad +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXAuthorityInfoAccessSyntax_Equal +( + NSSPKIXAuthorityInfoAccessSyntax *aias1, + NSSPKIXAuthorityInfoAccessSyntax *aias2, + PRStatus *statusOpt +); + +/* + * NSSPKIXAuthorityInfoAccessSyntax_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAuthorityInfoAccessSyntax upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAuthorityInfoAccessSyntax * +NSSPKIXAuthorityInfoAccessSyntax_Duplicate +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + NSSArena *arenaOpt +); + +/* + * AccessDescription + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AccessDescription ::= SEQUENCE { + * accessMethod OBJECT IDENTIFIER, + * accessLocation GeneralName } + * + * The public calls for this type: + * + * NSSPKIXAccessDescription_Decode + * NSSPKIXAccessDescription_Create + * NSSPKIXAccessDescription_Destroy + * NSSPKIXAccessDescription_Encode + * NSSPKIXAccessDescription_GetAccessMethod + * NSSPKIXAccessDescription_SetAccessMethod + * NSSPKIXAccessDescription_GetAccessLocation + * NSSPKIXAccessDescription_SetAccessLocation + * NSSPKIXAccessDescription_Equal + * NSSPKIXAccessDescription_Duplicate + * + */ + +/* + * NSSPKIXAccessDescription_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAccessDescription upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAccessDescription * +NSSPKIXAccessDescription_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXAccessDescription_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * + * Return value: + * A valid pointer to an NSSPKIXAccessDescription upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAccessDescription * +NSSPKIXAccessDescription_Create +( + NSSArena *arenaOpt, + NSSOID *accessMethod, + NSSPKIXGeneralName *accessLocation +); + +/* + * NSSPKIXAccessDescription_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAccessDescription_Destroy +( + NSSPKIXAccessDescription *ad +); + +/* + * NSSPKIXAccessDescription_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXAccessDescription_Encode +( + NSSPKIXAccessDescription *ad, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAccessDescription_GetAccessMethod + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSOID pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSOID * +NSSPKIXAccessDescription_GetAccessMethod +( + NSSPKIXAccessDescription *ad +); + +/* + * NSSPKIXAccessDescription_SetAccessMethod + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_INVALID_OID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAccessDescription_SetAccessMethod +( + NSSPKIXAccessDescription *ad, + NSSOID *accessMethod +); + +/* + * NSSPKIXAccessDescription_GetAccessLocation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +NSSPKIXAccessDescription_GetAccessLocation +( + NSSPKIXAccessDescription *ad, + NSSArena *arenaOpt +); + +/* + * NSSPKIXAccessDescription_SetAccessLocation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAccessDescription_SetAccessLocation +( + NSSPKIXAccessDescription *ad, + NSSPKIXGeneralName *accessLocation +); + +/* + * NSSPKIXAccessDescription_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXAccessDescription_Equal +( + NSSPKIXAccessDescription *ad1, + NSSPKIXAccessDescription *ad2, + PRStatus *statusOpt +); + +/* + * NSSPKIXAccessDescription_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAccessDescription upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAccessDescription * +NSSPKIXAccessDescription_Duplicate +( + NSSPKIXAccessDescription *ad, + NSSArena *arenaOpt +); + +/* + * IssuingDistributionPoint + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * IssuingDistributionPoint ::= SEQUENCE { + * distributionPoint [0] DistributionPointName OPTIONAL, + * onlyContainsUserCerts [1] BOOLEAN DEFAULT FALSE, + * onlyContainsCACerts [2] BOOLEAN DEFAULT FALSE, + * onlySomeReasons [3] ReasonFlags OPTIONAL, + * indirectCRL [4] BOOLEAN DEFAULT FALSE } + * + * The public calls for this type: + * + * NSSPKIXIssuingDistributionPoint_Decode + * NSSPKIXIssuingDistributionPoint_Create + * NSSPKIXIssuingDistributionPoint_Destroy + * NSSPKIXIssuingDistributionPoint_Encode + * NSSPKIXIssuingDistributionPoint_HasDistributionPoint + * NSSPKIXIssuingDistributionPoint_GetDistributionPoint + * NSSPKIXIssuingDistributionPoint_SetDistributionPoint + * NSSPKIXIssuingDistributionPoint_RemoveDistributionPoint + * NSSPKIXIssuingDistributionPoint_GetOnlyContainsUserCerts + * NSSPKIXIssuingDistributionPoint_SetOnlyContainsUserCerts + * NSSPKIXIssuingDistributionPoint_GetOnlyContainsCACerts + * NSSPKIXIssuingDistributionPoint_SetOnlyContainsCACerts + * NSSPKIXIssuingDistributionPoint_HasOnlySomeReasons + * NSSPKIXIssuingDistributionPoint_GetOnlySomeReasons + * NSSPKIXIssuingDistributionPoint_SetOnlySomeReasons + * NSSPKIXIssuingDistributionPoint_RemoveOnlySomeReasons + * NSSPKIXIssuingDistributionPoint_GetIndirectCRL + * NSSPKIXIssuingDistributionPoint_SetIndirectCRL + * NSSPKIXIssuingDistributionPoint_Equal + * NSSPKIXIssuingDistributionPoint_Duplicate + * + */ + +/* + * NSSPKIXIssuingDistributionPoint_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXIssuingDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXIssuingDistributionPoint * +NSSPKIXIssuingDistributionPoint_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * NSSPKIXIssuingDistributionPoint_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * + * Return value: + * A valid pointer to an NSSPKIXIssuingDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXIssuingDistributionPoint * +NSSPKIXIssuingDistributionPoint_Create +( + NSSArena *arenaOpt, + NSSPKIXDistributionPointName *distributionPointOpt, + PRBool onlyContainsUserCerts, + PRBool onlyContainsCACerts, + NSSPKIXReasonFlags *onlySomeReasons + PRBool indirectCRL +); + +/* + * NSSPKIXIssuingDistributionPoint_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXIssuingDistributionPoint_Destroy +( + NSSPKIXIssuingDistributionPoint *idp +); + +/* + * NSSPKIXIssuingDistributionPoint_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +NSSPKIXIssuingDistributionPoint_Encode +( + NSSPKIXIssuingDistributionPoint *idp, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NSSPKIXIssuingDistributionPoint_HasDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXIssuingDistributionPoint_HasDistributionPoint +( + NSSPKIXIssuingDistributionPoint *idp +); + +/* + * NSSPKIXIssuingDistributionPoint_GetDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +NSSPKIXIssuingDistributionPoint_GetDistributionPoint +( + NSSPKIXIssuingDistributionPoint *idp, + NSSArena *arenaOpt +); + +/* + * NSSPKIXIssuingDistributionPoint_SetDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXIssuingDistributionPoint_SetDistributionPoint +( + NSSPKIXIssuingDistributionPoint *idp, + NSSPKIXDistributionPointName *dpn +); + +/* + * NSSPKIXIssuingDistributionPoint_RemoveDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXIssuingDistributionPoint_RemoveDistributionPoint +( + NSSPKIXIssuingDistributionPoint *idp +); + +/* + * NSSPKIXIssuingDistributionPoint_GetOnlyContainsUserCerts + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if the onlyContainsUserCerts value is true + * PR_FALSE if it isn't + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXIssuingDistributionPoint_GetOnlyContainsUserCerts +( + NSSPKIXIssuingDistributionPoint *idp, + PRStatus *statusOpt +); + +/* + * NSSPKIXIssuingDistributionPoint_SetOnlyContainsUserCerts + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXIssuingDistributionPoint_SetOnlyContainsUserCerts +( + NSSPKIXIssuingDistributionPoint *idp, + PRBool onlyContainsUserCerts +); + +/* + * NSSPKIXIssuingDistributionPoint_GetOnlyContainsCACerts + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if the onlyContainsCACerts value is true + * PR_FALSE if it isn't + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXIssuingDistributionPoint_GetOnlyContainsCACerts +( + NSSPKIXIssuingDistributionPoint *idp, + PRStatus *statusOpt +); + +/* + * NSSPKIXIssuingDistributionPoint_SetOnlyContainsCACerts + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXIssuingDistributionPoint_SetOnlyContainsCACerts +( + NSSPKIXIssuingDistributionPoint *idp, + PRBool onlyContainsCACerts +); + +/* + * NSSPKIXIssuingDistributionPoint_HasOnlySomeReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +NSSPKIXIssuingDistributionPoint_HasOnlySomeReasons +( + NSSPKIXIssuingDistributionPoint *idp +); + +/* + * NSSPKIXIssuingDistributionPoint_GetOnlySomeReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_ONLY_SOME_REASONS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXReasonFlags upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXReasonFlags * +NSSPKIXIssuingDistributionPoint_GetOnlySomeReasons +( + NSSPKIXIssuingDistributionPoint *idp, + NSSArena *arenaOpt +); + +/* + * NSSPKIXIssuingDistributionPoint_SetOnlySomeReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXIssuingDistributionPoint_SetOnlySomeReasons +( + NSSPKIXIssuingDistributionPoint *idp, + NSSPKIXReasonFlags *onlySomeReasons +); + +/* + * NSSPKIXIssuingDistributionPoint_RemoveOnlySomeReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_ONLY_SOME_REASONS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXIssuingDistributionPoint_RemoveOnlySomeReasons +( + NSSPKIXIssuingDistributionPoint *idp +); + +/* + * NSSPKIXIssuingDistributionPoint_GetIndirectCRL + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if the indirectCRL value is true + * PR_FALSE if it isn't + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXIssuingDistributionPoint_GetIndirectCRL +( + NSSPKIXIssuingDistributionPoint *idp, + PRStatus *statusOpt +); + +/* + * NSSPKIXIssuingDistributionPoint_SetIndirectCRL + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXIssuingDistributionPoint_SetIndirectCRL +( + NSSPKIXIssuingDistributionPoint *idp, + PRBool indirectCRL +); + +/* + * NSSPKIXIssuingDistributionPoint_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXIssuingDistributionPoint_Equal +( + NSSPKIXIssuingDistributionPoint *idp1, + NSSPKIXIssuingDistributionPoint *idp2, + PRStatus *statusOpt +); + +/* + * NSSPKIXIssuingDistributionPoint_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXIssuingDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXIssuingDistributionPoint * +NSSPKIXIssuingDistributionPoint_Duplicate +( + NSSPKIXIssuingDistributionPoint *idp, + NSSArena *arenaOpt +); + +PR_END_EXTERN_C + +#endif /* NSSPKIX_H */ diff --git a/security/nss/lib/pkix/include/nsspkixt.h b/security/nss/lib/pkix/include/nsspkixt.h new file mode 100644 index 000000000..ea35269ff --- /dev/null +++ b/security/nss/lib/pkix/include/nsspkixt.h @@ -0,0 +1,2281 @@ +/* + * 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 NSSPKIXT_H +#define NSSPKIXT_H + +#ifdef DEBUG +static const char NSSPKIXT_CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +/* + * nsspkixt.h + * + * This file contains the public type definitions for the PKIX part-1 + * objects. The contents are strongly based on the types defined in + * RFC 2459 {fgmr: and others, e.g., s/mime?}. The type names have + * been prefixed with "NSSPKIX." + */ + +#ifndef NSSBASET_H +#include "nssbaset.h" +#endif /* NSSBASET_H */ + +PR_BEGIN_EXTERN_C + +/* + * A Note About Strings + * + * RFC 2459 refers to several types of strings, including UniversalString, + * BMPString, UTF8String, TeletexString, PrintableString, IA5String, and + * more. As with the rest of the NSS libraries, all strings are converted + * to UTF8 form as soon as possible, and dealt with in that form from + * then on. + * + */ + +/* + * Attribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Attribute ::= SEQUENCE { + * type AttributeType, + * values SET OF AttributeValue + * -- at least one value is required -- } + * + */ + +struct NSSPKIXAttributeStr; +typedef struct NSSPKIXAttributeStr NSSPKIXAttribute; + +/* + * AttributeType + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AttributeType ::= OBJECT IDENTIFIER + * + */ + +typedef NSSOID NSSPKIXAttributeType; + +/* + * AttributeValue + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AttributeValue ::= ANY + * + */ + +typedef NSSItem NSSPKIXAttributeValue; + +/* + * AttributeTypeAndValue + * + * This structure contains an attribute type (indicated by an OID), + * and the type-specific value. RelativeDistinguishedNamess consist + * of a set of these. These are distinct from Attributes (which have + * SET of values), from AttributeDescriptions (which have qualifiers + * on the types), and from AttributeValueAssertions (which assert a + * a value comparison under some matching rule). + * + * From RFC 2459: + * + * AttributeTypeAndValue ::= SEQUENCE { + * type AttributeType, + * value AttributeValue } + * + */ + +struct NSSPKIXAttributeTypeAndValueStr; +typedef struct NSSPKIXAttributeTypeAndValueStr NSSPKIXAttributeTypeAndValue; + +/* + * X520Name + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520name ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-name)), + * printableString PrintableString (SIZE (1..ub-name)), + * universalString UniversalString (SIZE (1..ub-name)), + * utf8String UTF8String (SIZE (1..ub-name)), + * bmpString BMPString (SIZE(1..ub-name)) } + * + */ + +struct NSSPKIXX520NameStr; +typedef struct NSSPKIXX520NameStr NSSPKIXX520Name; + +/* + * X520CommonName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520CommonName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-common-name)), + * printableString PrintableString (SIZE (1..ub-common-name)), + * universalString UniversalString (SIZE (1..ub-common-name)), + * utf8String UTF8String (SIZE (1..ub-common-name)), + * bmpString BMPString (SIZE(1..ub-common-name)) } + * + */ + +struct NSSPKIXX520CommonNameStr; +typedef struct NSSPKIXX520CommonNameStr NSSPKIXX520CommonName; + +/* + * X520LocalityName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520LocalityName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-locality-name)), + * printableString PrintableString (SIZE (1..ub-locality-name)), + * universalString UniversalString (SIZE (1..ub-locality-name)), + * utf8String UTF8String (SIZE (1..ub-locality-name)), + * bmpString BMPString (SIZE(1..ub-locality-name)) } + * + */ + +struct NSSPKIXX520LocalityNameStr; +typedef struct NSSPKIXX520LocalityNameStr NSSPKIXX520LocalityName; + +/* + * X520StateOrProvinceName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520StateOrProvinceName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-state-name)), + * printableString PrintableString (SIZE (1..ub-state-name)), + * universalString UniversalString (SIZE (1..ub-state-name)), + * utf8String UTF8String (SIZE (1..ub-state-name)), + * bmpString BMPString (SIZE(1..ub-state-name)) } + * + */ + +struct NSSPKIXX520StateOrProvinceNameStr; +typedef struct NSSPKIXX520StateOrProvinceNameStr NSSPKIXX520StateOrProvinceName; + +/* + * X520OrganizationName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520OrganizationName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-organization-name)), + * printableString PrintableString (SIZE (1..ub-organization-name)), + * universalString UniversalString (SIZE (1..ub-organization-name)), + * utf8String UTF8String (SIZE (1..ub-organization-name)), + * bmpString BMPString (SIZE(1..ub-organization-name)) } + * + */ + +struct NSSPKIXX520OrganizationNameStr; +typedef struct NSSPKIXX520OrganizationNameStr NSSPKIXX520OrganizationName; + +/* + * X520OrganizationalUnitName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520OrganizationalUnitName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-organizational-unit-name)), + * printableString PrintableString + * (SIZE (1..ub-organizational-unit-name)), + * universalString UniversalString + * (SIZE (1..ub-organizational-unit-name)), + * utf8String UTF8String (SIZE (1..ub-organizational-unit-name)), + * bmpString BMPString (SIZE(1..ub-organizational-unit-name)) } + * + */ + +struct NSSPKIXX520OrganizationalUnitNameStr; +typedef struct NSSPKIXX520OrganizationalUnitNameStr NSSPKIXX520OrganizationalUnitName; + +/* + * X520Title + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520Title ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-title)), + * printableString PrintableString (SIZE (1..ub-title)), + * universalString UniversalString (SIZE (1..ub-title)), + * utf8String UTF8String (SIZE (1..ub-title)), + * bmpString BMPString (SIZE(1..ub-title)) } + * + */ + +struct NSSPKIXX520TitleStr; +typedef struct NSSPKIXX520TitleStr NSSPKIXX520Title; + +/* + * X520dnQualifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520dnQualifier ::= PrintableString + * + */ + +struct NSSPKIXX520dnQualifierStr; +typedef struct NSSPKIXX520dnQualifierStr NSSPKIXX520dnQualifier; + +/* + * X520countryName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520countryName ::= PrintableString (SIZE (2)) -- IS 3166 codes + * + */ + +struct NSSPKIXX520countryNameStr; +typedef struct NSSPKIXX520countryNameStr NSSPKIXX520countryName; + +/* + * Pkcs9email + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Pkcs9email ::= IA5String (SIZE (1..ub-emailaddress-length)) + * + */ + +struct NSSPKIXPkcs9emailStr; +typedef struct NSSPKIXPkcs9emailStr NSSPKIXPkcs9email; + +/* + * Name + * + * This structure contains a union of the possible name formats, + * which at the moment is limited to an RDNSequence. + * + * From RFC 2459: + * + * Name ::= CHOICE { -- only one possibility for now -- + * rdnSequence RDNSequence } + * + */ + +struct NSSPKIXNameStr; +typedef struct NSSPKIXNameStr NSSPKIXName; + +/* + * NameChoice + * + * This enumeration is used to specify choice within a name. + */ + +enum NSSPKIXNameChoiceEnum { + NSSPKIXNameChoice_NSSinvalid = -1, + NSSPKIXNameChoice_rdnSequence +}; +typedef enum NSSPKIXNameChoiceEnum NSSPKIXNameChoice; + +/* + * RDNSequence + * + * This structure contains a sequence of RelativeDistinguishedName + * objects. + * + * From RFC 2459: + * + * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName + * + */ + +struct NSSPKIXRDNSequenceStr; +typedef struct NSSPKIXRDNSequenceStr NSSPKIXRDNSequence; + +/* + * DistinguishedName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DistinguishedName ::= RDNSequence + * + */ + +typedef NSSPKIXRDNSequence NSSPKIXDistinguishedName; + +/* + * RelativeDistinguishedName + * + * This structure contains an unordered set of AttributeTypeAndValue + * objects. RDNs are used to distinguish a set of objects underneath + * a common object. + * + * Often, a single ATAV is sufficient to make a unique distinction. + * For example, if a company assigns its people unique uid values, + * then in the Name "uid=smith,ou=People,o=Acme,c=US" the "uid=smith" + * ATAV by itself forms an RDN. However, sometimes a set of ATAVs is + * needed. For example, if a company needed to distinguish between + * two Smiths by specifying their corporate divisions, then in the + * Name "(cn=Smith,ou=Sales),ou=People,o=Acme,c=US" the parenthesised + * set of ATAVs forms the RDN. + * + * From RFC 2459: + * + * RelativeDistinguishedName ::= + * SET SIZE (1 .. MAX) OF AttributeTypeAndValue + * + */ + +struct NSSPKIXRelativeDistinguishedNameStr; +typedef struct NSSPKIXRelativeDistinguishedNameStr NSSPKIXRelativeDistinguishedName; + +/* + * DirectoryString + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DirectoryString ::= CHOICE { + * teletexString TeletexString (SIZE (1..MAX)), + * printableString PrintableString (SIZE (1..MAX)), + * universalString UniversalString (SIZE (1..MAX)), + * utf8String UTF8String (SIZE (1..MAX)), + * bmpString BMPString (SIZE(1..MAX)) } + * + */ + +struct NSSPKIXDirectoryStringStr; +typedef struct NSSPKIXDirectoryStringStr NSSPKIXDirectoryString; + +/* + * Certificate + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Certificate ::= SEQUENCE { + * tbsCertificate TBSCertificate, + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING } + * + */ + +struct NSSPKIXCertificateStr; +typedef struct NSSPKIXCertificateStr NSSPKIXCertificate; + +/* + * TBSCertificate + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TBSCertificate ::= SEQUENCE { + * version [0] Version DEFAULT v1, + * serialNumber CertificateSerialNumber, + * signature AlgorithmIdentifier, + * issuer Name, + * validity Validity, + * subject Name, + * subjectPublicKeyInfo SubjectPublicKeyInfo, + * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, + * -- If present, version shall be v2 or v3 + * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, + * -- If present, version shall be v2 or v3 + * extensions [3] Extensions OPTIONAL + * -- If present, version shall be v3 -- } + * + */ + +struct NSSPKIXTBSCertificateStr; +typedef struct NSSPKIXTBSCertificateStr NSSPKIXTBSCertificate; + +/* + * Version + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Version ::= INTEGER { v1(0), v2(1), v3(2) } + * + */ + +enum NSSPKIXVersionEnum { + NSSPKIXVersion_NSSinvalid = -1, + NSSPKIXVersion_v1 = 0, + NSSPKIXVersion_v2 = 1, + NSSPKIXVersion_v3 = 2 +}; +typedef enum NSSPKIXVersionEnum NSSPKIXVersion; + +/* + * CertificateSerialNumber + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CertificateSerialNumber ::= INTEGER + * + */ + +typedef NSSBER NSSPKIXCertificateSerialNumber; + +/* + * Validity + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Validity ::= SEQUENCE { + * notBefore Time, + * notAfter Time } + * + */ + +struct NSSPKIXValidityStr; +typedef struct NSSPKIXValidityStr NSSPKIXValidity; + +/* + * Time + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Time ::= CHOICE { + * utcTime UTCTime, + * generalTime GeneralizedTime } + * + */ + +struct NSSPKIXTimeStr; +typedef struct NSSPKIXTimeStr NSSPKIXTime; + +/* + * UniqueIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * UniqueIdentifier ::= BIT STRING + * + */ + +typedef NSSBitString NSSPKIXUniqueIdentifier; + +/* + * SubjectPublicKeyInfo + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * SubjectPublicKeyInfo ::= SEQUENCE { + * algorithm AlgorithmIdentifier, + * subjectPublicKey BIT STRING } + * + */ + +struct NSSPKIXSubjectPublicKeyInfoStr; +typedef NSSPKIXSubjectPublicKeyInfoStr NSSPKIXSubjectPublicKeyInfo; + +/* + * Extensions + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension + * + */ + +struct NSSPKIXExtensionsStr; +typedef struct NSSPKIXExtensionsStr NSSPKIXExtensions; + +/* + * Extension + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Extension ::= SEQUENCE { + * extnID OBJECT IDENTIFIER, + * critical BOOLEAN DEFAULT FALSE, + * extnValue OCTET STRING } + * + */ + +struct NSSPKIXExtensionStr; +typedef struct NSSPKIXExtensionStr NSSPKIXExtension; + +/* + * CertificateList + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CertificateList ::= SEQUENCE { + * tbsCertList TBSCertList, + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING } + * + */ + +struct NSSPKIXCertificateListStr; +typedef struct NSSPKIXCertificateListStr NSSPKIXCertificateList; + +/* + * TBSCertList + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TBSCertList ::= SEQUENCE { + * version Version OPTIONAL, + * -- if present, shall be v2 + * signature AlgorithmIdentifier, + * issuer Name, + * thisUpdate Time, + * nextUpdate Time OPTIONAL, + * revokedCertificates SEQUENCE OF SEQUENCE { + * userCertificate CertificateSerialNumber, + * revocationDate Time, + * crlEntryExtensions Extensions OPTIONAL + * -- if present, shall be v2 + * } OPTIONAL, + * crlExtensions [0] Extensions OPTIONAL + * -- if present, shall be v2 -- } + * + */ + +struct NSSPKIXTBSCertListStr; +typedef struct NSSPKIXTBSCertListStr NSSPKIXTBSCertList; + +/* + * revokedCertificates + * + * This is a "helper type" to simplify handling of TBSCertList objects. + * + * revokedCertificates SEQUENCE OF SEQUENCE { + * userCertificate CertificateSerialNumber, + * revocationDate Time, + * crlEntryExtensions Extensions OPTIONAL + * -- if present, shall be v2 + * } OPTIONAL, + * + */ + +struct NSSPKIXrevokedCertificatesStr; +typedef struct NSSPKIXrevokedCertificatesStr NSSPKIXrevokedCertificates; + +/* + * revokedCertificate + * + * This is a "helper type" to simplify handling of TBSCertList objects. + * + * SEQUENCE { + * userCertificate CertificateSerialNumber, + * revocationDate Time, + * crlEntryExtensions Extensions OPTIONAL + * -- if present, shall be v2 + * } OPTIONAL, + * + */ + +struct NSSPKIXrevokedCertificateStr; +typedef struct NSSPKIXrevokedCertificateStr NSSPKIXrevokedCertificate; + +/* + * AlgorithmIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * (1988 syntax) + * + * AlgorithmIdentifier ::= SEQUENCE { + * algorithm OBJECT IDENTIFIER, + * parameters ANY DEFINED BY algorithm OPTIONAL } + * -- contains a value of the type + * -- registered for use with the + * -- algorithm object identifier value + * + * + */ + +struct NSSPKIXAlgorithmIdentifierStr; +typedef NSSPKIXAlgorithmIdentifierStr NSSPKIXAlgorithmIdentifier; + +/* + * -- types related to NSSPKIXAlgorithmIdentifiers: + * + * Dss-Sig-Value ::= SEQUENCE { + * r INTEGER, + * s INTEGER } + * + * DomainParameters ::= SEQUENCE { + * p INTEGER, -- odd prime, p=jq +1 + * g INTEGER, -- generator, g + * q INTEGER, -- factor of p-1 + * j INTEGER OPTIONAL, -- subgroup factor, j>= 2 + * validationParms ValidationParms OPTIONAL } + * + * ValidationParms ::= SEQUENCE { + * seed BIT STRING, + * pgenCounter INTEGER } + * + * Dss-Parms ::= SEQUENCE { + * p INTEGER, + * q INTEGER, + * g INTEGER } + * + */ + +/* + * ORAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ORAddress ::= SEQUENCE { + * built-in-standard-attributes BuiltInStandardAttributes, + * built-in-domain-defined-attributes + * BuiltInDomainDefinedAttributes OPTIONAL, + * -- see also teletex-domain-defined-attributes + * extension-attributes ExtensionAttributes OPTIONAL } + * -- The OR-address is semantically absent from the OR-name if the + * -- built-in-standard-attribute sequence is empty and the + * -- built-in-domain-defined-attributes and extension-attributes are + * -- both omitted. + * + */ + +struct NSSPKIXORAddressStr; +typedef struct NSSPKIXORAddressStr NSSPKIXORAddress; + +/* + * BuiltInStandardAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BuiltInStandardAttributes ::= SEQUENCE { + * country-name CountryName OPTIONAL, + * administration-domain-name AdministrationDomainName OPTIONAL, + * network-address [0] NetworkAddress OPTIONAL, + * -- see also extended-network-address + * terminal-identifier [1] TerminalIdentifier OPTIONAL, + * private-domain-name [2] PrivateDomainName OPTIONAL, + * organization-name [3] OrganizationName OPTIONAL, + * -- see also teletex-organization-name + * numeric-user-identifier [4] NumericUserIdentifier OPTIONAL, + * personal-name [5] PersonalName OPTIONAL, + * -- see also teletex-personal-name + * organizational-unit-names [6] OrganizationalUnitNames OPTIONAL + * -- see also teletex-organizational-unit-names -- } + * + */ + +struct NSSPKIXBuiltInStandardAttributesStr; +typedef struct NSSPKIXBuiltInStandardAttributesStr NSSPKIXBuiltInStandardAttributes; + +/* + * CountryName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CountryName ::= [APPLICATION 1] CHOICE { + * x121-dcc-code NumericString + * (SIZE (ub-country-name-numeric-length)), + * iso-3166-alpha2-code PrintableString + * (SIZE (ub-country-name-alpha-length)) } + * + */ + +struct NSSPKIXCountryNameStr; +typedef struct NSSPKIXCountryNameStr NSSPKIXCountryName; + +/* + * AdministrationDomainName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AdministrationDomainName ::= [APPLICATION 2] CHOICE { + * numeric NumericString (SIZE (0..ub-domain-name-length)), + * printable PrintableString (SIZE (0..ub-domain-name-length)) } + * + */ + +struct NSSPKIXAdministrationDomainNameStr; +typedef struct NSSPKIXAdministrationDomainNameStr NSSPKIXAdministrationDomainName; + +/* + * X121Address + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X121Address ::= NumericString (SIZE (1..ub-x121-address-length)) + * + */ + +struct NSSPKIXX121AddressStr; +typedef struct NSSPKIXX121AddressStr NSSPKIXX121Address; + +/* + * NetworkAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NetworkAddress ::= X121Address -- see also extended-network-address + * + */ + +struct NSSPKIXNetworkAddressStr; +typedef struct NSSPKIXNetworkAddressStr NSSPKIXNetworkAddress; + +/* + * TerminalIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TerminalIdentifier ::= PrintableString (SIZE (1..ub-terminal-id-length)) + * + */ + +struct NSSPKIXTerminalIdentifierStr; +typedef struct NSSPKIXTerminalIdentifierStr NSSPKIXTerminalIdentifier; + +/* + * PrivateDomainName + * + * -- fgmr comments -- + * + * PrivateDomainName ::= CHOICE { + * numeric NumericString (SIZE (1..ub-domain-name-length)), + * printable PrintableString (SIZE (1..ub-domain-name-length)) } + * + */ + +struct NSSPKIXPrivateDomainNameStr; +typedef struct NSSPKIXPrivateDomainNameStr NSSPKIXPrivateDomainName; + +/* + * OrganizationName + * + * -- fgmr comments -- + * + * OrganizationName ::= PrintableString + * (SIZE (1..ub-organization-name-length)) + * + */ + +struct NSSPKIXOrganizationNameStr; +typedef struct NSSPKIXOrganizationNameStr NSSPKIXOrganizationName; + +/* + * NumericUserIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NumericUserIdentifier ::= NumericString + * (SIZE (1..ub-numeric-user-id-length)) + * + */ + +struct NSSPKIXNumericUserIdentifierStr; +typedef struct NSSPKIXNumericUserIdentifierStr NSSPKIXNumericUserIdentifier; + +/* + * PersonalName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PersonalName ::= SET { + * surname [0] PrintableString (SIZE (1..ub-surname-length)), + * given-name [1] PrintableString + * (SIZE (1..ub-given-name-length)) OPTIONAL, + * initials [2] PrintableString (SIZE (1..ub-initials-length)) OPTIONAL, + * generation-qualifier [3] PrintableString + * (SIZE (1..ub-generation-qualifier-length)) OPTIONAL } + * + */ + +struct NSSPKIXPersonalNameStr; +typedef NSSPKIXPersonalNameStr NSSPKIXPersonalName; + +/* + * OrganizationalUnitNames + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * OrganizationalUnitNames ::= SEQUENCE SIZE (1..ub-organizational-units) + * OF OrganizationalUnitName + * + */ + +struct NSSPKIXOrganizationalUnitNamesStr; +typedef NSSPKIXOrganizationalUnitNamesStr NSSPKIXOrganizationalUnitNames; + +/* + * OrganizationalUnitName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * OrganizationalUnitName ::= PrintableString (SIZE + * (1..ub-organizational-unit-name-length)) + * + */ + +struct NSSPKIXOrganizationalUnitNameStr; +typedef struct NSSPKIXOrganizationalUnitNameStr NSSPKIXOrganizationalUnitName; + +/* + * BuiltInDomainDefinedAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BuiltInDomainDefinedAttributes ::= SEQUENCE SIZE + * (1..ub-domain-defined-attributes) OF + * BuiltInDomainDefinedAttribute + * + */ + +struct NSSPKIXBuiltInDomainDefinedAttributesStr; +typedef struct NSSPKIXBuiltInDomainDefinedAttributesStr NSSPKIXBuiltInDomainDefinedAttributes; + +/* + * BuiltInDomainDefinedAttribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BuiltInDomainDefinedAttribute ::= SEQUENCE { + * type PrintableString (SIZE + * (1..ub-domain-defined-attribute-type-length)), + * value PrintableString (SIZE + * (1..ub-domain-defined-attribute-value-length))} + * + */ + +struct NSSPKIXBuiltInDomainDefinedAttributeStr; +typedef struct NSSPKIXBuiltInDomainDefinedAttributeStr NSSPKIXBuiltInDomainDefinedAttribute; + +/* + * ExtensionAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtensionAttributes ::= SET SIZE (1..ub-extension-attributes) OF + * ExtensionAttribute + * + */ + +struct NSSPKIXExtensionAttributesStr; +typedef struct NSSPKIXExtensionAttributesStr NSSPKIXExtensionAttributes; + +/* + * ExtensionAttribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtensionAttribute ::= SEQUENCE { + * extension-attribute-type [0] INTEGER (0..ub-extension-attributes), + * extension-attribute-value [1] + * ANY DEFINED BY extension-attribute-type } + * + */ + +struct NSSPKIXExtensionAttributeStr; +typedef struct NSSPKIXExtensionAttributeStr NSSPKIXExtensionAttribute; + +/* + * ExtensionAttributeType + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * common-name INTEGER ::= 1 + * teletex-common-name INTEGER ::= 2 + * teletex-organization-name INTEGER ::= 3 + * teletex-personal-name INTEGER ::= 4 + * teletex-organizational-unit-names INTEGER ::= 5 + * teletex-domain-defined-attributes INTEGER ::= 6 + * pds-name INTEGER ::= 7 + * physical-delivery-country-name INTEGER ::= 8 + * postal-code INTEGER ::= 9 + * physical-delivery-office-name INTEGER ::= 10 + * physical-delivery-office-number INTEGER ::= 11 + * extension-OR-address-components INTEGER ::= 12 + * physical-delivery-personal-name INTEGER ::= 13 + * physical-delivery-organization-name INTEGER ::= 14 + * extension-physical-delivery-address-components INTEGER ::= 15 + * unformatted-postal-address INTEGER ::= 16 + * street-address INTEGER ::= 17 + * post-office-box-address INTEGER ::= 18 + * poste-restante-address INTEGER ::= 19 + * unique-postal-name INTEGER ::= 20 + * local-postal-attributes INTEGER ::= 21 + * extended-network-address INTEGER ::= 22 + * terminal-type INTEGER ::= 23 + * + */ + +enum NSSPKIXExtensionAttributeTypeEnum { + NSSPKIXExtensionAttributeType_NSSinvalid = -1, + NSSPKIXExtensionAttributeType_CommonName = 1, + NSSPKIXExtensionAttributeType_TeletexCommonName = 2, + NSSPKIXExtensionAttributeType_TeletexOrganizationName = 3, + NSSPKIXExtensionAttributeType_TeletexPersonalName = 4, + NSSPKIXExtensionAttributeType_TeletexOrganizationalUnitNames = 5, + NSSPKIXExtensionAttributeType_TeletexDomainDefinedAttributes = 6, + NSSPKIXExtensionAttributeType_PdsName = 7, + NSSPKIXExtensionAttributeType_PhysicalDeliveryCountryName = 8, + NSSPKIXExtensionAttributeType_PostalCode = 9, + NSSPKIXExtensionAttributeType_PhysicalDeliveryOfficeName = 10, + NSSPKIXExtensionAttributeType_PhysicalDeliveryOfficeNumber = 11, + NSSPKIXExtensionAttributeType_ExtensionOrAddressComponents = 12, + NSSPKIXExtensionAttributeType_PhysicalDeliveryPersonalName = 13, + NSSPKIXExtensionAttributeType_PhysicalDeliveryOrganizationName = 14, + NSSPKIXExtensionAttributeType_ExtensionPhysicalDeliveryAddressComponents = 15, + NSSPKIXExtensionAttributeType_UnformattedPostalAddress = 16, + NSSPKIXExtensionAttributeType_StreetAddress = 17, + NSSPKIXExtensionAttributeType_PostOfficeBoxAddress = 18, + NSSPKIXExtensionAttributeType_PosteRestanteAddress = 19, + NSSPKIXExtensionAttributeType_UniquePostalName = 20, + NSSPKIXExtensionAttributeType_LocalPostalAttributes = 21, + NSSPKIXExtensionAttributeType_ExtendedNetworkAddress = 22, + NSSPKIXExtensionAttributeType_TerminalType = 23 +}; +typedef enum NSSPKIXExtensionAttributeTypeEnum NSSPKIXExtensionAttributeType; + +/* + * CommonName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CommonName ::= PrintableString (SIZE (1..ub-common-name-length)) + * + */ + +struct NSSPKIXCommonNameStr; +typedef struct NSSPKIXCommonNameStr NSSPKIXCommonName; + +/* + * TeletexCommonName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexCommonName ::= TeletexString (SIZE (1..ub-common-name-length)) + * + */ + +struct NSSPKIXTeletexCommonNameStr; +typedef struct NSSPKIXTeletexCommonNameStr NSSPKIXTeletexCommonName; + +/* + * TeletexOrganizationName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexOrganizationName ::= + * TeletexString (SIZE (1..ub-organization-name-length)) + * + */ + +struct NSSPKIXTeletexOrganizationNameStr; +typedef struct NSSPKIXTeletexOrganizationNameStr NSSPKIXTeletexOrganizationName; + +/* + * TeletexPersonalName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexPersonalName ::= SET { + * surname [0] TeletexString (SIZE (1..ub-surname-length)), + * given-name [1] TeletexString + * (SIZE (1..ub-given-name-length)) OPTIONAL, + * initials [2] TeletexString (SIZE (1..ub-initials-length)) OPTIONAL, + * generation-qualifier [3] TeletexString (SIZE + * (1..ub-generation-qualifier-length)) OPTIONAL } + * + */ + +struct NSSPKIXTeletexPersonalNameStr; +typedef struct NSSPKIXTeletexPersonalNameStr NSSPKIXTeletexPersonalName; + +/* + * TeletexOrganizationalUnitNames + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexOrganizationalUnitNames ::= SEQUENCE SIZE + * (1..ub-organizational-units) OF TeletexOrganizationalUnitName + * + */ + +struct NSSPKIXTeletexOrganizationalUnitNamesStr; +typedef struct NSSPKIXTeletexOrganizationalUnitNamesStr NSSPKIXTeletexOrganizationalUnitNames; + +/* + * TeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexOrganizationalUnitName ::= TeletexString + * (SIZE (1..ub-organizational-unit-name-length)) + * + */ + +struct NSSPKIXTeletexOrganizationalUnitNameStr; +typedef struct NSSPKIXTeletexOrganizationalUnitNameStr NSSPKIXTeletexOrganizationalUnitName; + +/* + * PDSName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PDSName ::= PrintableString (SIZE (1..ub-pds-name-length)) + * + */ + +struct NSSPKIXPDSNameStr; +typedef struct NSSPKIXPDSNameStr NSSPKIXPDSName; + +/* + * PhysicalDeliveryCountryName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PhysicalDeliveryCountryName ::= CHOICE { + * x121-dcc-code NumericString (SIZE (ub-country-name-numeric-length)), + * iso-3166-alpha2-code PrintableString + * (SIZE (ub-country-name-alpha-length)) } + * + */ + +struct NSSPKIXPhysicalDeliveryCountryNameStr; +typedef struct NSSPKIXPhysicalDeliveryCountryNameStr NSSPKIXPhysicalDeliveryCountryName; + +/* + * PostalCode + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PostalCode ::= CHOICE { + * numeric-code NumericString (SIZE (1..ub-postal-code-length)), + * printable-code PrintableString (SIZE (1..ub-postal-code-length)) } + * + */ + +struct NSSPKIXPostalCodeStr; +typedef struct NSSPKIXPostalCodeStr NSSPKIXPostalCode; + +/* + * PDSParameter + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PDSParameter ::= SET { + * printable-string PrintableString + * (SIZE(1..ub-pds-parameter-length)) OPTIONAL, + * teletex-string TeletexString + * (SIZE(1..ub-pds-parameter-length)) OPTIONAL } + * + */ + +struct NSSPKIXPDSParameterStr; +typedef struct NSSPKIXPDSParameterStr NSSPKIXPDSParameter; + +/* + * PhysicalDeliveryOfficeName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PhysicalDeliveryOfficeName ::= PDSParameter + * + */ + +typedef NSSPKIXPDSParameter NSSPKIXPhysicalDeliveryOfficeName; + +/* + * PhysicalDeliveryOfficeNumber + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PhysicalDeliveryOfficeNumber ::= PDSParameter + * + */ + +typedef NSSPKIXPDSParameter NSSPKIXPhysicalDeliveryOfficeNumber; + +/* + * ExtensionORAddressComponents + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtensionORAddressComponents ::= PDSParameter + * + */ + +typedef NSSPKIXPDSParameter NSSPKIXExtensionORAddressComponents; + +/* + * PhysicalDeliveryPersonalName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PhysicalDeliveryPersonalName ::= PDSParameter + * + */ + +typedef NSSPKIXPDSParameter NSSPKIXPhysicalDeliveryPersonalName; + +/* + * PhysicalDeliveryOrganizationName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PhysicalDeliveryOrganizationName ::= PDSParameter + * + */ + +typedef NSSPKIXPDSParameter NSSPKIXPhysicalDeliveryOrganizationName; + +/* + * ExtensionPhysicalDeliveryAddressComponents + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtensionPhysicalDeliveryAddressComponents ::= PDSParameter + * + */ + +typedef NSSPKIXPDSParameter NSSPKIXExtensionPhysicalDeliveryAddressComponents; + +/* + * UnformattedPostalAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * UnformattedPostalAddress ::= SET { + * printable-address SEQUENCE SIZE (1..ub-pds-physical-address-lines) OF + * PrintableString (SIZE (1..ub-pds-parameter-length)) OPTIONAL, + * teletex-string TeletexString + * (SIZE (1..ub-unformatted-address-length)) OPTIONAL } + * + */ + +struct NSSPKIXUnformattedPostalAddressStr; +typedef struct NSSPKIXUnformattedPostalAddressStr NSSPKIXUnformattedPostalAddress; + +/* + * StreetAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * StreetAddress ::= PDSParameter + * + */ + +typedef NSSPKIXPDSParameter NSSPKIXStreetAddress; + +/* + * PostOfficeBoxAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PostOfficeBoxAddress ::= PDSParameter + * + */ + +typedef NSSPKIXPDSParameter NSSPKIXPostOfficeBoxAddress; + +/* + * PosteRestanteAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PosteRestanteAddress ::= PDSParameter + * + */ + +typedef NSSPKIXPDSParameter NSSPKIXPosteRestanteAddress; + +/* + * UniquePostalName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * UniquePostalName ::= PDSParameter + * + */ + +typedef NSSPKIXPDSParameter NSSPKIXUniquePostalName; + +/* + * LocalPostalAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * LocalPostalAttributes ::= PDSParameter + * + */ + +typedef NSSPKIXPDSParameter NSSPKIXLocalPostalAttributes; + +/* + * ExtendedNetworkAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtendedNetworkAddress ::= CHOICE { + * e163-4-address SEQUENCE { + * number [0] NumericString (SIZE (1..ub-e163-4-number-length)), + * sub-address [1] NumericString + * (SIZE (1..ub-e163-4-sub-address-length)) OPTIONAL }, + * psap-address [0] PresentationAddress } + * + */ + +struct NSSPKIXExtendedNetworkAddressStr; +typedef struct NSSPKIXExtendedNetworkAddressStr NSSPKIXExtendedNetworkAddress; + +/* + * NSSPKIXExtendedNetworkAddressChoice + * + * Helper enumeration for ExtendedNetworkAddress + * -- fgmr comments -- + * + */ + +enum NSSPKIXExtendedNetworkAddressEnum { + NSSPKIXExtendedNetworkAddress_NSSinvalid = -1, + NSSPKIXExtendedNetworkAddress_e1634Address, + NSSPKIXExtendedNetworkAddress_psapAddress +}; +typedef enum NSSPKIXExtendedNetworkAddressEnum NSSPKIXExtendedNetworkAddressChoice; + +/* + * e163-4-address + * + * Helper structure for ExtendedNetworkAddress. + * -- fgmr comments -- + * + * From RFC 2459: + * + * e163-4-address SEQUENCE { + * number [0] NumericString (SIZE (1..ub-e163-4-number-length)), + * sub-address [1] NumericString + * (SIZE (1..ub-e163-4-sub-address-length)) OPTIONAL }, + * + */ + +struct NSSe1634addressStr; +typedef struct NSSe1634addressStr NSSe1634address; + +/* + * PresentationAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PresentationAddress ::= SEQUENCE { + * pSelector [0] EXPLICIT OCTET STRING OPTIONAL, + * sSelector [1] EXPLICIT OCTET STRING OPTIONAL, + * tSelector [2] EXPLICIT OCTET STRING OPTIONAL, + * nAddresses [3] EXPLICIT SET SIZE (1..MAX) OF OCTET STRING } + * + */ + +struct NSSPKIXPresentationAddressStr; +typedef struct NSSPKIXPresentationAddressStr NSSPKIXPresentationAddress; + +/* + * TerminalType + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TerminalType ::= INTEGER { + * telex (3), + * teletex (4), + * g3-facsimile (5), + * g4-facsimile (6), + * ia5-terminal (7), + * videotex (8) } (0..ub-integer-options) + * + */ + +enum NSSPKIXTerminalTypeEnum { + NSSPKIXTerminalType_NSSinvalid = -1, + NSSPKIXTerminalType_telex = 3, + NSSPKIXTerminalType_teletex = 4, + NSSPKIXTerminalType_g3Facsimile = 5, + NSSPKIXTerminalType_g4Facsimile = 6, + NSSPKIXTerminalType_iA5Terminal = 7, + NSSPKIXTerminalType_videotex = 8 +}; +typedef enum NSSPKIXTerminalTypeEnum NSSPKIXTerminalType; + +/* + * TeletexDomainDefinedAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexDomainDefinedAttributes ::= SEQUENCE SIZE + * (1..ub-domain-defined-attributes) OF TeletexDomainDefinedAttribute + * + */ + +struct NSSPKIXTeletexDomainDefinedAttributesStr; +typedef struct NSSPKIXTeletexDomainDefinedAttributesStr NSSPKIXTeletexDomainDefinedAttributes; + +/* + * TeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexDomainDefinedAttribute ::= SEQUENCE { + * type TeletexString + * (SIZE (1..ub-domain-defined-attribute-type-length)), + * value TeletexString + * (SIZE (1..ub-domain-defined-attribute-value-length)) } + * + */ + +struct NSSPKIXTeletexDomainDefinedAttributeStr; +typedef struct NSSPKIXTeletexDomainDefinedAttributeStr NSSPKIXTeletexDomainDefinedAttribute; + +/* + * AuthorityKeyIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AuthorityKeyIdentifier ::= SEQUENCE { + * keyIdentifier [0] KeyIdentifier OPTIONAL, + * authorityCertIssuer [1] GeneralNames OPTIONAL, + * authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL } + * -- authorityCertIssuer and authorityCertSerialNumber shall both + * -- be present or both be absent + * + */ + +struct NSSPKIXAuthorityKeyIdentifierStr; +typedef struct NSSPKIXAuthorityKeyIdentifierStr NSSPKIXAuthorityKeyIdentifier; + +/* + * KeyIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * KeyIdentifier ::= OCTET STRING + * + */ + +typedef NSSItem NSSPKIXKeyIdentifier; + +/* + * SubjectKeyIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * SubjectKeyIdentifier ::= KeyIdentifier + * + */ + +typedef NSSPKIXKeyIdentifier NSSPKIXSubjectKeyIdentifier; + +/* + * KeyUsage + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * KeyUsage ::= BIT STRING { + * digitalSignature (0), + * nonRepudiation (1), + * keyEncipherment (2), + * dataEncipherment (3), + * keyAgreement (4), + * keyCertSign (5), + * cRLSign (6), + * encipherOnly (7), + * decipherOnly (8) } + * + */ + +struct NSSPKIXKeyUsageStr; +typedef struct NSSPKIXKeyUsageStr NSSPKIXKeyUsage; + +/* + * KeyUsageValue + * + * -- helper for testing many key usages at once + * + */ + +enum NSSPKIXKeyUsageValueEnum { + NSSPKIXKeyUsage_NSSinvalid = 0, + NSSPKIXKeyUsage_DigitalSignature = 0x001, + NSSPKIXKeyUsage_NonRepudiation = 0x002, + NSSPKIXKeyUsage_KeyEncipherment = 0x004, + NSSPKIXKeyUsage_DataEncipherment = 0x008, + NSSPKIXKeyUsage_KeyAgreement = 0x010, + NSSPKIXKeyUsage_KeyCertSign = 0x020, + NSSPKIXKeyUsage_CRLSign = 0x040, + NSSPKIXKeyUsage_EncipherOnly = 0x080, + NSSPKIXKeyUsage_DecipherOnly = 0x100 +}; +typedef enum NSSPKIXKeyUsageValueEnum NSSPKIXKeyUsageValue; + +/* + * PrivateKeyUsagePeriod + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PrivateKeyUsagePeriod ::= SEQUENCE { + * notBefore [0] GeneralizedTime OPTIONAL, + * notAfter [1] GeneralizedTime OPTIONAL } + * -- either notBefore or notAfter shall be present + * + */ + +struct NSSPKIXPrivateKeyUsagePeriodStr; +typedef struct NSSPKIXPrivateKeyUsagePeriodStr NSSPKIXPrivateKeyUsagePeriod; + +/* + * CertificatePolicies + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CertificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation + * + */ + +struct NSSPKIXCertificatePoliciesStr; +typedef struct NSSPKIXCertificatePoliciesStr NSSPKIXCertificatePolicies; + +/* + * PolicyInformation + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyInformation ::= SEQUENCE { + * policyIdentifier CertPolicyId, + * policyQualifiers SEQUENCE SIZE (1..MAX) OF + * PolicyQualifierInfo OPTIONAL } + * + */ + +struct NSSPKIXPolicyInformationStr; +typedef struct NSSPKIXPolicyInformationStr NSSPKIXPolicyInformation; + +/* + * CertPolicyId + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CertPolicyId ::= OBJECT IDENTIFIER + * + */ + +typedef NSSOID NSSPKIXCertPolicyId; + +/* + * PolicyQualifierInfo + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyQualifierInfo ::= SEQUENCE { + * policyQualifierId PolicyQualifierId, + * qualifier ANY DEFINED BY policyQualifierId } + * + */ + +struct NSSPKIXPolicyQualifierInfoStr; +typedef NSSPKIXPolicyQualifierInfoStr NSSPKIXPolicyQualifierInfo; + +/* + * PolicyQualifierId + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyQualifierId ::= + * OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice ) + * + */ + +typedef NSSOID NSSPKIXPolicyQualifierId; + +/* + * CPSuri + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CPSuri ::= IA5String + * + */ + +struct NSSPKIXCPSuriStr; +typedef struct NSSPKIXCPSuriStr NSSPKIXCPSuri; + +/* + * UserNotice + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * UserNotice ::= SEQUENCE { + * noticeRef NoticeReference OPTIONAL, + * explicitText DisplayText OPTIONAL} + * + */ + +struct NSSPKIXUserNoticeStr; +typedef struct NSSPKIXUserNoticeStr NSSPKIXUserNotice; + +/* + * NoticeReference + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NoticeReference ::= SEQUENCE { + * organization DisplayText, + * noticeNumbers SEQUENCE OF INTEGER } + * + */ + +struct NSSPKIXNoticeReferenceStr; +typedef struct NSSPKIXNoticeReferenceStr NSSPKIXNoticeReference; + +/* + * DisplayText + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DisplayText ::= CHOICE { + * visibleString VisibleString (SIZE (1..200)), + * bmpString BMPString (SIZE (1..200)), + * utf8String UTF8String (SIZE (1..200)) } + * + */ + +struct NSSPKIXDisplayTextStr; +typedef struct NSSPKIXDisplayTextStr NSSPKIXDisplayText; + +/* + * PolicyMappings + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE { + * issuerDomainPolicy CertPolicyId, + * subjectDomainPolicy CertPolicyId } + * + */ + +struct NSSPKIXPolicyMappingsStr; +typedef struct NSSPKIXPolicyMappingsStr NSSPKIXPolicyMappings; + +/* + * policyMapping + * + * Helper structure for PolicyMappings + * + * SEQUENCE { + * issuerDomainPolicy CertPolicyId, + * subjectDomainPolicy CertPolicyId } + * + */ + +struct NSSPKIXpolicyMappingStr; +typedef struct NSSPKIXpolicyMappingStr NSSPKIXpolicyMapping; + +/* + * GeneralName + * + * This structure contains a union of the possible general names, + * of which there are several. + * + * From RFC 2459: + * + * GeneralName ::= CHOICE { + * otherName [0] AnotherName, + * rfc822Name [1] IA5String, + * dNSName [2] IA5String, + * x400Address [3] ORAddress, + * directoryName [4] Name, + * ediPartyName [5] EDIPartyName, + * uniformResourceIdentifier [6] IA5String, + * iPAddress [7] OCTET STRING, + * registeredID [8] OBJECT IDENTIFIER } + * + */ + +struct NSSPKIXGeneralNameStr; +typedef struct NSSPKIXGeneralNameStr NSSPKIXGeneralName; + +/* + * GeneralNameChoice + * + * This enumerates the possible general name types. + */ + +enum NSSPKIXGeneralNameChoiceEnum { + NSSPKIXGeneralNameChoice_NSSinvalid = -1, + NSSPKIXGeneralNameChoice_otherName = 0, + NSSPKIXGeneralNameChoice_rfc822Name = 1, + NSSPKIXGeneralNameChoice_dNSName = 2, + NSSPKIXGeneralNameChoice_x400Address = 3, + NSSPKIXGeneralNameChoice_directoryName = 4, + NSSPKIXGeneralNameChoice_ediPartyName = 5, + NSSPKIXGeneralNameChoice_uniformResourceIdentifier = 6, + NSSPKIXGeneralNameChoice_iPAddress = 7, + NSSPKIXGeneralNameChoice_registeredID = 8 +}; +typedef enum NSSPKIXGeneralNameChoiceEnum NSSPKIXGeneralNameChoice; + +/* + * GeneralNames + * + * This structure contains a sequence of GeneralName objects. + * + * From RFC 2459: + * + * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName + * + */ + +struct NSSPKIXGeneralNamesStr; +typedef struct NSSPKIXGeneralNamesStr NSSPKIXGeneralNames; + +/* + * SubjectAltName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * SubjectAltName ::= GeneralNames + * + */ + +typedef NSSPKIXGeneralNames NSSPKIXSubjectAltName; + +/* + * AnotherName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AnotherName ::= SEQUENCE { + * type-id OBJECT IDENTIFIER, + * value [0] EXPLICIT ANY DEFINED BY type-id } + * + */ + +struct NSSPKIXAnotherNameStr; +typedef struct NSSPKIXAnotherNameStr NSSPKIXAnotherName; + +/* + * EDIPartyName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * + * EDIPartyName ::= SEQUENCE { + * nameAssigner [0] DirectoryString OPTIONAL, + * partyName [1] DirectoryString } + * + */ + +struct NSSPKIXEDIPartyNameStr; +typedef struct NSSPKIXEDIPartyNameStr NSSPKIXEDIPartyName; + +/* + * IssuerAltName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * IssuerAltName ::= GeneralNames + * + */ + +typedef NSSPKIXGeneralNames NSSPKIXIssuerAltName; + +/* + * SubjectDirectoryAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * SubjectDirectoryAttributes ::= SEQUENCE SIZE (1..MAX) OF Attribute + * + */ + +struct NSSPKIXSubjectDirectoryAttributesStr; +typedef struct NSSPKIXSubjectDirectoryAttributesStr NSSPKIXSubjectDirectoryAttributes; + +/* + * BasicConstraints + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BasicConstraints ::= SEQUENCE { + * cA BOOLEAN DEFAULT FALSE, + * pathLenConstraint INTEGER (0..MAX) OPTIONAL } + * + */ + +struct NSSPKIXBasicConstraintsStr; +typedef struct NSSPKIXBasicConstraintsStr NSSPKIXBasicConstraints; + +/* + * NameConstraints + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NameConstraints ::= SEQUENCE { + * permittedSubtrees [0] GeneralSubtrees OPTIONAL, + * excludedSubtrees [1] GeneralSubtrees OPTIONAL } + * + */ + +struct NSSPKIXNameConstraintsStr; +typedef struct NSSPKIXNameConstraintsStr NSSPKIXNameConstraints; + +/* + * GeneralSubtrees + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree + * + */ + +struct NSSPKIXGeneralSubtreesStr; +typedef struct NSSPKIXGeneralSubtreesStr NSSPKIXGeneralSubtrees; + +/* + * GeneralSubtree + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * GeneralSubtree ::= SEQUENCE { + * base GeneralName, + * minimum [0] BaseDistance DEFAULT 0, + * maximum [1] BaseDistance OPTIONAL } + * + */ + +struct NSSPKIXGeneralSubtreeStr; +typedef struct NSSPKIXGeneralSubtreeStr NSSPKIXGeneralSubtree; + +/* + * BaseDistance + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BaseDistance ::= INTEGER (0..MAX) + * + */ + +typedef PRInt32 NSSPKIXBaseDistance; + +/* + * PolicyConstraints + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyConstraints ::= SEQUENCE { + * requireExplicitPolicy [0] SkipCerts OPTIONAL, + * inhibitPolicyMapping [1] SkipCerts OPTIONAL } + * + */ + +struct NSSPKIXPolicyConstraintsStr; +typedef NSSPKIXPolicyConstraintsStr NSSPKIXPolicyConstraints; + +/* + * SkipCerts + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * SkipCerts ::= INTEGER (0..MAX) + * + */ + +typedef NSSItem NSSPKIXSkipCerts; + +/* + * CRLDistPointsSyntax + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CRLDistPointsSyntax ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint + * + */ + +struct NSSPKIXCRLDistPointsSyntaxStr; +typedef struct NSSPKIXCRLDistPointsSyntaxStr NSSPKIXCRLDistPointsSyntax; + +/* + * DistributionPoint + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DistributionPoint ::= SEQUENCE { + * distributionPoint [0] DistributionPointName OPTIONAL, + * reasons [1] ReasonFlags OPTIONAL, + * cRLIssuer [2] GeneralNames OPTIONAL } + * + */ + +struct NSSPKIXDistributionPointStr; +typedef struct NSSPKIXDistributionPointStr NSSPKIXDistributionPoint; + +/* + * DistributionPointName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DistributionPointName ::= CHOICE { + * fullName [0] GeneralNames, + * nameRelativeToCRLIssuer [1] RelativeDistinguishedName } + * + */ + +struct NSSPKIXDistributionPointNameStr; +typedef struct NSSPKIXDistributionPointNameStr NSSPKIXDistributionPointName; + +/* + * DistributionPointNameChoice + * + * -- fgmr comments -- + * + */ + +enum NSSPKIXDistributionPointNameChoiceEnum { + NSSDistributionPointNameChoice_NSSinvalid = -1, + NSSDistributionPointNameChoice_FullName = 0, + NSSDistributionPointNameChoice_NameRelativeToCRLIssuer = 1 +}; +typedef enum NSSPKIXDistributionPointNameChoiceEnum NSSPKIXDistributionPointNameChoice; + +/* + * ReasonFlags + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ReasonFlags ::= BIT STRING { + * unused (0), + * keyCompromise (1), + * cACompromise (2), + * affiliationChanged (3), + * superseded (4), + * cessationOfOperation (5), + * certificateHold (6) } + * + */ + +struct NSSPKIXReasonFlagsStr; +typedef struct NSSPKIXReasonFlagsStr NSSPKIXReasonFlags; + +/* + * ReasonFlagsMask + * + * -- fgmr comments -- + * + */ + +typedef PRInt32 NSSPKIXReasonFlagsMask; +const NSSPKIXReasonFlagsMask NSSPKIXReasonFlagsMask_NSSinvalid = -1; +const NSSPKIXReasonFlagsMask NSSPKIXReasonFlagsMask_KeyCompromise = 0x02; +const NSSPKIXReasonFlagsMask NSSPKIXReasonFlagsMask_CACompromise = 0x04; +const NSSPKIXReasonFlagsMask NSSPKIXReasonFlagsMask_AffiliationChanged = 0x08; +const NSSPKIXReasonFlagsMask NSSPKIXReasonFlagsMask_Superseded = 0x10; +const NSSPKIXReasonFlagsMask NSSPKIXReasonFlagsMask_CessationOfOperation= 0x20; +const NSSPKIXReasonFlagsMask NSSPKIXReasonFlagsMask_CertificateHold = 0x40; + +/* + * ExtKeyUsageSyntax + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId + * + */ + +struct NSSPKIXExtKeyUsageSyntaxStr; +typedef struct NSSPKIXExtKeyUsageSyntaxStr NSSPKIXExtKeyUsageSyntax; + +/* + * KeyPurposeId + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * KeyPurposeId ::= OBJECT IDENTIFIER + * + */ + +typedef NSSOID NSSPKIXKeyPurposeId; + +/* + * AuthorityInfoAccessSyntax + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AuthorityInfoAccessSyntax ::= + * SEQUENCE SIZE (1..MAX) OF AccessDescription + * + */ + +struct NSSPKIXAuthorityInfoAccessSyntaxStr; +typedef struct NSSPKIXAuthorityInfoAccessSyntaxStr NSSPKIXAuthorityInfoAccessSyntax; + +/* + * AccessDescription + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AccessDescription ::= SEQUENCE { + * accessMethod OBJECT IDENTIFIER, + * accessLocation GeneralName } + * + */ + +struct NSSPKIXAccessDescriptionStr; +typedef struct NSSPKIXAccessDescriptionStr NSSPKIXAccessDescription; + +/* + * CRLNumber + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CRLNumber ::= INTEGER (0..MAX) + * + */ + +typedef NSSItem NSSPKIXCRLNumber; + +/* + * IssuingDistributionPoint + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * IssuingDistributionPoint ::= SEQUENCE { + * distributionPoint [0] DistributionPointName OPTIONAL, + * onlyContainsUserCerts [1] BOOLEAN DEFAULT FALSE, + * onlyContainsCACerts [2] BOOLEAN DEFAULT FALSE, + * onlySomeReasons [3] ReasonFlags OPTIONAL, + * indirectCRL [4] BOOLEAN DEFAULT FALSE } + * + */ + +struct NSSPKIXIssuingDistributionPointStr; +typedef struct NSSPKIXIssuingDistributionPointStr NSSPKIXIssuingDistributionPoint; + +/* + * BaseCRLNumber + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BaseCRLNumber ::= CRLNumber + * + */ + +typedef NSSPKIXCRLNumber NSSPKIXBaseCRLNumber; + +/* + * CRLReason + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CRLReason ::= ENUMERATED { + * unspecified (0), + * keyCompromise (1), + * cACompromise (2), + * affiliationChanged (3), + * superseded (4), + * cessationOfOperation (5), + * certificateHold (6), + * removeFromCRL (8) } + * + */ + +enum NSSPKIXCRLReasonEnum { + NSSPKIXCRLReasonEnum_NSSinvalid = -1, + NSSPKIXCRLReasonEnum_unspecified = 0, + NSSPKIXCRLReasonEnum_keyCompromise = 1, + NSSPKIXCRLReasonEnum_cACompromise = 2, + NSSPKIXCRLReasonEnum_affiliationChanged = 3, + NSSPKIXCRLReasonEnum_superseded = 4, + NSSPKIXCRLReasonEnum_cessationOfOperation = 5, + NSSPKIXCRLReasonEnum_certificateHold = 6, + NSSPKIXCRLReasonEnum_removeFromCRL = 8 +}; +typedef enum NSSPKIXCRLReasonEnum NSSPKIXCRLReason; + +/* + * CertificateIssuer + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CertificateIssuer ::= GeneralNames + * + */ + +typedef NSSPKIXGeneralNames NSSPKIXCertificateIssuer; + +/* + * HoldInstructionCode + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * HoldInstructionCode ::= OBJECT IDENTIFIER + * + */ + +typedef NSSOID NSSPKIXHoldInstructionCode; + +/* + * InvalidityDate + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * InvalidityDate ::= GeneralizedTime + * + */ + +typedef PRTime NSSPKIXInvalidityDate; + +PR_END_EXTERN_C + +#endif /* NSSPKIXT_H */ diff --git a/security/nss/lib/pkix/include/pkix.h b/security/nss/lib/pkix/include/pkix.h new file mode 100644 index 000000000..8ebe95595 --- /dev/null +++ b/security/nss/lib/pkix/include/pkix.h @@ -0,0 +1,26086 @@ +/* + * 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 PKIX_H +#define PKIX_H + +#ifdef DEBUG +static const char PKIX_CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +/* + * pkix.h + * + * This file contains the prototypes for the private methods defined + * for the PKIX part-1 objects. + */ + +#ifndef NSSPKIX_H +#include "nsspkix.h" +#endif /* NSSPKIX_H */ + +#ifndef PKIXT_H +#include "pkixt.h" +#endif /* PKIXT_H */ + +#ifndef ASN1T_H +#include "asn1t.h" +#endif /* ASN1T_H */ + +PR_BEGIN_EXTERN_C + +/* + * Attribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Attribute ::= SEQUENCE { + * type AttributeType, + * values SET OF AttributeValue + * -- at least one value is required -- } + * + * The private calls for the type: + * + * nssPKIXAttribute_Decode + * nssPKIXAttribute_Create + * nssPKIXAttribute_CreateFromArray + * nssPKIXAttribute_Destroy + * nssPKIXAttribute_Encode + * nssPKIXAttribute_GetType + * nssPKIXAttribute_SetType + * nssPKIXAttribute_GetValueCount + * nssPKIXAttribute_GetValues + * nssPKIXAttribute_SetValues + * nssPKIXAttribute_GetValue + * nssPKIXAttribute_SetValue + * nssPKIXAttribute_AddValue + * nssPKIXAttribute_RemoveValue + * nssPKIXAttribute_FindValue + * nssPKIXAttribute_Equal + * nssPKIXAttribute_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXAttribute_verifyPointer + */ + +/* + * nssPKIXAttribute_template + * + * + */ + +extern const nssASN1Template nssPKIXAttribute_template[]; + +/* + * nssPKIXAttribute_Decode + * + * This routine creates an NSSPKIXAttribute by decoding a BER- + * or DER-encoded Attribute as defined in RFC 2459. This + * routine may return NULL upon error, in which case it will + * have created an error stack. If the optional arena argument + * is non-NULL, that arena will be used for the required memory. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttribute * +nssPKIXAttribute_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXAttribute_Create + * + * This routine creates an NSSPKIXAttribute from specified components. + * This routine may return NULL upon error, in which case it will have + * created an error stack. If the optional arena argument is non-NULL, + * that arena will be used for the required memory. There must be at + * least one attribute value specified. The final argument must be + * NULL, to indicate the end of the set of attribute values. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttribute * +nssPKIXAttribute_Create +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + NSSPKIXAttributeValue *value1, + ... +); + +/* + * nssPKIXAttribute_CreateFromArray + * + * This routine creates an NSSPKIXAttribute from specified components. + * This routine may return NULL upon error, in which case it will have + * created an error stack. If the optional arena argument is non-NULL, + * that arena will be used for the required memory. There must be at + * least one attribute value specified. The final argument must be + * NULL, to indicate the end of the set of attribute values. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttribute * +nssPKIXAttribute_CreateFromArray +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + PRUint32 count, + NSSPKIXAttributeValue values[] +); + +/* + * nssPKIXAttribute_Destroy + * + * This routine destroys an NSSPKIXAttribute. It should be called on + * all such objects created without an arena. It does not need to be + * called for objects created with an arena, but it may be. This + * routine returns a PRStatus value. Upon error, it will create an + * error stack and return PR_FAILURE. + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAttribute_Destroy +( + NSSPKIXAttribute *attribute +); + +/* + * nssPKIXAttribute_Encode + * + * This routine returns the BER encoding of the specified + * NSSPKIXAttribute. {usual rules about itemOpt and arenaOpt} + * This routine indicates an error (NSS_ERROR_INVALID_DATA) + * if there are no attribute values (i.e., the last one was removed). + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_DATA + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXAttribute_Encode +( + NSSPKIXAttribute *attribute, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXAttribute_GetType + * + * This routine returns the attribute type oid of the specified + * NSSPKIXAttribute. + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSPKIXAttributeType pointer upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttributeType * +nssPKIXAttribute_GetType +( + NSSPKIXAttribute *attribute +); + +/* + * nssPKIXAttribute_SetType + * + * This routine sets the attribute type oid of the indicated + * NSSPKIXAttribute to the specified value. Since attributes + * may be application-defined, no checking can be done on + * either the correctness of the attribute type oid value nor + * the suitability of the set of attribute values. + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_OID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAttribute_SetType +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeType *attributeType +); + +/* + * nssPKIXAttribute_GetValueCount + * + * This routine returns the number of attribute values present in + * the specified NSSPKIXAttribute. This routine returns a PRInt32. + * Upon error, this routine returns -1. This routine indicates an + * error if the number of values cannot be expressed as a PRInt32. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXAttribute_GetValueCount +( + NSSPKIXAttribute *attribute +); + +/* + * nssPKIXAttribute_GetValues + * + * This routine returns all of the attribute values in the specified + * NSSPKIXAttribute. If the optional pointer to an array of NSSItems + * is non-null, then that array will be used and returned; otherwise, + * an array will be allocated and returned. If the limit is nonzero + * (which is must be if the specified array is nonnull), then an + * error is indicated if it is smaller than the value count. + * {arenaOpt} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSItem's upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttributeValue * +nssPKIXAttribute_GetValues +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeValue rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXAttribute_SetValues + * + * This routine sets all of the values of the specified + * NSSPKIXAttribute to the values in the specified NSSItem array. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_POINTER + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAttribute_SetValues +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeValue values[], + PRInt32 count +); + +/* + * nssPKIXAttribute_GetValue + * + * This routine returns the i'th attribute value of the set of + * values in the specified NSSPKIXAttribute. Although the set + * is unordered, an arbitrary ordering will be maintained until + * the data in the attribute is changed. {usual comments about + * itemOpt and arenaOpt} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttributeValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeValue * +nssPKIXAttribute_GetValue +( + NSSPKIXAttribute *attribute, + PRInt32 i, + NSSPKIXAttributeValue *itemOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXAttribute_SetValue + * + * This routine sets the i'th attribute value {blah blah; copies + * memory contents over..} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAttribute_SetValue +( + NSSPKIXAttribute *attribute, + PRInt32 i, + NSSPKIXAttributeValue *value +); + +/* + * nssPKIXAttribute_AddValue + * + * This routine adds the specified attribute value to the set in + * the specified NSSPKIXAttribute. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAttribute_AddValue +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeValue *value +); + +/* + * nssPKIXAttribute_RemoveValue + * + * This routine removes the i'th attribute value of the set in the + * specified NSSPKIXAttribute. An attempt to remove the last value + * will fail. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_AT_MINIMUM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAttribute_RemoveValue +( + NSSPKIXAttribute *attribute, + PRInt32 i +); + +/* + * nssPKIXAttribute_FindValue + * + * This routine searches the set of attribute values in the specified + * NSSPKIXAttribute for the provided data. If an exact match is found, + * then that value's index is returned. If an exact match is not + * found, -1 is returned. If there is more than one exact match, one + * index will be returned. {notes about unorderdness of SET, etc} + * If the index may not be represented as an integer, an error is + * indicated. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value + * The index of the specified attribute value upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXAttribute_FindValue +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeValue *attributeValue +); + +/* + * nssPKIXAttribute_Equal + * + * This routine compares two NSSPKIXAttribute's for equality. + * It returns PR_TRUE if they are equal, PR_FALSE otherwise. + * This routine also returns PR_FALSE upon error; if you're + * that worried about it, check for an error stack. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXAttribute_Equal +( + NSSPKIXAttribute *one, + NSSPKIXAttribute *two, + PRStatus *statusOpt +); + +/* + * nssPKIXAttribute_Duplicate + * + * This routine duplicates an NSSPKIXAttribute. {arenaOpt} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttribute * +nssPKIXAttribute_Duplicate +( + NSSPKIXAttribute *attribute, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXAttribute_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXAttribute + * 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_PKIX_ATTRIBUTE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXAttribute_verifyPointer +( + NSSPKIXAttribute *p +); +#endif /* DEBUG */ + +/* + * AttributeTypeAndValue + * + * This structure contains an attribute type (indicated by an OID), + * and the type-specific value. RelativeDistinguishedNames consist + * of a set of these. These are distinct from Attributes (which have + * SET of values), from AttributeDescriptions (which have qualifiers + * on the types), and from AttributeValueAssertions (which assert a + * a value comparison under some matching rule). + * + * From RFC 2459: + * + * AttributeTypeAndValue ::= SEQUENCE { + * type AttributeType, + * value AttributeValue } + * + * The private calls for the type: + * + * nssPKIXAttributeTypeAndValue_Decode + * nssPKIXAttributeTypeAndValue_CreateFromUTF8 + * nssPKIXAttributeTypeAndValue_Create + * nssPKIXAttributeTypeAndValue_Destroy + * nssPKIXAttributeTypeAndValue_Encode + * nssPKIXAttributeTypeAndValue_GetUTF8Encoding + * nssPKIXAttributeTypeAndValue_GetType + * nssPKIXAttributeTypeAndValue_SetType + * nssPKIXAttributeTypeAndValue_GetValue + * nssPKIXAttributeTypeAndValue_SetValue + * nssPKIXAttributeTypeAndValue_Equal + * nssPKIXAttributeTypeAndValue_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXAttributeTypeAndValue_verifyPointer + */ + +/* + * nssPKIXAttributeTypeAndValue_Decode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeTypeAndValue * +nssPKIXAttributeTypeAndValue_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXAttributeTypeAndValue_CreateFromUTF8 + * + * + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeTypeAndValue * +nssPKIXAttributeTypeAndValue_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +); + +/* + * nssPKIXAttributeTypeAndValue_Create + * + * + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeTypeAndValue * +nssPKIXAttributeTypeAndValue_Create +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + NSSPKIXAttributeValue *value +); + +/* + * nssPKIXAttributeTypeAndValue_Destroy + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAttributeTypeAndValue_Destroy +( + NSSPKIXAttributeTypeAndValue *atav +); + +/* + * nssPKIXAttributeTypeAndValue_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXAttributeTypeAndValue_Encode +( + NSSPKIXAttributeTypeAndValue *atav, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXAttributeTypeAndValue_GetUTF8Encoding + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXAttributeTypeAndValue_GetUTF8Encoding +( + NSSPKIXAttributeTypeAndValue *atav, + NSSArena *arenaOpt +); + +/* + * nssPKIXAttributeTypeAndValue_GetType + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSPKIXAttributeType pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeType * +nssPKIXAttributeTypeAndValue_GetType +( + NSSPKIXAttributeTypeAndValue *atav +); + +/* + * nssPKIXAttributeTypeAndValue_SetType + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_OID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAttributeTypeAndValue_SetType +( + NSSPKIXAttributeTypeAndValue *atav, + NSSPKIXAttributeType *attributeType +); + +/* + * nssPKIXAttributeTypeAndValue_GetValue + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSAttributeValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeValue * +nssPKIXAttributeTypeAndValue_GetValue +( + NSSPKIXAttributeTypeAndValue *atav, + NSSPKIXAttributeValue *itemOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXAttributeTypeAndValue_SetValue + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAttributeTypeAndValue_SetValue +( + NSSPKIXAttributeTypeAndValue *atav, + NSSPKIXAttributeValue *value +); + +/* + * nssPKIXAttributeTypeAndValue_Equal + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXAttributeTypeAndValue_Equal +( + NSSPKIXAttributeTypeAndValue *atav1, + NSSPKIXAttributeTypeAndValue *atav2, + PRStatus *statusOpt +); + +/* + * nssPKIXAttributeTypeAndValue_Duplicate + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeTypeAndValue * +nssPKIXAttributeTypeAndValue_Duplicate +( + NSSPKIXAttributeTypeAndValue *atav, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXAttributeTypeAndValue_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXAttributeTypeAndValue + * 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_PKIX_ATTRIBUTE_TYPE_AND_VALUE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXAttributeTypeAndValue_verifyPointer +( + NSSPKIXAttributeTypeAndValue *p +); +#endif /* DEBUG */ + +/* + * X520Name + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520name ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-name)), + * printableString PrintableString (SIZE (1..ub-name)), + * universalString UniversalString (SIZE (1..ub-name)), + * utf8String UTF8String (SIZE (1..ub-name)), + * bmpString BMPString (SIZE(1..ub-name)) } + * + * + * ub-name INTEGER ::= 32768 + * + * The private calls for this type: + * + * nssPKIXX520Name_Decode + * nssPKIXX520Name_CreateFromUTF8 + * nssPKIXX520Name_Create + * nssPKIXX520Name_Destroy + * nssPKIXX520Name_Encode + * nssPKIXX520Name_GetUTF8Encoding + * nssPKIXX520Name_Equal + * nssPKIXX520Name_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXX520Name_verifyPointer + */ + +/* + * nssPKIXX520Name_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520Name * +nssPKIXX520Name_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXX520Name_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520Name * +nssPKIXX520Name_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXX520Name_Create + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING_TYPE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520Name * +nssPKIXX520Name_Create +( + NSSArena *arenaOpt, + nssStringType type, + NSSItem *data +); + +/* + * nssPKIXX520Name_Destroy + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXX520Name_Destroy +( + NSSPKIXX520Name *name +); + +/* + * nssPKIXX520Name_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXX520Name_Encode +( + NSSPKIXX520Name *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXX520Name_GetUTF8Encoding + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXX520Name_GetUTF8Encoding +( + NSSPKIXX520Name *name, + NSSArena *arenaOpt +); + +/* + * nssPKIXX520Name_Equal + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXX520Name_Equal +( + NSSPKIXX520Name *name1, + NSSPKIXX520Name *name2, + PRStatus *statusOpt +); + +/* + * nssPKIXX520Name_Duplicate + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520Name * +nssPKIXX520Name_Duplicate +( + NSSPKIXX520Name *name, + NSSArena *arenaOpt +); + +#ifdef DEBUG + +/* + * nssPKIXX520Name_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXX520Name + * 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_PKIX_X520_NAME + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXX520Name_verifyPointer +( + NSSPKIXX520Name *p +); + +#endif /* DEBUG */ + +/* + * X520CommonName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520CommonName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-common-name)), + * printableString PrintableString (SIZE (1..ub-common-name)), + * universalString UniversalString (SIZE (1..ub-common-name)), + * utf8String UTF8String (SIZE (1..ub-common-name)), + * bmpString BMPString (SIZE(1..ub-common-name)) } + * + * + * ub-common-name INTEGER ::= 64 + * + * The private calls for this type: + * + * + * nssPKIXX520CommonName_Decode + * nssPKIXX520CommonName_CreateFromUTF8 + * nssPKIXX520CommonName_Create + * nssPKIXX520CommonName_Destroy + * nssPKIXX520CommonName_Encode + * nssPKIXX520CommonName_GetUTF8Encoding + * nssPKIXX520CommonName_Equal + * nssPKIXX520CommonName_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXX520CommonName_verifyPointer + */ + +/* + * nssPKIXX520CommonName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520CommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520CommonName * +nssPKIXX520CommonName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXX520CommonName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520CommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520CommonName * +nssPKIXX520CommonName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXX520CommonName_Create + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING_TYPE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXX520CommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520CommonName * +nssPKIXX520CommonName_Create +( + NSSArena *arenaOpt, + nssStringType type, + NSSItem *data +); + +/* + * nssPKIXX520CommonName_Destroy + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXX520CommonName_Destroy +( + NSSPKIXX520CommonName *name +); + +/* + * nssPKIXX520CommonName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXX520CommonName_Encode +( + NSSPKIXX520CommonName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXX520CommonName_GetUTF8Encoding + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXX520CommonName_GetUTF8Encoding +( + NSSPKIXX520CommonName *name, + NSSArena *arenaOpt +); + +/* + * nssPKIXX520CommonName_Equal + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXX520CommonName_Equal +( + NSSPKIXX520CommonName *name1, + NSSPKIXX520CommonName *name2, + PRStatus *statusOpt +); + +/* + * nssPKIXX520CommonName_Duplicate + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520CommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520CommonName * +nssPKIXX520CommonName_Duplicate +( + NSSPKIXX520CommonName *name, + NSSArena *arenaOpt +); + +#ifdef DEBUG + +/* + * nssPKIXX520CommonName_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXX520CommonName + * 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_PKIX_X520_NAME + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXX520CommonName_verifyPointer +( + NSSPKIXX520CommonName *p +); + +#endif /* DEBUG */ + +/* + * X520LocalityName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520LocalityName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-locality-name)), + * printableString PrintableString (SIZE (1..ub-locality-name)), + * universalString UniversalString (SIZE (1..ub-locality-name)), + * utf8String UTF8String (SIZE (1..ub-locality-name)), + * bmpString BMPString (SIZE(1..ub-locality-name)) } + * + * The private calls for this type: + * + * nssPKIXX520LocalityName_Decode + * nssPKIXX520LocalityName_CreateFromUTF8 + * nssPKIXX520LocalityName_Encode + * + */ + +/* + * nssPKIXX520LocalityName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520LocalityName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520LocalityName * +nssPKIXX520LocalityName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXX520LocalityName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520LocalityName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520LocalityName * +nssPKIXX520LocalityName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXX520LocalityName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXX520LocalityName_Encode +( + NSSPKIXX520LocalityName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X520StateOrProvinceName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520StateOrProvinceName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-state-name)), + * printableString PrintableString (SIZE (1..ub-state-name)), + * universalString UniversalString (SIZE (1..ub-state-name)), + * utf8String UTF8String (SIZE (1..ub-state-name)), + * bmpString BMPString (SIZE(1..ub-state-name)) } + * + * The private calls for this type: + * + * nssPKIXX520StateOrProvinceName_Decode + * nssPKIXX520StateOrProvinceName_CreateFromUTF8 + * nssPKIXX520StateOrProvinceName_Encode + * + */ + +/* + * nssPKIXX520StateOrProvinceName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520StateOrProvinceName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520StateOrProvinceName * +nssPKIXX520StateOrProvinceName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXX520StateOrProvinceName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520StateOrProvinceName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520StateOrProvinceName * +nssPKIXX520StateOrProvinceName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXX520StateOrProvinceName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXX520StateOrProvinceName_Encode +( + NSSPKIXX520StateOrProvinceName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X520OrganizationName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520OrganizationName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-organization-name)), + * printableString PrintableString (SIZE (1..ub-organization-name)), + * universalString UniversalString (SIZE (1..ub-organization-name)), + * utf8String UTF8String (SIZE (1..ub-organization-name)), + * bmpString BMPString (SIZE(1..ub-organization-name)) } + * + * The private calls for this type: + * + * nssPKIXX520OrganizationName_Decode + * nssPKIXX520OrganizationName_CreateFromUTF8 + * nssPKIXX520OrganizationName_Encode + * + */ + +/* + * nssPKIXX520OrganizationName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520OrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520OrganizationName * +nssPKIXX520OrganizationName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXX520OrganizationName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520OrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520OrganizationName * +nssPKIXX520OrganizationName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXX520OrganizationName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXX520OrganizationName_Encode +( + NSSPKIXX520OrganizationName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X520OrganizationalUnitName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520OrganizationalUnitName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-organizational-unit-name)), + * printableString PrintableString + * (SIZE (1..ub-organizational-unit-name)), + * universalString UniversalString + * (SIZE (1..ub-organizational-unit-name)), + * utf8String UTF8String (SIZE (1..ub-organizational-unit-name)), + * bmpString BMPString (SIZE(1..ub-organizational-unit-name)) } + * + * The private calls for this type: + * + * nssPKIXX520OrganizationalUnitName_Decode + * nssPKIXX520OrganizationalUnitName_CreateFromUTF8 + * nssPKIXX520OrganizationalUnitName_Encode + * + */ + +/* + * nssPKIXX520OrganizationalUnitName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520OrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520OrganizationalUnitName * +nssPKIXX520OrganizationalUnitName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXX520OrganizationalUnitName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520OrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520OrganizationalUnitName * +nssPKIXX520OrganizationalUnitName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXX520OrganizationalUnitName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXX520OrganizationalUnitName_Encode +( + NSSPKIXX520OrganizationalUnitName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X520Title + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520Title ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-title)), + * printableString PrintableString (SIZE (1..ub-title)), + * universalString UniversalString (SIZE (1..ub-title)), + * utf8String UTF8String (SIZE (1..ub-title)), + * bmpString BMPString (SIZE(1..ub-title)) } + * + * The private calls for this type: + * + * nssPKIXX520Title_Decode + * nssPKIXX520Title_CreateFromUTF8 + * nssPKIXX520Title_Encode + * + */ + +/* + * nssPKIXX520Title_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Title upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520Title * +nssPKIXX520Title_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXX520Title_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Title upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520Title * +nssPKIXX520Title_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXX520Title_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXX520Title_Encode +( + NSSPKIXX520Title *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X520dnQualifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520dnQualifier ::= PrintableString + * + * The private calls for this type: + * + * nssPKIXX520dnQualifier_Decode + * nssPKIXX520dnQualifier_CreateFromUTF8 + * nssPKIXX520dnQualifier_Encode + * + */ + +/* + * nssPKIXX520dnQualifier_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520dnQualifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520dnQualifier * +nssPKIXX520dnQualifier_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXX520dnQualifier_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520dnQualifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520dnQualifier * +nssPKIXX520dnQualifier_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXX520dnQualifier_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXX520dnQualifier_Encode +( + NSSPKIXX520dnQualifier *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X520countryName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X520countryName ::= PrintableString (SIZE (2)) -- IS 3166 codes + * + * The private calls for this type: + * + * nssPKIXX520countryName_Decode + * nssPKIXX520countryName_CreateFromUTF8 + * nssPKIXX520countryName_Encode + * + */ + +/* + * nssPKIXX520countryName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520countryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520countryName * +nssPKIXX520countryName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXX520countryName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520countryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX520countryName * +nssPKIXX520countryName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXX520countryName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXX520countryName_Encode +( + NSSPKIXX520countryName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * Pkcs9email + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Pkcs9email ::= IA5String (SIZE (1..ub-emailaddress-length)) + * + * The private calls for this type: + * + * nssPKIXPkcs9email_Decode + * nssPKIXPkcs9email_CreateFromUTF8 + * nssPKIXPkcs9email_Encode + * + */ + +/* + * nssPKIXPkcs9email_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPkcs9email upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPkcs9email * +nssPKIXPkcs9email_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXPkcs9email_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPkcs9email upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPkcs9email * +nssPKIXPkcs9email_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXPkcs9email_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXPkcs9email_Encode +( + NSSPKIXPkcs9email *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * Name + * + * This structure contains a union of the possible name formats, + * which at the moment is limited to an RDNSequence. + * + * From RFC 2459: + * + * Name ::= CHOICE { -- only one possibility for now -- + * rdnSequence RDNSequence } + * + * The private calls for this type: + * + * nssPKIXName_Decode + * nssPKIXName_CreateFromUTF8 + * nssPKIXName_Create + * nssPKIXName_CreateFromRDNSequence + * nssPKIXName_Destroy + * nssPKIXName_Encode + * nssPKIXName_GetUTF8Encoding + * nssPKIXName_GetChoice + * nssPKIXName_GetRDNSequence + * nssPKIXName_GetSpecifiedChoice {fgmr remove this} +{fgmr} _SetRDNSequence +{fgmr} _SetSpecifiedChoice + * nssPKIXName_Equal + * nssPKIXName_Duplicate + * + * (here is where I had specific attribute value gettors in pki1) + * + * In debug builds, the following call is available: + * + * nssPKIXName_verifyPointer + * + */ + +/* + * nssPKIXName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +nssPKIXName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXName_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +nssPKIXName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +); + +/* + * nssPKIXName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_CHOICE + * NSS_ERROR_INVALID_ARGUMENT + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +nssPKIXName_Create +( + NSSArena *arenaOpt, + NSSPKIXNameChoice choice, + void *arg +); + +/* + * nssPKIXName_CreateFromRDNSequence + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +nssPKIXName_CreateFromRDNSequence +( + NSSArena *arenaOpt, + NSSPKIXRDNSequence *rdnSequence +); + +/* + * nssPKIXName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXName_Destroy +( + NSSPKIXName *name +); + +/* + * nssPKIXName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXName_Encode +( + NSSPKIXName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXName_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXName_GetUTF8Encoding +( + NSSPKIXName *name, + NSSArena *arenaOpt +); + +/* + * nssPKIXName_GetChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * A valid element of the NSSPKIXNameChoice enumeration upon success + * The value NSSPKIXNameChoice_NSSinvalid (-1) upon error + */ + +NSS_EXTERN NSSPKIXNameChoice +nssPKIXName_GetChoice +( + NSSPKIXName *name +); + +/* + * nssPKIXName_GetRDNSequence + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A pointer to a valid NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRDNSequence * +nssPKIXName_GetRDNSequence +( + NSSPKIXName *name, + NSSArena *arenaOpt +); + +/* + * nssPKIXName_GetSpecifiedChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A valid pointer ... + * NULL upon failure + */ + +NSS_EXTERN void * +nssPKIXName_GetSpecifiedChoice +( + NSSPKIXName *name, + NSSPKIXNameChoice choice, + NSSArena *arenaOpt +); + +/* + * nssPKIXName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXName_Equal +( + NSSPKIXName *name1, + NSSPKIXName *name2, + PRStatus *statusOpt +); + +/* + * nssPKIXName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +nssPKIXName_Duplicate +( + NSSPKIXName *name, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXName_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXName + * 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_PKIX_NAME + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXName_verifyPointer +( + NSSPKIXName *p +); +#endif /* DEBUG */ + +/* + * RDNSequence + * + * This structure contains a sequence of RelativeDistinguishedName + * objects. + * + * From RFC 2459: + * + * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName + * + * The private calls for this type: + * + * nssPKIXRDNSequence_Decode + * nssPKIXRDNSequence_CreateFromUTF8 + * nssPKIXRDNSequence_Create + * nssPKIXRDNSequence_CreateFromArray + * nssPKIXRDNSequence_Destroy + * nssPKIXRDNSequence_Encode + * nssPKIXRDNSequence_GetUTF8Encoding + * nssPKIXRDNSequence_GetRelativeDistinguishedNameCount + * nssPKIXRDNSequence_GetRelativeDistinguishedNames + * nssPKIXRDNSequence_SetRelativeDistinguishedNames + * nssPKIXRDNSequence_GetRelativeDistinguishedName + * nssPKIXRDNSequence_SetRelativeDistinguishedName + * nssPKIXRDNSequence_AppendRelativeDistinguishedName + * nssPKIXRDNSequence_InsertRelativeDistinguishedName + * nssPKIXRDNSequence_RemoveRelativeDistinguishedName + * nssPKIXRDNSequence_FindRelativeDistinguishedName + * nssPKIXRDNSequence_Equal + * nssPKIXRDNSequence_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXRDNSequence_verifyPointer + * + */ + +/* + * nssPKIXRDNSequence_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRDNSequence * +nssPKIXRDNSequence_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXRDNSequence_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRDNSequence * +nssPKIXRDNSequence_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +); + +/* + * nssPKIXRDNSequence_CreateFromArray + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRDNSequence * +nssPKIXRDNSequence_CreateFromArray +( + NSSArena *arenaOpt, + PRUint32 count, + NSSPKIXRelativeDistinguishedName *rdn1 +); + +/* + * nssPKIXRDNSequence_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRDNSequence * +nssPKIXRDNSequence_Create +( + NSSArena *arenaOpt, + NSSPKIXRelativeDistinguishedName *rdn1, + ... +); + +/* + * nssPKIXRDNSequence_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXRDNSequence_Destroy +( + NSSPKIXRDNSequence *rdnseq +); + +/* + * nssPKIXRDNSequence_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXRDNSequence_Encode +( + NSSPKIXRDNSequence *rdnseq, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXRDNSequence_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXRDNSequence_GetUTF8Encoding +( + NSSPKIXRDNSequence *rdnseq, + NSSArena *arenaOpt +); + +/* + * nssPKIXRDNSequence_GetRelativeDistinguishedNameCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXRDNSequence_GetRelativeDistinguishedNameCount +( + NSSPKIXRDNSequence *rdnseq +); + +/* + * nssPKIXRDNSequence_GetRelativeDistinguishedNames + * + * This routine returns all of the relative distinguished names in the + * specified RDN Sequence. {...} If the array is allocated, or if the + * specified one has extra space, the array will be null-terminated. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXRelativeDistinguishedName + * pointers upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName ** +nssPKIXRDNSequence_GetRelativeDistinguishedNames +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXRDNSequence_SetRelativeDistinguishedNames + * + * -- fgmr comments -- + * If the array pointer itself is null, the set is considered empty. + * If the count is zero but the pointer nonnull, the array will be + * assumed to be null-terminated. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXRDNSequence_SetRelativeDistinguishedNames +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rdns[], + PRInt32 countOpt +); + +/* + * nssPKIXRDNSequence_GetRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +nssPKIXRDNSequence_GetRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXRDNSequence_SetRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXRDNSequence_SetRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i, + NSSPKIXRelativeDistinguishedName *rdn +); + +/* + * nssPKIXRDNSequence_AppendRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXRDNSequence_AppendRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rdn +); + +/* + * nssPKIXRDNSequence_InsertRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXRDNSequence_InsertRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i, + NSSPKIXRelativeDistinguishedName *rdn +); + +/* + * nssPKIXRDNSequence_RemoveRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXRDNSequence_RemoveRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i +); + +/* + * nssPKIXRDNSequence_FindRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified attribute value upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXRDNSequence_FindRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rdn +); + +/* + * nssPKIXRDNSequence_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXRDNSequence_Equal +( + NSSPKIXRDNSequence *one, + NSSPKIXRDNSequence *two, + PRStatus *statusOpt +); + +/* + * nssPKIXRDNSequence_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRDNSequence * +nssPKIXRDNSequence_Duplicate +( + NSSPKIXRDNSequence *rdnseq, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXRDNSequence_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXRDNSequence + * 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_PKIX_RDN_SEQUENCE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXRDNSequence_verifyPointer +( + NSSPKIXRDNSequence *p +); +#endif /* DEBUG */ + +/* + * DistinguishedName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DistinguishedName ::= RDNSequence + * + * This is just a public typedef; no new methods are required. {fgmr-- right?} + */ + +/* + * RelativeDistinguishedName + * + * This structure contains an unordered set of AttributeTypeAndValue + * objects. RDNs are used to distinguish a set of objects underneath + * a common object. + * + * Often, a single ATAV is sufficient to make a unique distinction. + * For example, if a company assigns its people unique uid values, + * then in the Name "uid=smith,ou=People,o=Acme,c=US" the "uid=smith" + * ATAV by itself forms an RDN. However, sometimes a set of ATAVs is + * needed. For example, if a company needed to distinguish between + * two Smiths by specifying their corporate divisions, then in the + * Name "(cn=Smith,ou=Sales),ou=People,o=Acme,c=US" the parenthesised + * set of ATAVs forms the RDN. + * + * From RFC 2459: + * + * RelativeDistinguishedName ::= + * SET SIZE (1 .. MAX) OF AttributeTypeAndValue + * + * The private calls for this type: + * + * nssPKIXRelativeDistinguishedName_Decode + * nssPKIXRelativeDistinguishedName_CreateFromUTF8 + * nssPKIXRelativeDistinguishedName_Create + * nssPKIXRelativeDistinguishedName_CreateFromArray + * nssPKIXRelativeDistinguishedName_Destroy + * nssPKIXRelativeDistinguishedName_Encode + * nssPKIXRelativeDistinguishedName_GetUTF8Encoding + * nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValueCount + * nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValues + * nssPKIXRelativeDistinguishedName_SetAttributeTypeAndValues + * nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValue + * nssPKIXRelativeDistinguishedName_SetAttributeTypeAndValue + * nssPKIXRelativeDistinguishedName_AddAttributeTypeAndValue + * nssPKIXRelativeDistinguishedName_RemoveAttributeTypeAndValue + * nssPKIXRelativeDistinguishedName_FindAttributeTypeAndValue + * nssPKIXRelativeDistinguishedName_Equal + * nssPKIXRelativeDistinguishedName_Duplicate + * + * fgmr: Logical additional functions include + * + * NSSPKIXRelativeDistinguishedName_FindAttributeTypeAndValueByType + * returns PRInt32 + * NSSPKIXRelativeDistinguishedName_FindAttributeTypeAndValuesByType + * returns array of PRInt32 + * NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValueForType + * returns NSSPKIXAttributeTypeAndValue + * NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValuesForType + * returns array of NSSPKIXAttributeTypeAndValue + * NSSPKIXRelativeDistinguishedName_GetAttributeValueForType + * returns NSSPKIXAttributeValue + * NSSPKIXRelativeDistinguishedName_GetAttributeValuesForType + * returns array of NSSPKIXAttributeValue + * + * NOTE: the "return array" versions are only meaningful if an RDN may + * contain multiple ATAVs with the same type. Verify in the RFC if + * this is possible or not. If not, nuke those three functions. + * + * In debug builds, the following call is available: + * + * nssPKIXRelativeDistinguishedName_verifyPointer + * + */ + +/* + * nssPKIXRelativeDistinguishedName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +nssPKIXRelativeDistinguishedName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXRelativeDistinguishedName_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +nssPKIXRelativeDistinguishedName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +); + +/* + * nssPKIXRelativeDistinguishedName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ATAV + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +nssPKIXRelativeDistinguishedName_Create +( + NSSArena *arenaOpt, + NSSPKIXAttributeTypeAndValue *atav1, + ... +); + +/* + * nssPKIXRelativeDistinguishedName_CreateFromArray + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ATAV + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +nssPKIXRelativeDistinguishedName_CreateFromArray +( + NSSArena *arenaOpt, + PRUint32 count, + NSSPKIXAttributeTypeAndValue *atavs +); + +/* + * nssPKIXRelativeDistinguishedName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXRelativeDistinguishedName_Destroy +( + NSSPKIXRelativeDistinguishedName *rdn +); + +/* + * nssPKIXRelativeDistinguishedName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXRelativeDistinguishedName_Encode +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXRelativeDistinguishedName_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXRelativeDistinguishedName_GetUTF8Encoding +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSArena *arenaOpt +); + +/* + * nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValueCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValueCount +( + NSSPKIXRelativeDistinguishedName *rdn +); + +/* + * nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValues + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXAttributeTypeAndValue + * pointers upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeTypeAndValue ** +nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValues +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXRelativeDistinguishedName_SetAttributeTypeAndValues + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ATAV + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXRelativeDistinguishedName_SetAttributeTypeAndValues +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *atavs[], + PRInt32 countOpt +); + +/* + * nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeTypeAndValue * +nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXRelativeDistinguishedName_SetAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXRelativeDistinguishedName_SetAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + PRInt32 i, + NSSPKIXAttributeTypeAndValue *atav +); + +/* + * nssPKIXRelativeDistinguishedName_AddAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXRelativeDistinguishedName_AddAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *atav +); + +/* + * nssPKIXRelativeDistinguishedName_RemoveAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_AT_MINIMUM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXRelativeDistinguishedName_RemoveAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + PRInt32 i +); + +/* + * nssPKIXRelativeDistinguishedName_FindAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified attribute value upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXRelativeDistinguishedName_FindAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *atav +); + +/* + * nssPKIXRelativeDistinguishedName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXRelativeDistinguishedName_Equal +( + NSSPKIXRelativeDistinguishedName *one, + NSSPKIXRelativeDistinguishedName *two, + PRStatus *statusOpt +); + +/* + * nssPKIXRelativeDistinguishedName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +nssPKIXRelativeDistinguishedName_Duplicate +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXRelativeDistinguishedName_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXRelativeDistinguishedName + * 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_PKIX_RELATIVE_DISTINGUISHED_NAME + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXRelativeDistinguishedName_verifyPointer +( + NSSPKIXRelativeDistinguishedName *p +); +#endif /* DEBUG */ + +/* + * DirectoryString + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DirectoryString ::= CHOICE { + * teletexString TeletexString (SIZE (1..MAX)), + * printableString PrintableString (SIZE (1..MAX)), + * universalString UniversalString (SIZE (1..MAX)), + * utf8String UTF8String (SIZE (1..MAX)), + * bmpString BMPString (SIZE(1..MAX)) } + * + * The private calls for this type: + * + * nssPKIXDirectoryString_Decode + * nssPKIXDirectoryString_CreateFromUTF8 + * nssPKIXDirectoryString_Encode + * + */ + +/* + * nssPKIXDirectoryString_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDirectoryString upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDirectoryString * +nssPKIXDirectoryString_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXDirectoryString_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDirectoryString upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDirectoryString * +nssPKIXDirectoryString_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXDirectoryString_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_DIRECTORY_STRING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXDirectoryString_Encode +( + NSSPKIXDirectoryString *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * Certificate + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Certificate ::= SEQUENCE { + * tbsCertificate TBSCertificate, + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING } + * + * The private calls for this type: + * + * nssPKIXCertificate_Decode + * nssPKIXCertificate_Create + * nssPKIXCertificate_Destroy + * nssPKIXCertificate_Encode + * nssPKIXCertificate_GetTBSCertificate + * nssPKIXCertificate_SetTBSCertificate + * nssPKIXCertificate_GetAlgorithmIdentifier + * nssPKIXCertificate_SetAlgorithmIdentifier + * nssPKIXCertificate_GetSignature + * nssPKIXCertificate_SetSignature + * nssPKIXCertificate_Equal + * nssPKIXCertificate_Duplicate + * + * { inherit TBSCertificate gettors? } + * + * In debug builds, the following call is available: + * + * nssPKIXCertificate_verifyPointer + * + */ + +/* + * nssPKIXCertificate_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificate * +nssPKIXCertificate_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXCertificate_Create + * + * -- fgmr comments -- + * { at this level we'll have to just accept a specified signature } + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_ALGID + * NSS_ERROR_INVALID_PKIX_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificate * +nssPKIXCertificate_Create +( + NSSArena *arenaOpt, + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXAlgorithmIdentifier *algID, + NSSItem *signature +); + +/* + * nssPKIXCertificate_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificate_Destroy +( + NSSPKIXCertificate *cert +); + +/* + * nssPKIXCertificate_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXCertificate_Encode +( + NSSPKIXCertificate *cert, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXCertificate_GetTBSCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertificate * +nssPKIXCertificate_GetTBSCertificate +( + NSSPKIXCertificate *cert, + NSSArena *arenaOpt +); + +/* + * nssPKIXCertificate_SetTBSCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificate_SetTBSCertificate +( + NSSPKIXCertificate *cert, + NSSPKIXTBSCertificate *tbsCert +); + +/* + * nssPKIXCertificate_GetAlgorithmIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +nssPKIXCertificate_GetAlgorithmIdentifier +( + NSSPKIXCertificate *cert, + NSSArena *arenaOpt +); + +/* + * nssPKIXCertificate_SetAlgorithmIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificate_SetAlgorithmIdentifier +( + NSSPKIXCertificate *cert, + NSSPKIXAlgorithmIdentifier *algid, +); + +/* + * nssPKIXCertificate_GetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +nssPKIXCertificate_GetSignature +( + NSSPKIXCertificate *cert, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXCertificate_SetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_POINTER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificate_SetSignature +( + NSSPKIXCertificate *cert, + NSSItem *signature +); + +/* + * nssPKIXCertificate_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXCertificate_Equal +( + NSSPKIXCertificate *one, + NSSPKIXCertificate *two, + PRStatus *statusOpt +); + +/* + * nssPKIXCertificate_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificate * +nssPKIXCertificate_Duplicate +( + NSSPKIXCertificate *cert, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXCertificate_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXCertificate + * 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_PKIX_CERTIFICATE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXCertificate_verifyPointer +( + NSSPKIXCertificate *p +); +#endif /* DEBUG */ + +/* + * TBSCertificate + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TBSCertificate ::= SEQUENCE { + * version [0] Version DEFAULT v1, + * serialNumber CertificateSerialNumber, + * signature AlgorithmIdentifier, + * issuer Name, + * validity Validity, + * subject Name, + * subjectPublicKeyInfo SubjectPublicKeyInfo, + * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, + * -- If present, version shall be v2 or v3 + * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, + * -- If present, version shall be v2 or v3 + * extensions [3] Extensions OPTIONAL + * -- If present, version shall be v3 -- } + * + * The private calls for this type: + * + * nssPKIXTBSCertificate_Decode + * nssPKIXTBSCertificate_Create + * nssPKIXTBSCertificate_Destroy + * nssPKIXTBSCertificate_Encode + * nssPKIXTBSCertificate_GetVersion + * nssPKIXTBSCertificate_SetVersion + * nssPKIXTBSCertificate_GetSerialNumber + * nssPKIXTBSCertificate_SetSerialNumber + * nssPKIXTBSCertificate_GetSignature + * nssPKIXTBSCertificate_SetSignature + * { inherit algid gettors? } + * nssPKIXTBSCertificate_GetIssuer + * nssPKIXTBSCertificate_SetIssuer + * { inherit "helper" issuer gettors? } + * nssPKIXTBSCertificate_GetValidity + * nssPKIXTBSCertificate_SetValidity + * { inherit validity accessors } + * nssPKIXTBSCertificate_GetSubject + * nssPKIXTBSCertificate_SetSubject + * nssPKIXTBSCertificate_GetSubjectPublicKeyInfo + * nssPKIXTBSCertificate_SetSubjectPublicKeyInfo + * nssPKIXTBSCertificate_HasIssuerUniqueID + * nssPKIXTBSCertificate_GetIssuerUniqueID + * nssPKIXTBSCertificate_SetIssuerUniqueID + * nssPKIXTBSCertificate_RemoveIssuerUniqueID + * nssPKIXTBSCertificate_HasSubjectUniqueID + * nssPKIXTBSCertificate_GetSubjectUniqueID + * nssPKIXTBSCertificate_SetSubjectUniqueID + * nssPKIXTBSCertificate_RemoveSubjectUniqueID + * nssPKIXTBSCertificate_HasExtensions + * nssPKIXTBSCertificate_GetExtensions + * nssPKIXTBSCertificate_SetExtensions + * nssPKIXTBSCertificate_RemoveExtensions + * { extension accessors } + * nssPKIXTBSCertificate_Equal + * nssPKIXTBSCertificate_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXTBSCertificate_verifyPointer + */ + +/* + * nssPKIXTBSCertificate_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertificate * +nssPKIXTBSCertificate_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXTBSCertificate_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_VERSION + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_SERIAL_NUMBER + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ISSUER_NAME + * NSS_ERROR_INVALID_VALIDITY + * NSS_ERROR_INVALID_SUBJECT_NAME + * NSS_ERROR_INVALID_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_INVALID_ISSUER_UNIQUE_IDENTIFIER + * NSS_ERROR_INVALID_SUBJECT_UNIQUE_IDENTIFIER + * NSS_ERROR_INVALID_EXTENSION + * + * Return value: + */ + +NSS_EXTERN NSSPKIXTBSCertificate * +nssPKIXTBSCertificate_Create +( + NSSArena *arenaOpt, + NSSPKIXVersion version, + NSSPKIXCertificateSerialNumber *serialNumber, + NSSPKIXAlgorithmIdentifier *signature, + NSSPKIXName *issuer, + NSSPKIXValidity *validity, + NSSPKIXName *subject, + NSSPKIXSubjectPublicKeyInfo *spki, + NSSPKIXUniqueIdentifier *issuerUniqueID, + NSSPKIXUniqueIdentifier *subjectUniqueID, + NSSPKIXExtensions *extensions +); + +/* + * nssPKIXTBSCertificate_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_Destroy +( + NSSPKIXTBSCertificate *tbsCert +); + +/* + * nssPKIXTBSCertificate_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXTBSCertificate_Encode +( + NSSPKIXTBSCertificate *tbsCert, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertificate_GetVersion + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid element of the NSSPKIXVersion enumeration upon success + * NSSPKIXVersion_NSSinvalid (-1) upon failure + */ + +NSS_EXTERN NSSPKIXVersion +nssPKIXTBSCertificate_GetVersion +( + NSSPKIXTBSCertificate *tbsCert +); + +/* + * nssPKIXTBSCertificate_SetVersion + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_VERSION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_SetVersion +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXVersion version +); + +/* + * nssPKIXTBSCertificate_GetSerialNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXCertificateSerialNumber upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificateSerialNumber * +nssPKIXTBSCertificate_GetSerialNumber +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXCertificateSerialNumber *snOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertificate_SetSerialNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_SetSerialNumber +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXCertificateSerialNumber *sn +); + +/* + * nssPKIXTBSCertificate_GetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +nssPKIXTBSCertificate_GetSignature +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertificate_SetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_SetSignature +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXAlgorithmIdentifier *algID +); + +/* + * { fgmr inherit algid gettors? } + */ + +/* + * nssPKIXTBSCertificate_GetIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +nssPKIXTBSCertificate_GetIssuer +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertificate_SetIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_SetIssuer +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXName *issuer +); + +/* + * { inherit "helper" issuer gettors? } + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * + * Return value: + */ + +/* + * nssPKIXTBSCertificate_GetValidity + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXValidity upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXValidity * +nssPKIXTBSCertificate_GetValidity +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertificate_SetValidity + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_SetValidity +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXValidity *validity +); + +/* + * { fgmr inherit validity accessors } + */ + +/* + * nssPKIXTBSCertificate_GetSubject + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +nssPKIXTBSCertificate_GetSubject +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertificate_SetSubject + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_SetSubject +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXName *subject +); + +/* + * nssPKIXTBSCertificate_GetSubjectPublicKeyInfo + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXSubjectPublicKeyInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectPublicKeyInfo * +nssPKIXTBSCertificate_GetSubjectPublicKeyInfo +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertificate_SetSubjectPublicKeyInfo + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_SetSubjectPublicKeyInfo +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXSubjectPublicKeyInfo *spki +); + +/* + * nssPKIXTBSCertificate_HasIssuerUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXTBSCertificate_HasIssuerUniqueID +( + NSSPKIXTBSCertificate *tbsCert, + PRStatus *statusOpt +); + +/* + * nssPKIXTBSCertificate_GetIssuerUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_CERT_HAS_NO_ISSUER_UNIQUE_ID + * + * Return value: + * A valid pointer to an NSSPKIXUniqueIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXUniqueIdentifier * +nssPKIXTBSCertificate_GetIssuerUniqueID +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXUniqueIdentifier *uidOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertificate_SetIssuerUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_SetIssuerUniqueID +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXUniqueIdentifier *uid +); + +/* + * nssPKIXTBSCertificate_RemoveIssuerUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_CERT_HAS_NO_ISSUER_UNIQUE_ID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_RemoveIssuerUniqueID +( + NSSPKIXTBSCertificate *tbsCert +); + +/* + * nssPKIXTBSCertificate_HasSubjectUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXTBSCertificate_HasSubjectUniqueID +( + NSSPKIXTBSCertificate *tbsCert, + PRStatus *statusOpt +); + +/* + * nssPKIXTBSCertificate_GetSubjectUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_CERT_HAS_NO_SUBJECT_UNIQUE_ID + * + * Return value: + * A valid pointer to an NSSPKIXUniqueIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXUniqueIdentifier * +nssPKIXTBSCertificate_GetSubjectUniqueID +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXUniqueIdentifier *uidOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertificate_SetSubjectUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_SetSubjectUniqueID +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXUniqueIdentifier *uid +); + +/* + * nssPKIXTBSCertificate_RemoveSubjectUniqueID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_CERT_HAS_NO_SUBJECT_UNIQUE_ID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_RemoveSubjectUniqueID +( + NSSPKIXTBSCertificate *tbsCert +); + +/* + * nssPKIXTBSCertificate_HasExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXTBSCertificate_HasExtensions +( + NSSPKIXTBSCertificate *tbsCert, + PRStatus *statusOpt +); + +/* + * nssPKIXTBSCertificate_GetExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_CERT_HAS_NO_EXTENSIONS + * + * Return value: + * A valid pointer to an NSSPKIXExtensions upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensions * +nssPKIXTBSCertificate_GetExtensions +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertificate_SetExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_PKIX_EXTENSIONS + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_SetExtensions +( + NSSPKIXTBSCertificate *tbsCert, + NSSPKIXExtensions *extensions +); + +/* + * nssPKIXTBSCertificate_RemoveExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_CERT_HAS_NO_EXTENSIONS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_RemoveExtensions +( + NSSPKIXTBSCertificate *tbsCert +); + +/* + * { extension accessors } + */ + +/* + * nssPKIXTBSCertificate_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXTBSCertificate_Equal +( + NSSPKIXTBSCertificate *one, + NSSPKIXTBSCertificate *two, + PRStatus *statusOpt +); + +/* + * nssPKIXTBSCertificate_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertificate * +nssPKIXTBSCertificate_Duplicate +( + NSSPKIXTBSCertificate *tbsCert, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXTBSCertificate_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXTBSCertificate + * 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_PKIX_TBS_CERTIFICATE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertificate_verifyPointer +( + NSSPKIXTBSCertificate *p +); +#endif /* DEBUG */ + +/* + * CertificateSerialNumber + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CertificateSerialNumber ::= INTEGER + * + * This is just a typedef'd NSSBER; no methods are required. + * {fgmr -- the asn.1 stuff should have routines to convert + * integers to natural types when possible and vv. we can + * refer to them here..} + */ + +/* + * Validity + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Validity ::= SEQUENCE { + * notBefore Time, + * notAfter Time } + * + * The private calls for the type: + * + * nssPKIXValidity_Decode + * nssPKIXValidity_Create + * nssPKIXValidity_Encode + * nssPKIXValidity_Destroy + * nssPKIXValidity_GetNotBefore + * nssPKIXValidity_SetNotBefore + * nssPKIXValidity_GetNotAfter + * nssPKIXValidity_SetNotAfter + * nssPKIXValidity_Equal + * nssPKIXValidity_Compare + * nssPKIXValidity_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXValidity_verifyPointer + * + */ + +/* + * nssPKIXValidity_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXValidity upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXValidity * +nssPKIXValidity_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXValidity_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_TIME + * + * Return value: + * A valid pointer to an NSSPKIXValidity upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXValidity * +nssPKIXValidity_Create +( + NSSArena *arenaOpt, + NSSPKIXTime notBefore, + NSSPKIXTime notAfter +); + +/* + * nssPKIXValidity_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXValidity_Destroy +( + NSSPKIXValidity *validity +); + +/* + * nssPKIXValidity_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXValidity_Encode +( + NSSPKIXValidity *validity, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXValidity_GetNotBefore + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid NSSPKIXTime upon success + * {we need to rethink NSSPKIXTime} + */ + +NSS_EXTERN NSSPKIXTime +nssPKIXValidity_GetNotBefore +( + NSSPKIXValidity *validity +); + +/* + * nssPKIXValidity_SetNotBefore + * + * -- fgmr comments -- + * {do we require that it be before the "notAfter" value?} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_VALUE_TOO_LARGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXValidity_SetNotBefore +( + NSSPKIXValidity *validity, + NSSPKIXTime notBefore +); + +/* + * nssPKIXValidity_GetNotAfter + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid NSSPKIXTime upon success + * {we need to rethink NSSPKIXTime} + */ + +NSS_EXTERN NSSPKIXTime +nssPKIXValidity_GetNotAfter +( + NSSPKIXValidity *validity +); + +/* + * nssPKIXValidity_SetNotAfter + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_VALUE_TOO_SMALL + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXValidity_SetNotAfter +( + NSSPKIXValidity *validity, + NSSPKIXTime notAfter +); + +/* + * nssPKIXValidity_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXValidity_Equal +( + NSSPKIXValidity *one, + NSSPKIXValidity *two, + PRStatus *statusOpt +); + +/* + * nssPKIXValidity_Compare + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * + * Return value: + * 1 if the second is "greater" or later than the first + * 0 if they are equal + * -1 if the first is "greater" or later than the first + * -2 upon failure + */ + +NSS_EXTERN PRIntn +nssPKIXValidity_Compare +( + NSSPKIXValidity *one, + NSSPKIXValidity *two +); + +/* + * nssPKIXValidity_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_VALIDITY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXValidity upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXValidity * +nssPKIXValidity_Duplicate +( + NSSPKIXValidity *validity, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXValidity_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXValidity + * 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_PKIX_VALIDITY + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXValidity_verifyPointer +( + NSSPKIXValidity *p +); +#endif /* DEBUG */ + +/* + * Time + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Time ::= CHOICE { + * utcTime UTCTime, + * generalTime GeneralizedTime } + * + * The private calls for the type: + * + * nssPKIXTime_Decode + * nssPKIXTime_CreateFromPRTime + * nssPKIXTime_CreateFromUTF8 + * nssPKIXTime_Destroy + * nssPKIXTime_Encode + * nssPKIXTime_GetPRTime + * nssPKIXTime_GetUTF8Encoding + * nssPKIXTime_Equal + * nssPKIXTime_Duplicate + * nssPKIXTime_Compare + * + * In debug builds, the following call is available: + * + * nssPKIXTime_verifyPointer + * + */ + +/* + * nssPKIXTime_Decode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTime upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTime * +nssPKIXTime_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXTime_CreateFromPRTime + * + */ + +NSS_EXTERN NSSPKIXTime * +nssPKIXTime_CreateFromPRTime +( + NSSArena *arenaOpt, + PRTime prTime +); + +/* + * nssPKIXTime_CreateFromUTF8 + * + */ + +NSS_EXTERN NSSPKIXTime * +nssPKIXTime_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXTime_Destroy + * + */ + +NSS_EXTERN PR_STATUS +nssPKIXTime_Destroy +( + NSSPKIXTime *time +); + +/* + * nssPKIXTime_Encode + * + */ + +NSS_EXTERN NSSBER * +nssPKIXTime_Encode +( + NSSPKIXTime *time, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXTime_GetPRTime + * + * Returns a zero on error + */ + +NSS_EXTERN PRTime +nssPKIXTime_GetPRTime +( + NSSPKIXTime *time, + PRStatus *statusOpt +); + +/* + * nssPKIXTime_GetUTF8Encoding + * + */ + +NSS_EXTERN NSSUTF8 * +nssPKXITime_GetUTF8Encoding +( + NSSPKIXTime *time, + NSSArena *arenaOpt +); + +/* + * nssPKIXTime_Equal + * + */ + +NSS_EXTERN PRBool +nssPKXITime_Equal +( + NSSPKXITime *time1, + NSSPKXITime *time2, + PRStatus *statusOpt +); + +/* + * nssPKIXTime_Duplicate + * + */ + +NSS_EXTERN NSSPKIXTime * +nssPKXITime_Duplicate +( + NSSPKIXTime *time, + NSSArena *arenaOpt +); + +/* + * nssPKIXTime_Compare + * + * Usual result: -1, 0, 1 + * Returns 0 on error + */ + +NSS_EXTERN PRInt32 +nssPKIXTime_Compare +( + NSSPKIXTime *time1, + NSSPKIXTime *tiem2, + PRStatus *statusOpt +); + +#ifdef DEBUG +/* + * nssPKIXTime_verifyPointer + * + */ + +NSS_EXTERN PRStatus +nssPKIXTime_verifyPointer +( + NSSPKIXTime *time +); +#endif /* DEBUG */ + +/* + * UniqueIdentifier + * + * From RFC 2459: + * + * UniqueIdentifier ::= BIT STRING + * + */ + +/* + * SubjectPublicKeyInfo + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * SubjectPublicKeyInfo ::= SEQUENCE { + * algorithm AlgorithmIdentifier, + * subjectPublicKey BIT STRING } + * + * The private calls for the type: + * + * nssPKIXSubjectPublicKeyInfo_Decode + * nssPKIXSubjectPublicKeyInfo_Create + * nssPKIXSubjectPublicKeyInfo_Encode + * nssPKIXSubjectPublicKeyInfo_Destroy + * nssPKIXSubjectPublicKeyInfo_GetAlgorithm + * nssPKIXSubjectPublicKeyInfo_SetAlgorithm + * nssPKIXSubjectPublicKeyInfo_GetSubjectPublicKey + * nssPKIXSubjectPublicKeyInfo_SetSubjectPublicKey + * nssPKIXSubjectPublicKeyInfo_Equal + * nssPKIXSubjectPublicKeyInfo_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXSubjectPublicKeyInfo_verifyPointer + * + */ + +/* + * nssPKIXSubjectPublicKeyInfo_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXSubjectPublicKeyInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectPublicKeyInfo * +nssPKIXSubjectPublicKeyInfo_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXSubjectPublicKeyInfo_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXSubjectPublicKeyInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectPublicKeyInfo * +nssPKIXSubjectPublicKeyInfo_Create +( + NSSArena *arenaOpt, + NSSPKIXAlgorithmIdentifier *algid, + NSSItem *subjectPublicKey +); + +/* + * nssPKIXSubjectPublicKeyInfo_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXSubjectPublicKeyInfo_Destroy +( + NSSPKIXSubjectPublicKeyInfo *spki +); + +/* + * nssPKIXSubjectPublicKeyInfo_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXSubjectPublicKeyInfo_Encode +( + NSSPKIXSubjectPublicKeyInfo *spki, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXSubjectPublicKeyInfo_GetAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +nssPKIXSubjectPublicKeyInfo_GetAlgorithm +( + NSSPKIXSubjectPublicKeyInfo *spki, + NSSArena *arenaOpt +); + +/* + * nssPKIXSubjectPublicKeyInfo_SetAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXSubjectPublicKeyInfo_SetAlgorithm +( + NSSPKIXSubjectPublicKeyInfo *spki, + NSSPKIXAlgorithmIdentifier *algid +); + +/* + * nssPKIXSubjectPublicKeyInfo_GetSubjectPublicKey + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +nssPKIXSubjectPublicKeyInfo_GetSubjectPublicKey +( + NSSPKIXSubjectPublicKeyInfo *spki, + NSSItem *spkOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXSubjectPublicKeyInfo_SetSubjectPublicKey + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXSubjectPublicKeyInfo_SetSubjectPublicKey +( + NSSPKIXSubjectPublicKeyInfo *spki, + NSSItem *spk +); + +/* + * nssPKIXSubjectPublicKeyInfo_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXSubjectPublicKeyInfo_Equal +( + NSSPKIXSubjectPublicKeyInfo *one, + NSSPKIXSubjectPublicKeyInfo *two, + PRStatus *statusOpt +); + +/* + * nssPKIXSubjectPublicKeyInfo_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_PUBLIC_KEY_INFO + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXSubjectPublicKeyInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectPublicKeyInfo * +nssPKIXSubjectPublicKeyInfo_Duplicate +( + NSSPKIXSubjectPublicKeyInfo *spki, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXSubjectPublicKeyInfo_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXSubjectPublicKeyInfo + * 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_PKIX_SUBJECT_PUBLIC_KEY_INFO + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXSubjectPublicKeyInfo_verifyPointer +( + NSSPKIXSubjectPublicKeyInfo *p +); +#endif /* DEBUG */ + +/* + * Extensions + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension + * + */ + +/* { FGMR } */ + +/* + * Extension + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Extension ::= SEQUENCE { + * extnID OBJECT IDENTIFIER, + * critical BOOLEAN DEFAULT FALSE, + * extnValue OCTET STRING } + * + */ + +/* { FGMR } */ + +/* + * CertificateList + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CertificateList ::= SEQUENCE { + * tbsCertList TBSCertList, + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING } + * + * The private calls for the type: + * + * nssPKIXCertificateList_Decode + * nssPKIXCertificateList_Create + * nssPKIXCertificateList_Encode + * nssPKIXCertificateList_Destroy + * nssPKIXCertificateList_GetTBSCertList + * nssPKIXCertificateList_SetTBSCertList + * nssPKIXCertificateList_GetSignatureAlgorithm + * nssPKIXCertificateList_SetSignatureAlgorithm + * nssPKIXCertificateList_GetSignature + * nssPKIXCertificateList_SetSignature + * nssPKIXCertificateList_Equal + * nssPKIXCertificateList_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXCertificateList_verifyPointer + * + */ + +/* + * nssPKIXCertificateList_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCertificateList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificateList * +nssPKIXCertificateList_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXCertificateList_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXCertificateList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificateList * +nssPKIXCertificateList_Create +( + NSSArena *arenaOpt, + NSSPKIXTBSCertList *tbsCertList, + NSSPKIXAlgorithmIdentifier *sigAlg, + NSSItem *signature +); + +/* + * nssPKIXCertificateList_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificateList_Destroy +( + NSSPKIXCertificateList *certList +); + +/* + * nssPKIXCertificateList_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXCertificateList_Encode +( + NSSPKIXCertificateList *certList, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXCertificateList_GetTBSCertList + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertList * +nssPKIXCertificateList_GetTBSCertList +( + NSSPKIXCertificateList *certList, + NSSArena *arenaOpt +); + +/* + * nssPKIXCertificateList_SetTBSCertList + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificateList_SetTBSCertList +( + NSSPKIXCertificateList *certList, + NSSPKIXTBSCertList *tbsCertList +); + +/* + * nssPKIXCertificateList_GetSignatureAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +nssPKIXCertificateList_GetSignatureAlgorithm +( + NSSPKIXCertificateList *certList, + NSSArena *arenaOpt +); + +/* + * nssPKIXCertificateList_SetSignatureAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificateList_SetSignatureAlgorithm +( + NSSPKIXCertificateList *certList, + NSSPKIXAlgorithmIdentifier *sigAlg +); + +/* + * nssPKIXCertificateList_GetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +nssPKIXCertificateList_GetSignature +( + NSSPKIXCertificateList *certList, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXCertificateList_SetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificateList_SetSignature +( + NSSPKIXCertificateList *certList, + NSSItem *sig +); + +/* + * nssPKIXCertificateList_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXCertificateList_Equal +( + NSSPKIXCertificateList *one, + NSSPKIXCertificateList *two, + PRStatus *statusOpt +); + +/* + * nssPKIXCertificateList_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXCertificateList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificateList * +nssPKIXCertificateList_Duplicate +( + NSSPKIXCertificateList *certList, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXCertificateList_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXCertificateList + * 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_PKIX_CERTIFICATE_LIST + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXCertificateList_verifyPointer +( + NSSPKIXCertificateList *p +); +#endif /* DEBUG */ + +/* + * TBSCertList + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TBSCertList ::= SEQUENCE { + * version Version OPTIONAL, + * -- if present, shall be v2 + * signature AlgorithmIdentifier, + * issuer Name, + * thisUpdate Time, + * nextUpdate Time OPTIONAL, + * revokedCertificates SEQUENCE OF SEQUENCE { + * userCertificate CertificateSerialNumber, + * revocationDate Time, + * crlEntryExtensions Extensions OPTIONAL + * -- if present, shall be v2 + * } OPTIONAL, + * crlExtensions [0] Extensions OPTIONAL + * -- if present, shall be v2 -- } + * + * The private calls for the type: + * + * nssPKIXTBSCertList_Decode + * nssPKIXTBSCertList_Create + * nssPKIXTBSCertList_Destroy + * nssPKIXTBSCertList_Encode + * nssPKIXTBSCertList_GetVersion + * nssPKIXTBSCertList_SetVersion + * nssPKIXTBSCertList_GetSignature + * nssPKIXTBSCertList_SetSignature + * nssPKIXTBSCertList_GetIssuer + * nssPKIXTBSCertList_SetIssuer + * nssPKIXTBSCertList_GetThisUpdate + * nssPKIXTBSCertList_SetThisUpdate + * nssPKIXTBSCertList_HasNextUpdate + * nssPKIXTBSCertList_GetNextUpdate + * nssPKIXTBSCertList_SetNextUpdate + * nssPKIXTBSCertList_RemoveNextUpdate + * nssPKIXTBSCertList_GetRevokedCertificates + * nssPKIXTBSCertList_SetRevokedCertificates + * nssPKIXTBSCertList_HasCrlExtensions + * nssPKIXTBSCertList_GetCrlExtensions + * nssPKIXTBSCertList_SetCrlExtensions + * nssPKIXTBSCertList_RemoveCrlExtensions + * nssPKIXTBSCertList_Equal + * nssPKIXTBSCertList_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXTBSCertList_verifyPointer + * + */ + +/* + * nssPKIXTBSCertList_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertList * +nssPKIXTBSCertList_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXTBSCertList_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_VERSION + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_PKIX_TIME + * (something for the times being out of order?) + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_PKIX_EXTENSIONS + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertList * +nssPKIXTBSCertList_Create +( + NSSArena *arenaOpt, + NSSPKIXVersion version, + NSSPKIXAlgorithmIdentifier *signature, + NSSPKIXName *issuer, + NSSPKIXTime thisUpdate, + NSSPKIXTime nextUpdateOpt, + NSSPKIXrevokedCertificates *revokedCerts, + NSSPKIXExtensions *crlExtensionsOpt +); + +/* + * nssPKIXTBSCertList_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertList_Destroy +( + NSSPKIXTBSCertList *certList +); + +/* + * nssPKIXTBSCertList_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXTBSCertList_Encode +( + NSSPKIXTBSCertList *certList, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertList_GetVersion + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid element of the NSSPKIXVersion enumeration upon success + * NSSPKIXVersion_NSSinvalid (-1) upon failure + */ + +NSS_EXTERN NSSPKIXVersion +nssPKIXTBSCertList_GetVersion +( + NSSPKIXTBSCertList *certList +); + +/* + * nssPKIXTBSCertList_SetVersion + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_PKIX_VERSION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertList_SetVersion +( + NSSPKIXTBSCertList *certList, + NSSPKIXVersion version +); + +/* + * nssPKIXTBSCertList_GetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +nssPKIXTBSCertList_GetSignature +( + NSSPKIXTBSCertList *certList, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertList_SetSignature + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertList_SetSignature +( + NSSPKIXTBSCertList *certList, + NSSPKIXAlgorithmIdentifier *algid, +); + +/* + * nssPKIXTBSCertList_GetIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +nssPKIXTBSCertList_GetIssuer +( + NSSPKIXTBSCertList *certList, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertList_SetIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertList_SetIssuer +( + NSSPKIXTBSCertList *certList, + NSSPKIXName *issuer +); + +/* + * nssPKIXTBSCertList_GetThisUpdate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid NSSPKIXTime upon success + * {we need to rethink NSSPKIXTime} + */ + +NSS_EXTERN NSSPKIXTime +nssPKIXTBSCertList_GetThisUpdate +( + NSSPKIXTBSCertList *certList +); + +/* + * nssPKIXTBSCertList_SetThisUpdate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_VALUE_TOO_LARGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertList_SetThisUpdate +( + NSSPKIXTBSCertList *certList, + NSSPKIXTime thisUpdate +); + +/* + * nssPKIXTBSCertList_HasNextUpdate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXTBSCertList_HasNextUpdate +( + NSSPKIXTBSCertList *certList, + PRStatus *statusOpt +); + +/* + * nssPKIXTBSCertList_GetNextUpdate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid NSSPKIXTime upon success + * {we need to rethink NSSPKIXTime} + */ + +NSS_EXTERN NSSPKIXTime +nssPKIXTBSCertList_GetNextUpdate +( + NSSPKIXTBSCertList *certList +); + +/* + * nssPKIXTBSCertList_SetNextUpdate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_VALUE_TOO_SMALL + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertList_SetNextUpdate +( + NSSPKIXTBSCertList *certList, + NSSPKIXTime nextUpdate +); + +/* + * nssPKIXTBSCertList_RemoveNextUpdate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_HAS_NO_NEXT_UPDATE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertList_RemoveNextUpdate +( + NSSPKIXTBSCertList *certList +); + +/* + * nssPKIXTBSCertList_GetRevokedCertificates + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificates upon succes + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificates * +nssPKIXTBSCertList_GetRevokedCertificates +( + NSSPKIXTBSCertList *certList, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertList_SetRevokedCertificates + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATES + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertList_SetRevokedCertificates +( + NSSPKIXTBSCertList *certList, + NSSPKIXrevokedCertificates *revoked +); + +/* + * nssPKIXTBSCertList_HasCrlExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXTBSCertList_HasCrlExtensions +( + NSSPKIXTBSCertList *certList, + PRStatus *statusOpt +); + +/* + * nssPKIXTBSCertList_GetCrlExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXExtensions upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensions * +nssPKIXTBSCertList_GetCrlExtensions +( + NSSPKIXTBSCertList *certList, + NSSArena *arenaOpt +); + +/* + * nssPKIXTBSCertList_SetCrlExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_PKIX_EXTENSIONS + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertList_SetCrlExtensions +( + NSSPKIXTBSCertList *certList, + NSSPKIXExtensions *extensions +); + +/* + * nssPKIXTBSCertList_RemoveCrlExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_HAS_NO_EXTENSIONS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertList_RemoveCrlExtensions +( + NSSPKIXTBSCertList *certList +); + +/* + * nssPKIXTBSCertList_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXTBSCertList_Equal +( + NSSPKIXTBSCertList *one, + NSSPKIXTBSCertList *two, + PRStatus *statusOpt +); + +/* + * nssPKIXTBSCertList_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TBS_CERT_LIST + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXTBSCertList upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTBSCertList * +nssPKIXTBSCertList_Duplicate +( + NSSPKIXTBSCertList *certList, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXTBSCertList_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXTBSCertList + * 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_PKIX_TBS_CERT_LIST + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXTBSCertList_verifyPointer +( + NSSPKIXTBSCertList *p +); +#endif /* DEBUG */ + +/* + * revokedCertificates + * + * This is a "helper type" to simplify handling of TBSCertList objects. + * + * revokedCertificates SEQUENCE OF SEQUENCE { + * userCertificate CertificateSerialNumber, + * revocationDate Time, + * crlEntryExtensions Extensions OPTIONAL + * -- if present, shall be v2 + * } OPTIONAL, + * + * The private calls for the type: + * + * nssPKIXrevokedCertificates_Decode + * nssPKIXrevokedCertificates_Create + * nssPKIXrevokedCertificates_Encode + * nssPKIXrevokedCertificates_Destroy + * nssPKIXrevokedCertificates_GetRevokedCertificateCount + * nssPKIXrevokedCertificates_GetRevokedCertificates + * nssPKIXrevokedCertificates_SetRevokedCertificates + * nssPKIXrevokedCertificates_GetRevokedCertificate + * nssPKIXrevokedCertificates_SetRevokedCertificate + * nssPKIXrevokedCertificates_InsertRevokedCertificate + * nssPKIXrevokedCertificates_AppendRevokedCertificate + * nssPKIXrevokedCertificates_RemoveRevokedCertificate + * nssPKIXrevokedCertificates_Equal + * nssPKIXrevokedCertificates_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXrevokedCertificates_verifyPointer + * + */ + +/* + * nssPKIXrevokedCertificates_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificates upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificates * +nssPKIXrevokedCertificates_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXrevokedCertificates_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_REVOKED_CERTIFICATE + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificates upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificates * +nssPKIXrevokedCertificates_Create +( + NSSArena *arenaOpt, + NSSPKIXrevokedCertificate *rc1, + ... +); + +/* + * nssPKIXrevokedCertificates_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXrevokedCertificates_Destroy +( + NSSPKIXrevokedCertificates *rcs +); + +/* + * nssPKIXrevokedCertificates_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXrevokedCertificates_Encode +( + NSSPKIXrevokedCertificates *rcs, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXrevokedCertificates_GetRevokedCertificateCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXrevokedCertificates_GetRevokedCertificateCount +( + NSSPKIXrevokedCertificates *rcs +); + +/* + * nssPKIXrevokedCertificates_GetRevokedCertificates + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXrevokedCertificate pointers + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificate ** +nssPKIXrevokedCertificates_GetRevokedCertificates +( + NSSPKIXrevokedCertificates *rcs, + NSSPKIXrevokedCertificate *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXrevokedCertificates_SetRevokedCertificates + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_REVOKED_CERTIFICATE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXrevokedCertificates_SetRevokedCertificates +( + NSSPKIXrevokedCertificates *rcs, + NSSPKIXrevokedCertificate *rc[], + PRInt32 countOpt +); + +/* + * nssPKIXrevokedCertificates_GetRevokedCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificate * +nssPKIXrevokedCertificates_GetRevokedCertificate +( + NSSPKIXrevokedCertificates *rcs, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXrevokedCertificates_SetRevokedCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_REVOKED_CERTIFICATE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXrevokedCertificates_SetRevokedCertificate +( + NSSPKIXrevokedCertificates *rcs, + PRInt32 i, + NSSPKIXrevokedCertificate *rc +); + +/* + * nssPKIXrevokedCertificates_InsertRevokedCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_REVOKED_CERTIFICATE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXrevokedCertificates_InsertRevokedCertificate +( + NSSPKIXrevokedCertificates *rcs, + PRInt32 i, + NSSPKIXrevokedCertificate *rc +); + +/* + * nssPKIXrevokedCertificates_AppendRevokedCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_REVOKED_CERTIFICATE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXrevokedCertificates_AppendRevokedCertificate +( + NSSPKIXrevokedCertificates *rcs, + PRInt32 i, + NSSPKIXrevokedCertificate *rc +); + +/* + * nssPKIXrevokedCertificates_RemoveRevokedCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXrevokedCertificates_RemoveRevokedCertificate +( + NSSPKIXrevokedCertificates *rcs, + PRInt32 i +); + +/* + * nssPKIXrevokedCertificates_FindRevokedCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_REVOKED_CERTIFICATE + * + * Return value: + * The index of the specified revoked certificate upon success + * -1 upon failure + */ + +NSS_EXTERN PRInt32 +nssPKIXrevokedCertificates_FindRevokedCertificate +( + NSSPKIXrevokedCertificates *rcs, + NSSPKIXrevokedCertificate *rc +); + +/* + * nssPKIXrevokedCertificates_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXrevokedCertificates_Equal +( + NSSPKIXrevokedCertificates *one, + NSSPKIXrevokedCertificates *two, + PRStatus *statusOpt +); + +/* + * nssPKIXrevokedCertificates_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_REVOKED_CERTIFICATES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificates upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificates * +nssPKIXrevokedCertificates_Duplicate +( + NSSPKIXrevokedCertificates *rcs, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXrevokedCertificates_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXrevokedCertificates + * 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_PKIX_REVOKED_CERTIFICATES + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXrevokedCertificates_verifyPointer +( + NSSPKIXrevokedCertificates *p +); +#endif /* DEBUG */ + +/* + * revokedCertificate + * + * This is a "helper type" to simplify handling of TBSCertList objects. + * + * SEQUENCE { + * userCertificate CertificateSerialNumber, + * revocationDate Time, + * crlEntryExtensions Extensions OPTIONAL + * -- if present, shall be v2 + * } OPTIONAL, + * + * The private calls for this type: + * + * nssPKIXrevokedCertificate_Decode + * nssPKIXrevokedCertificate_Create + * nssPKIXrevokedCertificate_Encode + * nssPKIXrevokedCertificate_Destroy + * nssPKIXrevokedCertificate_GetUserCertificate + * nssPKIXrevokedCertificate_SetUserCertificate + * nssPKIXrevokedCertificate_GetRevocationDate + * nssPKIXrevokedCertificate_SetRevocationDate + * nssPKIXrevokedCertificate_HasCrlEntryExtensions + * nssPKIXrevokedCertificate_GetCrlEntryExtensions + * nssPKIXrevokedCertificate_SetCrlEntryExtensions + * nssPKIXrevokedCertificate_RemoveCrlEntryExtensions + * nssPKIXrevokedCertificate_Equal + * nssPKIXrevokedCertificate_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXrevokedCertificate_verifyPointer + * + */ + + +/* + * nssPKIXrevokedCertificate_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificate * +nssPKIXrevokedCertificate_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXrevokedCertificate_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_SERIAL_NUMBER + * NSS_ERROR_INVALID_PKIX_TIME + * NSS_ERROR_INVALID_PKIX_EXTENSIONS + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificate * +nssPKIXrevokedCertificate_Create +( + NSSArena *arenaOpt, + NSSPKIXCertificateSerialNumber *userCertificate, + NSSPKIXTime *revocationDate, + NSSPKIXExtensions *crlEntryExtensionsOpt +); + +/* + * nssPKIXrevokedCertificate_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXrevokedCertificate_Destroy +( + NSSPKIXrevokedCertificate *rc +); + +/* + * nssPKIXrevokedCertificate_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXrevokedCertificate_Encode +( + NSSPKIXrevokedCertificate *rc, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXrevokedCertificate_GetUserCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXCertificateSerialNumber upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificateSerialNumber * +nssPKIXrevokedCertificate_GetUserCertificate +( + NSSPKIXrevokedCertificate *rc, + NSSArena *arenaOpt +); + +/* + * nssPKIXrevokedCertificate_SetUserCertificate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_SERIAL_NUMBER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXrevokedCertificate_SetUserCertificate +( + NSSPKIXrevokedCertificate *rc, + NSSPKIXCertificateSerialNumber *csn +); + +/* + * nssPKIXrevokedCertificate_GetRevocationDate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXTime upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTime * +nssPKIXrevokedCertificate_GetRevocationDate +( + NSSPKIXrevokedCertificate *rc, + NSSArena *arenaOpt +); + +/* + * nssPKIXrevokedCertificate_SetRevocationDate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_TIME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXrevokedCertificate_SetRevocationDate +( + NSSPKIXrevokedCertificate *rc, + NSSPKIXTime *revocationDate +); + +/* + * nssPKIXrevokedCertificate_HasCrlEntryExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXrevokedCertificate_HasCrlEntryExtensions +( + NSSPKIXrevokedCertificate *rc, + PRStatus *statusOpt +); + +/* + * nssPKIXrevokedCertificate_GetCrlEntryExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_NO_EXTENSIONS + * + * Return value: + * A valid pointer to an NSSPKIXExtensions upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensions * +nssPKIXrevokedCertificate_GetCrlEntryExtensions +( + NSSPKIXrevokedCertificate *rc, + NSSArena *arenaOpt +); + +/* + * nssPKIXrevokedCertificate_SetCrlEntryExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_EXTENSIONS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXrevokedCertificate_SetCrlEntryExtensions +( + NSSPKIXrevokedCertificate *rc, + NSSPKIXExtensions *crlEntryExtensions +); + +/* + * nssPKIXrevokedCertificate_RemoveCrlEntryExtensions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * NSS_ERROR_NO_EXTENSIONS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXrevokedCertificate_RemoveCrlEntryExtensions +( + NSSPKIXrevokedCertificate *rc +); + +/* + * nssPKIXrevokedCertificate_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXrevokedCertificate_Equal +( + NSSPKIXrevokedCertificate *one, + NSSPKIXrevokedCertificate *two, + PRStatus *statusOpt +); + +/* + * nssPKIXrevokedCertificate_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REVOKED_CERTIFICATE + * + * Return value: + * A valid pointer to an NSSPKIXrevokedCertificate upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXrevokedCertificate * +nssPKIXrevokedCertificate_Duplicate +( + NSSPKIXrevokedCertificate *rc, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXrevokedCertificate_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXrevokedCertificate + * 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_PKIX_REVOKED_CERTIFICATE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXrevokedCertificate_verifyPointer +( + NSSPKIXrevokedCertificate *p +); +#endif /* DEBUG */ + +/* + * AlgorithmIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * (1988 syntax) + * + * AlgorithmIdentifier ::= SEQUENCE { + * algorithm OBJECT IDENTIFIER, + * parameters ANY DEFINED BY algorithm OPTIONAL } + * -- contains a value of the type + * -- registered for use with the + * -- algorithm object identifier value + * + * The private calls for this type: + * + * nssPKIXAlgorithmIdentifier_Decode + * nssPKIXAlgorithmIdentifier_Create + * nssPKIXAlgorithmIdentifier_Encode + * nssPKIXAlgorithmIdentifier_Destroy + * nssPKIXAlgorithmIdentifier_GetAlgorithm + * nssPKIXAlgorithmIdentifier_SetAlgorithm + * nssPKIXAlgorithmIdentifier_GetParameters + * nssPKIXAlgorithmIdentifier_SetParameters + * nssPKIXAlgorithmIdentifier_Compare + * nssPKIXAlgorithmIdentifier_Duplicate + * { algorithm-specific parameter types and accessors ? } + * + * In debug builds, the following call is available: + * + * nssPKIXAlgorithmIdentifier_verifyPointer + * + */ + +/* + * nssPKIXAlgorithmIdentifier_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +nssPKIXAlgorithmIdentifier_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXAlgorithmIdentifier_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_POINTER + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +nssPKIXAlgorithmIdentifier_Create +( + NSSArena *arenaOpt, + NSSOID *algorithm, + NSSItem *parameters +); + +/* + * nssPKIXAlgorithmIdentifier_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAlgorithmIdentifier_Destroy +( + NSSPKIXAlgorithmIdentifier *algid +); + +/* + * nssPKIXAlgorithmIdentifier_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXAlgorithmIdentifier_Encode +( + NSSPKIXAlgorithmIdentifier *algid, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXAlgorithmIdentifier_GetAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSOID pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSOID * +nssPKIXAlgorithmIdentifier_GetAlgorithm +( + NSSPKIXAlgorithmIdentifier *algid +); + +/* + * nssPKIXAlgorithmIdentifier_SetAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_OID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAlgorithmIdentifier_SetAlgorithm +( + NSSPKIXAlgorithmIdentifier *algid, + NSSOID *algorithm +); + +/* + * nssPKIXAlgorithmIdentifier_GetParameters + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +nssPKIXAlgorithmIdentifier_GetParameters +( + NSSPKIXAlgorithmIdentifier *algid, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXAlgorithmIdentifier_SetParameters + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_POINTER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAlgorithmIdentifier_SetParameters +( + NSSPKIXAlgorithmIdentifier *algid, + NSSItem *parameters +); + +/* + * nssPKIXAlgorithmIdentifier_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXAlgorithmIdentifier_Equal +( + NSSPKIXAlgorithmIdentifier *algid1, + NSSPKIXAlgorithmIdentifier *algid2, + PRStatus *statusOpt +); + +/* + * nssPKIXAlgorithmIdentifier_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAlgorithmIdentifier * +nssPKIXAlgorithmIdentifier_Duplicate +( + NSSPKIXAlgorithmIdentifier *algid, + NSSArena *arenaOpt +); + +/* + * { algorithm-specific parameter types and accessors ? } + */ + +#ifdef DEBUG +/* + * nssPKIXAlgorithmIdentifier_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXAlgorithmIdentifier + * 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_PKIX_ALGORITHM_IDENTIFIER + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXAlgorithmIdentifier_verifyPointer +( + NSSPKIXAlgorithmIdentifier *p +); +#endif /* DEBUG */ + +/* + * ORAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ORAddress ::= SEQUENCE { + * built-in-standard-attributes BuiltInStandardAttributes, + * built-in-domain-defined-attributes + * BuiltInDomainDefinedAttributes OPTIONAL, + * -- see also teletex-domain-defined-attributes + * extension-attributes ExtensionAttributes OPTIONAL } + * -- The OR-address is semantically absent from the OR-name if the + * -- built-in-standard-attribute sequence is empty and the + * -- built-in-domain-defined-attributes and extension-attributes are + * -- both omitted. + * + * The private calls for this type: + * + * nssPKIXORAddress_Decode + * nssPKIXORAddress_Create + * nssPKIXORAddress_Destroy + * nssPKIXORAddress_Encode + * nssPKIXORAddress_GetBuiltInStandardAttributes + * nssPKIXORAddress_SetBuiltInStandardAttributes + * nssPKIXORAddress_HasBuiltInDomainDefinedAttributes + * nssPKIXORAddress_GetBuiltInDomainDefinedAttributes + * nssPKIXORAddress_SetBuiltInDomainDefinedAttributes + * nssPKIXORAddress_RemoveBuiltInDomainDefinedAttributes + * nssPKIXORAddress_HasExtensionsAttributes + * nssPKIXORAddress_GetExtensionsAttributes + * nssPKIXORAddress_SetExtensionsAttributes + * nssPKIXORAddress_RemoveExtensionsAttributes + * nssPKIXORAddress_Equal + * nssPKIXORAddress_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXORAddress_verifyPointer + * + */ + +/* + * nssPKIXORAddress_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXORAddres upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXORAddress * +nssPKIXORAddress_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXORAddress_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_EXTENSIONS_ATTRIBUTES + * + * Return value: + * A valid pointer to an NSSPKIXORAddres upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXORAddress * +nssPKIXORAddress_Create +( + NSSArena *arenaOpt, + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXBuiltInDomainDefinedAttributes *biddaOpt, + NSSPKIXExtensionAttributes *eaOpt +); + +/* + * nssPKIXORAddress_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXORAddress_Destroy +( + NSSPKIXORAddress *ora +); + +/* + * nssPKIXORAddress_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXORAddress_Encode +( + NSSPKIXORAddress *ora, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXORAddress_GetBuiltInStandardAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInStandardAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInStandardAttributes * +nssPKIXORAddress_GetBuiltInStandardAttributes +( + NSSPKIXORAddress *ora, + NSSArena *arenaOpt +); + +/* + * nssPKIXORAddress_SetBuiltInStandardAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXORAddress_SetBuiltInStandardAttributes +( + NSSPKIXORAddress *ora, + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * nssPKIXORAddress_HasBuiltInDomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXORAddress_HasBuiltInDomainDefinedAttributes +( + NSSPKIXORAddress *ora, + PRStatus *statusOpt +); + +/* + * nssPKIXORAddress_GetBuiltInDomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_NO_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttributes upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttributes * +nssPKIXORAddress_GetBuiltInDomainDefinedAttributes +( + NSSPKIXORAddress *ora, + NSSArena *arenaOpt +); + +/* + * nssPKIXORAddress_SetBuiltInDomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXORAddress_SetBuiltInDomainDefinedAttributes +( + NSSPKIXORAddress *ora, + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * nssPKIXORAddress_RemoveBuiltInDomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_NO_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXORAddress_RemoveBuiltInDomainDefinedAttributes +( + NSSPKIXORAddress *ora +); + +/* + * nssPKIXORAddress_HasExtensionsAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXORAddress_HasExtensionsAttributes +( + NSSPKIXORAddress *ora, + PRStatus *statusOpt +); + +/* + * nssPKIXORAddress_GetExtensionsAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_NO_EXTENSION_ATTRIBUTES + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttributes * +nssPKIXORAddress_GetExtensionsAttributes +( + NSSPKIXORAddress *ora, + NSSArena *arenaOpt +); + +/* + * nssPKIXORAddress_SetExtensionsAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXORAddress_SetExtensionsAttributes +( + NSSPKIXORAddress *ora, + NSSPKIXExtensionAttributes *eaOpt +); + +/* + * nssPKIXORAddress_RemoveExtensionsAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_NO_EXTENSION_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXORAddress_RemoveExtensionsAttributes +( + NSSPKIXORAddress *ora +); + +/* + * nssPKIXORAddress_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXORAddress_Equal +( + NSSPKIXORAddress *ora1, + NSSPKIXORAddress *ora2, + PRStatus *statusOpt +); + +/* + * nssPKIXORAddress_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXORAddres upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXORAddress * +nssPKIXORAddress_Duplicate +( + NSSPKIXORAddress *ora, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXORAddress_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXORAddress + * 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_PKIX_OR_ADDRESS + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXORAddress_verifyPointer +( + NSSPKIXORAddress *p +); +#endif /* DEBUG */ + +/* + * BuiltInStandardAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BuiltInStandardAttributes ::= SEQUENCE { + * country-name CountryName OPTIONAL, + * administration-domain-name AdministrationDomainName OPTIONAL, + * network-address [0] NetworkAddress OPTIONAL, + * -- see also extended-network-address + * terminal-identifier [1] TerminalIdentifier OPTIONAL, + * private-domain-name [2] PrivateDomainName OPTIONAL, + * organization-name [3] OrganizationName OPTIONAL, + * -- see also teletex-organization-name + * numeric-user-identifier [4] NumericUserIdentifier OPTIONAL, + * personal-name [5] PersonalName OPTIONAL, + * -- see also teletex-personal-name + * organizational-unit-names [6] OrganizationalUnitNames OPTIONAL + * -- see also teletex-organizational-unit-names -- } + * + * The private calls for this type: + * + * nssPKIXBuiltInStandardAttributes_Decode + * nssPKIXBuiltInStandardAttributes_Create + * nssPKIXBuiltInStandardAttributes_Destroy + * nssPKIXBuiltInStandardAttributes_Encode + * nssPKIXBuiltInStandardAttributes_HasCountryName + * nssPKIXBuiltInStandardAttributes_GetCountryName + * nssPKIXBuiltInStandardAttributes_SetCountryName + * nssPKIXBuiltInStandardAttributes_RemoveCountryName + * nssPKIXBuiltInStandardAttributes_HasAdministrationDomainName + * nssPKIXBuiltInStandardAttributes_GetAdministrationDomainName + * nssPKIXBuiltInStandardAttributes_SetAdministrationDomainName + * nssPKIXBuiltInStandardAttributes_RemoveAdministrationDomainName + * nssPKIXBuiltInStandardAttributes_HasNetworkAddress + * nssPKIXBuiltInStandardAttributes_GetNetworkAddress + * nssPKIXBuiltInStandardAttributes_SetNetworkAddress + * nssPKIXBuiltInStandardAttributes_RemoveNetworkAddress + * nssPKIXBuiltInStandardAttributes_HasTerminalIdentifier + * nssPKIXBuiltInStandardAttributes_GetTerminalIdentifier + * nssPKIXBuiltInStandardAttributes_SetTerminalIdentifier + * nssPKIXBuiltInStandardAttributes_RemoveTerminalIdentifier + * nssPKIXBuiltInStandardAttributes_HasPrivateDomainName + * nssPKIXBuiltInStandardAttributes_GetPrivateDomainName + * nssPKIXBuiltInStandardAttributes_SetPrivateDomainName + * nssPKIXBuiltInStandardAttributes_RemovePrivateDomainName + * nssPKIXBuiltInStandardAttributes_HasOrganizationName + * nssPKIXBuiltInStandardAttributes_GetOrganizationName + * nssPKIXBuiltInStandardAttributes_SetOrganizationName + * nssPKIXBuiltInStandardAttributes_RemoveOrganizationName + * nssPKIXBuiltInStandardAttributes_HasNumericUserIdentifier + * nssPKIXBuiltInStandardAttributes_GetNumericUserIdentifier + * nssPKIXBuiltInStandardAttributes_SetNumericUserIdentifier + * nssPKIXBuiltInStandardAttributes_RemoveNumericUserIdentifier + * nssPKIXBuiltInStandardAttributes_HasPersonalName + * nssPKIXBuiltInStandardAttributes_GetPersonalName + * nssPKIXBuiltInStandardAttributes_SetPersonalName + * nssPKIXBuiltInStandardAttributes_RemovePersonalName + * nssPKIXBuiltInStandardAttributes_HasOrganizationLUnitNames + * nssPKIXBuiltInStandardAttributes_GetOrganizationLUnitNames + * nssPKIXBuiltInStandardAttributes_SetOrganizationLUnitNames + * nssPKIXBuiltInStandardAttributes_RemoveOrganizationLUnitNames + * nssPKIXBuiltInStandardAttributes_Equal + * nssPKIXBuiltInStandardAttributes_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXBuiltInStandardAttributes_verifyPointer + * + */ + +/* + * nssPKIXBuiltInStandardAttributes_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInStandardAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInStandardAttributes * +nssPKIXBuiltInStandardAttributes_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXBuiltInStandardAttributes_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_COUNTRY_NAME + * NSS_ERROR_INVALID_PKIX_ADMINISTRATION_DOMAIN_NAME + * NSS_ERROR_INVALID_PKIX_NETWORK_ADDRESS + * NSS_ERROR_INVALID_PKIX_TERMINAL_IDENTIFIER + * NSS_ERROR_INVALID_PKIX_PRIVATE_DOMAIN_NAME + * NSS_ERROR_INVALID_PKIX_ORGANIZATION_NAME + * NSS_ERROR_INVALID_PKIX_NUMERIC_USER_IDENTIFIER + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInStandardAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInStandardAttributes * +nssPKIXBuiltInStandardAttributes_Create +( + NSSArena *arenaOpt, + NSSPKIXCountryName *countryNameOpt, + NSSPKIXAdministrationDomainName *administrationDomainNameOpt, + NSSPKIXNetworkAddress *networkAddressOpt, + NSSPKIXTerminalIdentifier *terminalIdentifierOpt, + NSSPKIXPrivateDomainName *privateDomainNameOpt, + NSSPKIXOrganizationName *organizationNameOpt, + NSSPKIXNumericUserIdentifier *numericUserIdentifierOpt, + NSSPKIXPersonalName *personalNameOpt, + NSSPKIXOrganizationalUnitNames *organizationalUnitNamesOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_Destroy +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * nssPKIXBuiltInStandardAttributes_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXBuiltInStandardAttributes_Encode +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_HasCountryName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXBuiltInStandardAttributes_HasCountryName +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_GetCountryName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCountryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCountryName * +nssPKIXBuiltInStandardAttributes_GetCountryName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_SetCountryName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_COUNTRY_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_SetCountryName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXCountryName *countryName +); + +/* + * nssPKIXBuiltInStandardAttributes_RemoveCountryName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_COUNTRY_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_RemoveCountryName +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * nssPKIXBuiltInStandardAttributes_HasAdministrationDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXBuiltInStandardAttributes_HasAdministrationDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_GetAdministrationDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAdministrationDomainName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAdministrationDomainName * +nssPKIXBuiltInStandardAttributes_GetAdministrationDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_SetAdministrationDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_ADMINISTRATION_DOMAIN_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_SetAdministrationDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXAdministrationDomainName *administrationDomainName +); + +/* + * nssPKIXBuiltInStandardAttributes_RemoveAdministrationDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_ADMINISTRATION_DOMAIN_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_RemoveAdministrationDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * nssPKIXBuiltInStandardAttributes_HasNetworkAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXBuiltInStandardAttributes_HasNetworkAddress +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_GetNetworkAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNetworkAddress * +nssPKIXBuiltInStandardAttributes_GetNetworkAddress +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_SetNetworkAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_NETWORK_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_SetNetworkAddress +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXNetworkAddress *networkAddress +); + +/* + * nssPKIXBuiltInStandardAttributes_RemoveNetworkAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_NETWORK_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_RemoveNetworkAddress +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * nssPKIXBuiltInStandardAttributes_HasTerminalIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXBuiltInStandardAttributes_HasTerminalIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_GetTerminalIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTerminalIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTerminalIdentifier * +nssPKIXBuiltInStandardAttributes_GetTerminalIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_SetTerminalIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_TERMINAL_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_SetTerminalIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXTerminalIdentifier *terminalIdentifier +); + +/* + * nssPKIXBuiltInStandardAttributes_RemoveTerminalIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_TERMINAL_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_RemoveTerminalIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * nssPKIXBuiltInStandardAttributes_HasPrivateDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXBuiltInStandardAttributes_HasPrivateDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_GetPrivateDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPrivateDomainName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPrivateDomainName * +nssPKIXBuiltInStandardAttributes_GetPrivateDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_SetPrivateDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_PRIVATE_DOMAIN_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_SetPrivateDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXPrivateDomainName *privateDomainName +); + +/* + * nssPKIXBuiltInStandardAttributes_RemovePrivateDomainName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_PRIVATE_DOMAIN_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_RemovePrivateDomainName +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * nssPKIXBuiltInStandardAttributes_HasOrganizationName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXBuiltInStandardAttributes_HasOrganizationName +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_GetOrganizationName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationName * +nssPKIXBuiltInStandardAttributes_GetOrganizationName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_SetOrganizationName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_ORGANIZATION_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_SetOrganizationName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXOrganizationName *organizationName +); + +/* + * nssPKIXBuiltInStandardAttributes_RemoveOrganizationName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_ORGANIZATION_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_RemoveOrganizationName +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * nssPKIXBuiltInStandardAttributes_HasNumericUserIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXBuiltInStandardAttributes_HasNumericUserIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_GetNumericUserIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNumericUserIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNumericUserIdentifier * +nssPKIXBuiltInStandardAttributes_GetNumericUserIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_SetNumericUserIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_NUMERIC_USER_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_SetNumericUserIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXNumericUserIdentifier *numericUserIdentifier +); + +/* + * nssPKIXBuiltInStandardAttributes_RemoveNumericUserIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_NUMERIC_USER_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_RemoveNumericUserIdentifier +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * nssPKIXBuiltInStandardAttributes_HasPersonalName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXBuiltInStandardAttributes_HasPersonalName +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_GetPersonalName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPersonalName * +nssPKIXBuiltInStandardAttributes_GetPersonalName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_SetPersonalName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_SetPersonalName +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXPersonalName *personalName +); + +/* + * nssPKIXBuiltInStandardAttributes_RemovePersonalName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_RemovePersonalName +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * nssPKIXBuiltInStandardAttributes_HasOrganizationLUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXBuiltInStandardAttributes_HasOrganizationLUnitNames +( + NSSPKIXBuiltInStandardAttributes *bisa, + PRStatus *statusOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_GetOrganizationLUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitNames * +nssPKIXBuiltInStandardAttributes_GetOrganizationLUnitNames +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_SetOrganizationLUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_SetOrganizationLUnitNames +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSPKIXOrganizationalUnitNames *organizationalUnitNames +); + +/* + * nssPKIXBuiltInStandardAttributes_RemoveOrganizationLUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_RemoveOrganizationLUnitNames +( + NSSPKIXBuiltInStandardAttributes *bisa +); + +/* + * nssPKIXBuiltInStandardAttributes_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXBuiltInStandardAttributes_Equal +( + NSSPKIXBuiltInStandardAttributes *bisa1, + NSSPKIXBuiltInStandardAttributes *bisa2, + PRStatus *statusOpt +); + +/* + * nssPKIXBuiltInStandardAttributes_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInStandardAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInStandardAttributes * +nssPKIXBuiltInStandardAttributes_Duplicate +( + NSSPKIXBuiltInStandardAttributes *bisa, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXBuiltInStandardAttributes_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXBuiltInStandardAttributes + * 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_PKIX_BUILT_IN_STANDARD_ATTRIBUTES + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInStandardAttributes_verifyPointer +( + NSSPKIXBuiltInStandardAttributes *p +); +#endif /* DEBUG */ + +/* + * CountryName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CountryName ::= [APPLICATION 1] CHOICE { + * x121-dcc-code NumericString + * (SIZE (ub-country-name-numeric-length)), + * iso-3166-alpha2-code PrintableString + * (SIZE (ub-country-name-alpha-length)) } + * + * The private calls for this type: + * + * nssPKIXCountryName_Decode + * nssPKIXCountryName_CreateFromUTF8 + * nssPKIXCountryName_Encode + * + */ + +/* + * nssPKIXCountryName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCountryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCountryName * +nssPKIXCountryName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXCountryName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCountryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCountryName * +nssPKIXCountryName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXCountryName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_COUNTRY_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXCountryName_Encode +( + NSSPKIXCountryName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * AdministrationDomainName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AdministrationDomainName ::= [APPLICATION 2] CHOICE { + * numeric NumericString (SIZE (0..ub-domain-name-length)), + * printable PrintableString (SIZE (0..ub-domain-name-length)) } + * + * The private calls for this type: + * + * nssPKIXAdministrationDomainName_Decode + * nssPKIXAdministrationDomainName_CreateFromUTF8 + * nssPKIXAdministrationDomainName_Encode + * + */ + +/* + * nssPKIXAdministrationDomainName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAdministrationDomainName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAdministrationDomainName * +nssPKIXAdministrationDomainName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXAdministrationDomainName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAdministrationDomainName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAdministrationDomainName * +nssPKIXAdministrationDomainName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXAdministrationDomainName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ADMINISTRATION_DOMAIN_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXAdministrationDomainName_Encode +( + NSSPKIXAdministrationDomainName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * X121Address + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * X121Address ::= NumericString (SIZE (1..ub-x121-address-length)) + * + * The private calls for this type: + * + * nssPKIXX121Address_Decode + * nssPKIXX121Address_CreateFromUTF8 + * nssPKIXX121Address_Encode + * + */ + +/* + * nssPKIXX121Address_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX121Address upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX121Address * +nssPKIXX121Address_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXX121Address_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX121Address upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXX121Address * +nssPKIXX121Address_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXX121Address_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_X121_ADDRESS + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXX121Address_Encode +( + NSSPKIXX121Address *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NetworkAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NetworkAddress ::= X121Address -- see also extended-network-address + * + * The private calls for this type: + * + * nssPKIXNetworkAddress_Decode + * nssPKIXNetworkAddress_CreateFromUTF8 + * nssPKIXNetworkAddress_Encode + * + */ + +/* + * nssPKIXNetworkAddress_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNetworkAddress * +nssPKIXNetworkAddress_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXNetworkAddress_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNetworkAddress * +nssPKIXNetworkAddress_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXNetworkAddress_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NETWORK_ADDRESS + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXNetworkAddress_Encode +( + NSSPKIXNetworkAddress *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * TerminalIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TerminalIdentifier ::= PrintableString (SIZE (1..ub-terminal-id-length)) + * + * The private calls for this type: + * + * nssPKIXTerminalIdentifier_Decode + * nssPKIXTerminalIdentifier_CreateFromUTF8 + * nssPKIXTerminalIdentifier_Encode + * + */ + +/* + * nssPKIXTerminalIdentifier_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTerminalIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTerminalIdentifier * +nssPKIXTerminalIdentifier_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXTerminalIdentifier_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTerminalIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTerminalIdentifier * +nssPKIXTerminalIdentifier_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXTerminalIdentifier_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TERMINAL_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXTerminalIdentifier_Encode +( + NSSPKIXTerminalIdentifier *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PrivateDomainName + * + * -- fgmr comments -- + * + * PrivateDomainName ::= CHOICE { + * numeric NumericString (SIZE (1..ub-domain-name-length)), + * printable PrintableString (SIZE (1..ub-domain-name-length)) } + * + * The private calls for this type: + * + * nssPKIXPrivateDomainName_Decode + * nssPKIXPrivateDomainName_CreateFromUTF8 + * nssPKIXPrivateDomainName_Encode + * + */ + +/* + * nssPKIXPrivateDomainName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPrivateDomainName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPrivateDomainName * +nssPKIXPrivateDomainName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXPrivateDomainName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPrivateDomainName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPrivateDomainName * +nssPKIXPrivateDomainName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXPrivateDomainName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_DOMAIN_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXPrivateDomainName_Encode +( + NSSPKIXPrivateDomainName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * OrganizationName + * + * -- fgmr comments -- + * + * OrganizationName ::= PrintableString + * (SIZE (1..ub-organization-name-length)) + * + * The private calls for this type: + * + * nssPKIXOrganizationName_Decode + * nssPKIXOrganizationName_CreateFromUTF8 + * nssPKIXOrganizationName_Encode + * + */ + +/* + * nssPKIXOrganizationName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationName * +nssPKIXOrganizationName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXOrganizationName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationName * +nssPKIXOrganizationName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXOrganizationName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATION_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXOrganizationName_Encode +( + NSSPKIXOrganizationName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * NumericUserIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NumericUserIdentifier ::= NumericString + * (SIZE (1..ub-numeric-user-id-length)) + * + * The private calls for this type: + * + * nssPKIXNumericUserIdentifier_Decode + * nssPKIXNumericUserIdentifier_CreateFromUTF8 + * nssPKIXNumericUserIdentifier_Encode + * + */ + +/* + * nssPKIXNumericUserIdentifier_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNumericUserIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNumericUserIdentifier * +nssPKIXNumericUserIdentifier_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXNumericUserIdentifier_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_UTF8 + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNumericUserIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNumericUserIdentifier * +nssPKIXNumericUserIdentifier_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXNumericUserIdentifier_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NUMERIC_USER_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXNumericUserIdentifier_Encode +( + NSSPKIXNumericUserIdentifier *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PersonalName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PersonalName ::= SET { + * surname [0] PrintableString (SIZE (1..ub-surname-length)), + * given-name [1] PrintableString + * (SIZE (1..ub-given-name-length)) OPTIONAL, + * initials [2] PrintableString (SIZE (1..ub-initials-length)) OPTIONAL, + * generation-qualifier [3] PrintableString + * (SIZE (1..ub-generation-qualifier-length)) OPTIONAL } + * + * The private calls for this type: + * + * nssPKIXPersonalName_Decode + * nssPKIXPersonalName_Create + * nssPKIXPersonalName_Destroy + * nssPKIXPersonalName_Encode + * nssPKIXPersonalName_GetSurname + * nssPKIXPersonalName_SetSurname + * nssPKIXPersonalName_HasGivenName + * nssPKIXPersonalName_GetGivenName + * nssPKIXPersonalName_SetGivenName + * nssPKIXPersonalName_RemoveGivenName + * nssPKIXPersonalName_HasInitials + * nssPKIXPersonalName_GetInitials + * nssPKIXPersonalName_SetInitials + * nssPKIXPersonalName_RemoveInitials + * nssPKIXPersonalName_HasGenerationQualifier + * nssPKIXPersonalName_GetGenerationQualifier + * nssPKIXPersonalName_SetGenerationQualifier + * nssPKIXPersonalName_RemoveGenerationQualifier + * nssPKIXPersonalName_Equal + * nssPKIXPersonalName_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXPersonalName_verifyPointer + * + */ + +/* + * nssPKIXPersonalName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPersonalName * +nssPKIXPersonalName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXPersonalName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPersonalName * +nssPKIXPersonalName_Create +( + NSSArena *arenaOpt, + NSSUTF8 *surname, + NSSUTF8 *givenNameOpt, + NSSUTF8 *initialsOpt, + NSSUTF8 *generationQualifierOpt +); + +/* + * nssPKIXPersonalName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPersonalName_Destroy +( + NSSPKIXPersonalName *personalName +); + +/* + * nssPKIXPersonalName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXPersonalName_Encode +( + NSSPKIXPersonalName *personalName, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXPersonalName_GetSurname + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXPersonalName_GetSurname +( + NSSPKIXPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXPersonalName_SetSurname + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPersonalName_SetSurname +( + NSSPKIXPersonalName *personalName, + NSSUTF8 *surname +); + +/* + * nssPKIXPersonalName_HasGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXPersonalName_HasGivenName +( + NSSPKIXPersonalName *personalName, + PRStatus *statusOpt +); + +/* + * nssPKIXPersonalName_GetGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_GIVEN_NAME + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXPersonalName_GetGivenName +( + NSSPKIXPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXPersonalName_SetGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPersonalName_SetGivenName +( + NSSPKIXPersonalName *personalName, + NSSUTF8 *givenName +); + +/* + * nssPKIXPersonalName_RemoveGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_HAS_NO_GIVEN_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPersonalName_RemoveGivenName +( + NSSPKIXPersonalName *personalName +); + +/* + * nssPKIXPersonalName_HasInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXPersonalName_HasInitials +( + NSSPKIXPersonalName *personalName, + PRStatus *statusOpt +); + +/* + * nssPKIXPersonalName_GetInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXPersonalName_GetInitials +( + NSSPKIXPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXPersonalName_SetInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPersonalName_SetInitials +( + NSSPKIXPersonalName *personalName, + NSSUTF8 *initials +); + +/* + * nssPKIXPersonalName_RemoveInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPersonalName_RemoveInitials +( + NSSPKIXPersonalName *personalName +); + +/* + * nssPKIXPersonalName_HasGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXPersonalName_HasGenerationQualifier +( + NSSPKIXPersonalName *personalName, + PRStatus *statusOpt +); + +/* + * nssPKIXPersonalName_GetGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXPersonalName_GetGenerationQualifier +( + NSSPKIXPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXPersonalName_SetGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPersonalName_SetGenerationQualifier +( + NSSPKIXPersonalName *personalName, + NSSUTF8 *generationQualifier +); + +/* + * nssPKIXPersonalName_RemoveGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPersonalName_RemoveGenerationQualifier +( + NSSPKIXPersonalName *personalName +); + +/* + * nssPKIXPersonalName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXPersonalName_Equal +( + NSSPKIXPersonalName *personalName1, + NSSPKIXPersonalName *personalName2, + PRStatus *statusOpt +); + +/* + * nssPKIXPersonalName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PERSONAL_NAME + * + * Return value: + * A valid pointer to an NSSPKIXPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPersonalName * +nssPKIXPersonalName_Duplicate +( + NSSPKIXPersonalName *personalName, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXPersonalName_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXPersonalName + * 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_PKIX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXPersonalName_verifyPointer +( + NSSPKIXPersonalName *p +); +#endif /* DEBUG */ + +/* + * OrganizationalUnitNames + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * OrganizationalUnitNames ::= SEQUENCE SIZE (1..ub-organizational-units) + * OF OrganizationalUnitName + * + * The private calls for the type: + * + * nssPKIXOrganizationalUnitNames_Decode + * nssPKIXOrganizationalUnitNames_Create + * nssPKIXOrganizationalUnitNames_Destroy + * nssPKIXOrganizationalUnitNames_Encode + * nssPKIXOrganizationalUnitNames_GetOrganizationalUnitNameCount + * nssPKIXOrganizationalUnitNames_GetOrganizationalUnitNames + * nssPKIXOrganizationalUnitNames_SetOrganizationalUnitNames + * nssPKIXOrganizationalUnitNames_GetOrganizationalUnitName + * nssPKIXOrganizationalUnitNames_SetOrganizationalUnitName + * nssPKIXOrganizationalUnitNames_InsertOrganizationalUnitName + * nssPKIXOrganizationalUnitNames_AppendOrganizationalUnitName + * nssPKIXOrganizationalUnitNames_RemoveOrganizationalUnitName + * nssPKIXOrganizationalUnitNames_FindOrganizationalUnitName + * nssPKIXOrganizationalUnitNames_Equal + * nssPKIXOrganizationalUnitNames_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXOrganizationalUnitNames_verifyPointer + * + */ + +/* + * nssPKIXOrganizationalUnitNames_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitNames * +nssPKIXOrganizationalUnitNames_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXOrganizationalUnitNames_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitNames * +nssPKIXOrganizationalUnitNames_Create +( + NSSArena *arenaOpt, + NSSPKIXOrganizationalUnitName *ou1, + ... +); + +/* + * nssPKIXOrganizationalUnitNames_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXOrganizationalUnitNames_Destroy +( + NSSPKIXOrganizationalUnitNames *ous +); + +/* + * nssPKIXOrganizationalUnitNames_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXOrganizationalUnitNames_Encode +( + NSSPKIXOrganizationalUnitNames *ous, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXOrganizationalUnitNames_GetOrganizationalUnitNameCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXOrganizationalUnitNames_GetOrganizationalUnitNameCount +( + NSSPKIXOrganizationalUnitNames *ous +); + +/* + * nssPKIXOrganizationalUnitNames_GetOrganizationalUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXOrganizationalUnitName + * pointers upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitName ** +nssPKIXOrganizationalUnitNames_GetOrganizationalUnitNames +( + NSSPKIXOrganizationalUnitNames *ous, + NSSPKIXOrganizationalUnitName *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXOrganizationalUnitNames_SetOrganizationalUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXOrganizationalUnitNames_SetOrganizationalUnitNames +( + NSSPKIXOrganizationalUnitNames *ous, + NSSPKIXOrganizationalUnitName *ou[], + PRInt32 count +); + +/* + * nssPKIXOrganizationalUnitNames_GetOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitName * +nssPKIXOrganizationalUnitNames_GetOrganizationalUnitName +( + NSSPKIXOrganizationalUnitNames *ous, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXOrganizationalUnitNames_SetOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXOrganizationalUnitNames_SetOrganizationalUnitName +( + NSSPKIXOrganizationalUnitNames *ous, + PRInt32 i, + NSSPKIXOrganizationalUnitName *ou +); + +/* + * nssPKIXOrganizationalUnitNames_InsertOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXOrganizationalUnitNames_InsertOrganizationalUnitName +( + NSSPKIXOrganizationalUnitNames *ous, + PRInt32 i, + NSSPKIXOrganizationalUnitName *ou +); + +/* + * nssPKIXOrganizationalUnitNames_AppendOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXOrganizationalUnitNames_AppendOrganizationalUnitName +( + NSSPKIXOrganizationalUnitNames *ous, + NSSPKIXOrganizationalUnitName *ou +); + +/* + * nssPKIXOrganizationalUnitNames_RemoveOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXOrganizationalUnitNames_RemoveOrganizationalUnitName +( + NSSPKIXOrganizationalUnitNames *ous, + PRInt32 i +); + +/* + * nssPKIXOrganizationalUnitNames_FindOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * + * Return value: + * The index of the specified revoked certificate upon success + * -1 upon failure + */ + +NSS_EXTERN PRIntn +nssPKIXOrganizationalUnitNames_FindOrganizationalUnitName +( + NSSPKIXOrganizationalUnitNames *ous, + NSSPKIXOrganizationalUnitName *ou +); + +/* + * nssPKIXOrganizationalUnitNames_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXOrganizationalUnitNames_Equal +( + NSSPKIXOrganizationalUnitNames *ous1, + NSSPKIXOrganizationalUnitNames *ous2, + PRStatus *statusOpt +); + +/* + * nssPKIXOrganizationalUnitNames_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitNames * +nssPKIXOrganizationalUnitNames_Duplicate +( + NSSPKIXOrganizationalUnitNames *ous, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXOrganizationalUnitNames_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXOrganizationalUnitNames + * 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_PKIX_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXOrganizationalUnitNames_verifyPointer +( + NSSPKIXOrganizationalUnitNames *p +); +#endif /* DEBUG */ + +/* + * OrganizationalUnitName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * OrganizationalUnitName ::= PrintableString (SIZE + * (1..ub-organizational-unit-name-length)) + * + * The private calls for this type: + * + * nssPKIXOrganizationalUnitName_Decode + * nssPKIXOrganizationalUnitName_CreateFromUTF8 + * nssPKIXOrganizationalUnitName_Encode + * + */ + +/* + * nssPKIXOrganizationalUnitName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitName * +nssPKIXOrganizationalUnitName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXOrganizationalUnitName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXOrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXOrganizationalUnitName * +nssPKIXOrganizationalUnitName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXOrganizationalUnitName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXOrganizationalUnitName_Encode +( + NSSPKIXOrganizationalUnitName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * BuiltInDomainDefinedAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BuiltInDomainDefinedAttributes ::= SEQUENCE SIZE + * (1..ub-domain-defined-attributes) OF + * BuiltInDomainDefinedAttribute + * + * The private calls for this type: + * + * nssPKIXBuiltInDomainDefinedAttributes_Decode + * nssPKIXBuiltInDomainDefinedAttributes_Create + * nssPKIXBuiltInDomainDefinedAttributes_Destroy + * nssPKIXBuiltInDomainDefinedAttributes_Encode + * nssPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttributeCount + * nssPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttributes + * nssPKIXBuiltInDomainDefinedAttributes_SetBuiltIndomainDefinedAttributes + * nssPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttribute + * nssPKIXBuiltInDomainDefinedAttributes_SetBuiltIndomainDefinedAttribute + * nssPKIXBuiltInDomainDefinedAttributes_InsertBuiltIndomainDefinedAttribute + * nssPKIXBuiltInDomainDefinedAttributes_AppendBuiltIndomainDefinedAttribute + * nssPKIXBuiltInDomainDefinedAttributes_RemoveBuiltIndomainDefinedAttribute + * nssPKIXBuiltInDomainDefinedAttributes_Equal + * nssPKIXBuiltInDomainDefinedAttributes_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXBuiltInDomainDefinedAttributes_verifyPointer + * + */ + +/* + * nssPKIXBuiltInDomainDefinedAttributes_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttributes + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttributes * +nssPKIXBuiltInDomainDefinedAttributes_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttributes + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttributes * +nssPKIXBuiltInDomainDefinedAttributes_Create +( + NSSArena *arenaOpt, + NSSPKIXBuiltInDomainDefinedAttribute *bidda1, + ... +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInDomainDefinedAttributes_Destroy +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXBuiltInDomainDefinedAttributes_Encode +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttributeCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttributeCount +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXBuiltInDomainDefinedAttribute + * pointers upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttribute ** +nssPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttributes +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + NSSPKIXBuiltInDomainDefinedAttribut *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_SetBuiltIndomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInDomainDefinedAttributes_SetBuiltIndomainDefinedAttributes +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + NSSPKIXBuiltInDomainDefinedAttribut *bidda[], + PRInt32 count +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttribute * +nssPKIXBuiltInDomainDefinedAttributes_GetBuiltIndomainDefinedAttribute +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_SetBuiltIndomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInDomainDefinedAttributes_SetBuiltIndomainDefinedAttribute +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + PRInt32 i, + NSSPKIXBuiltInDomainDefinedAttribute *bidda +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_InsertBuiltIndomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInDomainDefinedAttributes_InsertBuiltIndomainDefinedAttribute +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + PRInt32 i, + NSSPKIXBuiltInDomainDefinedAttribute *bidda +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_AppendBuiltIndomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInDomainDefinedAttributes_AppendBuiltIndomainDefinedAttribute +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + NSSPKIXBuiltInDomainDefinedAttribute *bidda +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_RemoveBuiltIndomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInDomainDefinedAttributes_RemoveBuiltIndomainDefinedAttribute +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + PRInt32 i +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_FindBuiltIndomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * The index of the specified revoked certificate upon success + * -1 upon failure + */ + +NSS_EXTERN PRInt32 +nssPKIXBuiltInDomainDefinedAttributes_FindBuiltIndomainDefinedAttribute +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + NSSPKIXBuiltInDomainDefinedAttribute *bidda +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXBuiltInDomainDefinedAttributes_Equal +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas1, + NSSPKIXBuiltInDomainDefinedAttributes *biddas2, + PRStatus *statusOpt +); + +/* + * nssPKIXBuiltInDomainDefinedAttributes_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttributes + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttributes * +nssPKIXBuiltInDomainDefinedAttributes_Duplicate +( + NSSPKIXBuiltInDomainDefinedAttributes *biddas, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXBuiltInDomainDefinedAttributes_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXBuiltInDomainDefinedAttributes + * 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_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInDomainDefinedAttributes_verifyPointer +( + NSSPKIXBuiltInDomainDefinedAttributes *p +); +#endif /* DEBUG */ + +/* + * BuiltInDomainDefinedAttribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BuiltInDomainDefinedAttribute ::= SEQUENCE { + * type PrintableString (SIZE + * (1..ub-domain-defined-attribute-type-length)), + * value PrintableString (SIZE + * (1..ub-domain-defined-attribute-value-length))} + * + * The private calls for this type: + * + * nssPKIXBuiltInDomainDefinedAttribute_Decode + * nssPKIXBuiltInDomainDefinedAttribute_Create + * nssPKIXBuiltInDomainDefinedAttribute_Destroy + * nssPKIXBuiltInDomainDefinedAttribute_Encode + * nssPKIXBuiltInDomainDefinedAttribute_GetType + * nssPKIXBuiltInDomainDefinedAttribute_SetType + * nssPKIXBuiltInDomainDefinedAttribute_GetValue + * nssPKIXBuiltInDomainDefinedAttribute_SetValue + * nssPKIXBuiltInDomainDefinedAttribute_Equal + * nssPKIXBuiltInDomainDefinedAttribute_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXBuiltInDomainDefinedAttribute_verifyPointer + * + */ + +/* + * nssPKIXBuiltInDomainDefinedAttribute_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttribute * +nssPKIXBuiltInDomainDefinedAttribute_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXBuiltInDomainDefinedAttribute_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttribute * +nssPKIXBuiltInDomainDefinedAttribute_Create +( + NSSArena *arenaOpt, + NSSUTF8 *type, + NSSUTF8 *value +); + +/* + * nssPKIXBuiltInDomainDefinedAttribute_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInDomainDefinedAttribute_Destroy +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda +); + +/* + * nssPKIXBuiltInDomainDefinedAttribute_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXBuiltInDomainDefinedAttribute_Encode +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInDomainDefinedAttribute_GetType + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXBuiltInDomainDefinedAttribute_GetType +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInDomainDefinedAttribute_SetType + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInDomainDefinedAttribute_SetType +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda, + NSSUTF8 *type +); + +/* + * nssPKIXBuiltInDomainDefinedAttribute_GetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXBuiltInDomainDefinedAttribute_GetValue +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda, + NSSArena *arenaOpt +); + +/* + * nssPKIXBuiltInDomainDefinedAttribute_SetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInDomainDefinedAttribute_SetValue +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda, + NSSUTF8 *value +); + +/* + * nssPKIXBuiltInDomainDefinedAttribute_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXBuiltInDomainDefinedAttribute_Equal +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda1, + NSSPKIXBuiltInDomainDefinedAttribute *bidda2, + PRStatus *statusOpt +); + +/* + * nssPKIXBuiltInDomainDefinedAttribute_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXBuiltInDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBuiltInDomainDefinedAttribute * +nssPKIXBuiltInDomainDefinedAttribute_Duplicate +( + NSSPKIXBuiltInDomainDefinedAttribute *bidda, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXBuiltInDomainDefinedAttribute_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXBuiltInDomainDefinedAttribute + * 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_PKIX_BUILT_IN_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXBuiltInDomainDefinedAttribute_verifyPointer +( + NSSPKIXBuiltInDomainDefinedAttribute *p +); +#endif /* DEBUG */ + +/* + * ExtensionAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtensionAttributes ::= SET SIZE (1..ub-extension-attributes) OF + * ExtensionAttribute + * + * The private calls for this type: + * + * nssPKIXExtensionAttributes_Decode + * nssPKIXExtensionAttributes_Create + * nssPKIXExtensionAttributes_Destroy + * nssPKIXExtensionAttributes_Encode + * nssPKIXExtensionAttributes_GetExtensionAttributeCount + * nssPKIXExtensionAttributes_GetExtensionAttributes + * nssPKIXExtensionAttributes_SetExtensionAttributes + * nssPKIXExtensionAttributes_GetExtensionAttribute + * nssPKIXExtensionAttributes_SetExtensionAttribute + * nssPKIXExtensionAttributes_InsertExtensionAttribute + * nssPKIXExtensionAttributes_AppendExtensionAttribute + * nssPKIXExtensionAttributes_RemoveExtensionAttribute + * nssPKIXExtensionAttributes_FindExtensionAttribute + * nssPKIXExtensionAttributes_Equal + * nssPKIXExtensionAttributes_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXExtensionAttributes_verifyPointer + * + */ + +/* + * nssPKIXExtensionAttributes_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttributes * +nssPKIXExtensionAttributes_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXExtensionAttributes_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttributes * +nssPKIXExtensionAttributes_Create +( + NSSArena *arenaOpt, + NSSPKIXExtensionAttribute ea1, + ... +); + +/* + * nssPKIXExtensionAttributes_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtensionAttributes_Destroy +( + NSSPKIXExtensionAttributes *eas +); + +/* + * nssPKIXExtensionAttributes_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXExtensionAttributes_Encode +( + NSSPKIXExtensionAttributes *eas + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXExtensionAttributes_GetExtensionAttributeCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXExtensionAttributes_GetExtensionAttributeCount +( + NSSPKIXExtensionAttributes *eas +); + +/* + * nssPKIXExtensionAttributes_GetExtensionAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXExtensionAttribute pointers + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttribute ** +nssPKIXExtensionAttributes_GetExtensionAttributes +( + NSSPKIXExtensionAttributes *eas, + NSSPKIXExtensionAttribute *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXExtensionAttributes_SetExtensionAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * NSS_ERROR_INVALID_POINTER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtensionAttributes_SetExtensionAttributes +( + NSSPKIXExtensionAttributes *eas, + NSSPKIXExtensionAttribute *ea[], + PRInt32 count +); + +/* + * nssPKIXExtensionAttributes_GetExtensionAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttribute upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttribute * +nssPKIXExtensionAttributes_GetExtensionAttribute +( + NSSPKIXExtensionAttributes *eas, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXExtensionAttributes_SetExtensionAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtensionAttributes_SetExtensionAttribute +( + NSSPKIXExtensionAttributes *eas, + PRInt32 i, + NSSPKIXExtensionAttribute *ea +); + +/* + * nssPKIXExtensionAttributes_InsertExtensionAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtensionAttributes_InsertExtensionAttribute +( + NSSPKIXExtensionAttributes *eas, + PRInt32 i, + NSSPKIXExtensionAttribute *ea +); + +/* + * nssPKIXExtensionAttributes_AppendExtensionAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtensionAttributes_AppendExtensionAttribute +( + NSSPKIXExtensionAttributes *eas, + NSSPKIXExtensionAttribute *ea +); + +/* + * nssPKIXExtensionAttributes_RemoveExtensionAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtensionAttributes_RemoveExtensionAttribute +( + NSSPKIXExtensionAttributes *eas, + PRInt32 i, +); + +/* + * nssPKIXExtensionAttributes_FindExtensionAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * A nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXExtensionAttributes_FindExtensionAttribute +( + NSSPKIXExtensionAttributes *eas, + NSSPKIXExtensionAttribute *ea +); + +/* + * nssPKIXExtensionAttributes_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXExtensionAttributes_Equal +( + NSSPKIXExtensionAttributes *eas1, + NSSPKIXExtensionAttributes *eas2, + PRStatus *statusOpt +); + +/* + * nssPKIXExtensionAttributes_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTES + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttributes upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttributes * +nssPKIXExtensionAttributes_Duplicate +( + NSSPKIXExtensionAttributes *eas, + NSSArena *arenaOpt +); + +/* + * fgmr + * There should be accessors to search the ExtensionAttributes and + * return the value for a specific value, etc. + */ + +#ifdef DEBUG +/* + * nssPKIXExtensionAttributes_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXExtensionAttributes + * 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_PKIX_EXTENSION_ATTRIBUTES + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXExtensionAttributes_verifyPointer +( + NSSPKIXExtensionAttributes *p +); +#endif /* DEBUG */ + +/* + * ExtensionAttribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtensionAttribute ::= SEQUENCE { + * extension-attribute-type [0] INTEGER (0..ub-extension-attributes), + * extension-attribute-value [1] + * ANY DEFINED BY extension-attribute-type } + * + * The private calls for this type: + * + * nssPKIXExtensionAttribute_Decode + * nssPKIXExtensionAttribute_Create + * nssPKIXExtensionAttribute_Destroy + * nssPKIXExtensionAttribute_Encode + * nssPKIXExtensionAttribute_GetExtensionsAttributeType + * nssPKIXExtensionAttribute_SetExtensionsAttributeType + * nssPKIXExtensionAttribute_GetExtensionsAttributeValue + * nssPKIXExtensionAttribute_SetExtensionsAttributeValue + * nssPKIXExtensionAttribute_Equal + * nssPKIXExtensionAttribute_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXExtensionAttribute_verifyPointer + * + */ + +/* + * nssPKIXExtensionAttribute_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttribute upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttribute * +nssPKIXExtensionAttribute_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXExtensionAttribute_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE_TYPE + * NSS_ERROR_INVALID_POINTER + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttribute upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttribute * +nssPKIXExtensionAttribute_Create +( + NSSArena *arenaOpt, + NSSPKIXExtensionAttributeType type, + NSSItem *value +); + +/* + * nssPKIXExtensionAttribute_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtensionAttribute_Destroy +( + NSSPKIXExtensionAttribute *ea +); + +/* + * nssPKIXExtensionAttribute_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXExtensionAttribute_Encode +( + NSSPKIXExtensionAttribute *ea, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXExtensionAttribute_GetExtensionsAttributeType + * + * -- fgmr comments -- + * {One of these objects created from BER generated by a program + * adhering to a later version of the PKIX standards might have + * a value not mentioned in the enumeration definition. This isn't + * a bug.} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * A member of the NSSPKIXExtensionAttributeType enumeration + * upon success + * NSSPKIXExtensionAttributeType_NSSinvalid upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttributeType +nssPKIXExtensionAttribute_GetExtensionsAttributeType +( + NSSPKIXExtensionAttribute *ea +); + +/* + * nssPKIXExtensionAttribute_SetExtensionsAttributeType + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtensionAttribute_SetExtensionsAttributeType +( + NSSPKIXExtensionAttribute *ea, + NSSPKIXExtensionAttributeType type +); + +/* + * nssPKIXExtensionAttribute_GetExtensionsAttributeValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +nssPKIXExtensionAttribute_GetExtensionsAttributeValue +( + NSSPKIXExtensionAttribute *ea, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXExtensionAttribute_SetExtensionsAttributeValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtensionAttribute_SetExtensionsAttributeValue +( + NSSPKIXExtensionAttribute *ea, + NSSItem *value +); + +/* + * nssPKIXExtensionAttribute_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXExtensionAttribute_Equal +( + NSSPKIXExtensionAttribute *ea1, + NSSPKIXExtensionAttribute *ea2, + PRStatus *statusOpt +); + +/* + * nssPKIXExtensionAttribute_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENSION_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtensionAttribute upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtensionAttribute * +nssPKIXExtensionAttribute_Duplicate +( + NSSPKIXExtensionAttribute *ea, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXExtensionAttribute_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXExtensionAttribute + * 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_PKIX_EXTENSION_ATTRIBUTE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXExtensionAttribute_verifyPointer +( + NSSPKIXExtensionAttribute *p +); +#endif /* DEBUG */ + +/* + * CommonName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CommonName ::= PrintableString (SIZE (1..ub-common-name-length)) + * + * The private calls for this type: + * + * nssPKIXCommonName_Decode + * nssPKIXCommonName_CreateFromUTF8 + * nssPKIXCommonName_Encode + * + */ + +/* + * nssPKIXCommonName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCommonName * +nssPKIXCommonName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXCommonName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCommonName * +nssPKIXCommonName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXCommonName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_COMMON_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXCommonName_Encode +( + NSSPKIXCommonName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * TeletexCommonName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexCommonName ::= TeletexString (SIZE (1..ub-common-name-length)) + * + * The private calls for this type: + * + * nssPKIXTeletexCommonName_Decode + * nssPKIXTeletexCommonName_CreateFromUTF8 + * nssPKIXTeletexCommonName_Encode + * + */ + +/* + * nssPKIXTeletexCommonName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexCommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexCommonName * +nssPKIXTeletexCommonName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXTeletexCommonName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexCommonName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexCommonName * +nssPKIXTeletexCommonName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXTeletexCommonName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_COMMON_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXTeletexCommonName_Encode +( + NSSPKIXTeletexCommonName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * TeletexOrganizationName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexOrganizationName ::= + * TeletexString (SIZE (1..ub-organization-name-length)) + * + * The private calls for this type: + * + * nssPKIXTeletexOrganizationName_Decode + * nssPKIXTeletexOrganizationName_CreateFromUTF8 + * nssPKIXTeletexOrganizationName_Encode + * + */ + +/* + * nssPKIXTeletexOrganizationName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationName * +nssPKIXTeletexOrganizationName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXTeletexOrganizationName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationName * +nssPKIXTeletexOrganizationName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXTeletexOrganizationName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATION_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXTeletexOrganizationName_Encode +( + NSSPKIXTeletexOrganizationName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * TeletexPersonalName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexPersonalName ::= SET { + * surname [0] TeletexString (SIZE (1..ub-surname-length)), + * given-name [1] TeletexString + * (SIZE (1..ub-given-name-length)) OPTIONAL, + * initials [2] TeletexString (SIZE (1..ub-initials-length)) OPTIONAL, + * generation-qualifier [3] TeletexString (SIZE + * (1..ub-generation-qualifier-length)) OPTIONAL } + * + * The private calls for this type: + * + * nssPKIXTeletexPersonalName_Decode + * nssPKIXTeletexPersonalName_Create + * nssPKIXTeletexPersonalName_Destroy + * nssPKIXTeletexPersonalName_Encode + * nssPKIXTeletexPersonalName_GetSurname + * nssPKIXTeletexPersonalName_SetSurname + * nssPKIXTeletexPersonalName_HasGivenName + * nssPKIXTeletexPersonalName_GetGivenName + * nssPKIXTeletexPersonalName_SetGivenName + * nssPKIXTeletexPersonalName_RemoveGivenName + * nssPKIXTeletexPersonalName_HasInitials + * nssPKIXTeletexPersonalName_GetInitials + * nssPKIXTeletexPersonalName_SetInitials + * nssPKIXTeletexPersonalName_RemoveInitials + * nssPKIXTeletexPersonalName_HasGenerationQualifier + * nssPKIXTeletexPersonalName_GetGenerationQualifier + * nssPKIXTeletexPersonalName_SetGenerationQualifier + * nssPKIXTeletexPersonalName_RemoveGenerationQualifier + * nssPKIXTeletexPersonalName_Equal + * nssPKIXTeletexPersonalName_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXTeletexPersonalName_verifyPointer + * + */ + +/* + * nssPKIXTeletexPersonalName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexPersonalName * +nssPKIXTeletexPersonalName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXTeletexPersonalName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXTeletexPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexPersonalName * +nssPKIXTeletexPersonalName_Create +( + NSSArena *arenaOpt, + NSSUTF8 *surname, + NSSUTF8 *givenNameOpt, + NSSUTF8 *initialsOpt, + NSSUTF8 *generationQualifierOpt +); + +/* + * nssPKIXTeletexPersonalName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexPersonalName_Destroy +( + NSSPKIXTeletexPersonalName *personalName +); + +/* + * nssPKIXTeletexPersonalName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXTeletexPersonalName_Encode +( + NSSPKIXTeletexPersonalName *personalName, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexPersonalName_GetSurname + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXTeletexPersonalName_GetSurname +( + NSSPKIXTeletexPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexPersonalName_SetSurname + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexPersonalName_SetSurname +( + NSSPKIXTeletexPersonalName *personalName, + NSSUTF8 *surname +); + +/* + * nssPKIXTeletexPersonalName_HasGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXTeletexPersonalName_HasGivenName +( + NSSPKIXTeletexPersonalName *personalName, + PRStatus *statusOpt +); + +/* + * nssPKIXTeletexPersonalName_GetGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXTeletexPersonalName_GetGivenName +( + NSSPKIXTeletexPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexPersonalName_SetGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexPersonalName_SetGivenName +( + NSSPKIXTeletexPersonalName *personalName, + NSSUTF8 *givenName +); + +/* + * nssPKIXTeletexPersonalName_RemoveGivenName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexPersonalName_RemoveGivenName +( + NSSPKIXTeletexPersonalName *personalName +); + +/* + * nssPKIXTeletexPersonalName_HasInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXTeletexPersonalName_HasInitials +( + NSSPKIXTeletexPersonalName *personalName, + PRStatus *statusOpt +); + +/* + * nssPKIXTeletexPersonalName_GetInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXTeletexPersonalName_GetInitials +( + NSSPKIXTeletexPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexPersonalName_SetInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexPersonalName_SetInitials +( + NSSPKIXTeletexPersonalName *personalName, + NSSUTF8 *initials +); + +/* + * nssPKIXTeletexPersonalName_RemoveInitials + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexPersonalName_RemoveInitials +( + NSSPKIXTeletexPersonalName *personalName +); + +/* + * nssPKIXTeletexPersonalName_HasGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXTeletexPersonalName_HasGenerationQualifier +( + NSSPKIXTeletexPersonalName *personalName, + PRStatus *statusOpt +); + +/* + * nssPKIXTeletexPersonalName_GetGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXTeletexPersonalName_GetGenerationQualifier +( + NSSPKIXTeletexPersonalName *personalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexPersonalName_SetGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexPersonalName_SetGenerationQualifier +( + NSSPKIXTeletexPersonalName *personalName, + NSSUTF8 *generationQualifier +); + +/* + * nssPKIXTeletexPersonalName_RemoveGenerationQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexPersonalName_RemoveGenerationQualifier +( + NSSPKIXTeletexPersonalName *personalName +); + +/* + * nssPKIXTeletexPersonalName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXTeletexPersonalName_Equal +( + NSSPKIXTeletexPersonalName *personalName1, + NSSPKIXTeletexPersonalName *personalName2, + PRStatus *statusOpt +); + +/* + * nssPKIXTeletexPersonalName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * A valid pointer to an NSSPKIXTeletexPersonalName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexPersonalName * +nssPKIXTeletexPersonalName_Duplicate +( + NSSPKIXTeletexPersonalName *personalName, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXTeletexPersonalName_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXTeletexPersonalName + * 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_PKIX_TELETEX_PERSONAL_NAME + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexPersonalName_verifyPointer +( + NSSPKIXTeletexPersonalName *p +); +#endif /* DEBUG */ + +/* + * TeletexOrganizationalUnitNames + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexOrganizationalUnitNames ::= SEQUENCE SIZE + * (1..ub-organizational-units) OF TeletexOrganizationalUnitName + * + * The private calls for the type: + * + * nssPKIXTeletexOrganizationalUnitNames_Decode + * nssPKIXTeletexOrganizationalUnitNames_Create + * nssPKIXTeletexOrganizationalUnitNames_Destroy + * nssPKIXTeletexOrganizationalUnitNames_Encode + * nssPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitNameCount + * nssPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitNames + * nssPKIXTeletexOrganizationalUnitNames_SetTeletexOrganizationalUnitNames + * nssPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitName + * nssPKIXTeletexOrganizationalUnitNames_SetTeletexOrganizationalUnitName + * nssPKIXTeletexOrganizationalUnitNames_InsertTeletexOrganizationalUnitName + * nssPKIXTeletexOrganizationalUnitNames_AppendTeletexOrganizationalUnitName + * nssPKIXTeletexOrganizationalUnitNames_RemoveTeletexOrganizationalUnitName + * nssPKIXTeletexOrganizationalUnitNames_FindTeletexOrganizationalUnitName + * nssPKIXTeletexOrganizationalUnitNames_Equal + * nssPKIXTeletexOrganizationalUnitNames_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXTeletexOrganizationalUnitNames_verifyPointer + * + */ + +/* + * nssPKIXTeletexOrganizationalUnitNames_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitNames * +nssPKIXTeletexOrganizationalUnitNames_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitNames * +nssPKIXTeletexOrganizationalUnitNames_Create +( + NSSArena *arenaOpt, + NSSPKIXTeletexOrganizationalUnitName *ou1, + ... +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexOrganizationalUnitNames_Destroy +( + NSSPKIXTeletexOrganizationalUnitNames *ous +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXTeletexOrganizationalUnitNames_Encode +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitNameCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitNameCount +( + NSSPKIXTeletexOrganizationalUnitNames *ous +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXTeletexOrganizationalUnitName + * pointers upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitName ** +nssPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitNames +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + NSSPKIXTeletexOrganizationalUnitName *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_SetTeletexOrganizationalUnitNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexOrganizationalUnitNames_SetTeletexOrganizationalUnitNames +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + NSSPKIXTeletexOrganizationalUnitName *ou[], + PRInt32 count +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitName * +nssPKIXTeletexOrganizationalUnitNames_GetTeletexOrganizationalUnitName +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_SetTeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexOrganizationalUnitNames_SetTeletexOrganizationalUnitName +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + PRInt32 i, + NSSPKIXTeletexOrganizationalUnitName *ou +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_InsertTeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexOrganizationalUnitNames_InsertTeletexOrganizationalUnitName +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + PRInt32 i, + NSSPKIXTeletexOrganizationalUnitName *ou +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_AppendTeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexOrganizationalUnitNames_AppendTeletexOrganizationalUnitName +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + NSSPKIXTeletexOrganizationalUnitName *ou +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_RemoveTeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexOrganizationalUnitNames_RemoveTeletexOrganizationalUnitName +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + PRInt32 i +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_FindTeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * + * Return value: + * The index of the specified revoked certificate upon success + * -1 upon failure + */ + +NSS_EXTERN PRInt32 +nssPKIXTeletexOrganizationalUnitNames_FindTeletexOrganizationalUnitName +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + NSSPKIXTeletexOrganizationalUnitName *ou +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXTeletexOrganizationalUnitNames_Equal +( + NSSPKIXTeletexOrganizationalUnitNames *ous1, + NSSPKIXTeletexOrganizationalUnitNames *ous2, + PRStatus *statusOpt +); + +/* + * nssPKIXTeletexOrganizationalUnitNames_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationalUnitNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitNames * +nssPKIXTeletexOrganizationalUnitNames_Duplicate +( + NSSPKIXTeletexOrganizationalUnitNames *ous, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXTeletexOrganizationalUnitNames_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXTeletexOrganizationalUnitNames + * 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_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexOrganizationalUnitNames_verifyPointer +( + NSSPKIXTeletexOrganizationalUnitNames *p +); +#endif /* DEBUG */ + +/* + * TeletexOrganizationalUnitName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexOrganizationalUnitName ::= TeletexString + * (SIZE (1..ub-organizational-unit-name-length)) + * + * The private calls for this type: + * + * nssPKIXTeletexOrganizationalUnitName_Decode + * nssPKIXTeletexOrganizationalUnitName_CreateFromUTF8 + * nssPKIXTeletexOrganizationalUnitName_Encode + * + */ + +/* + * nssPKIXTeletexOrganizationalUnitName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitName * +nssPKIXTeletexOrganizationalUnitName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXTeletexOrganizationalUnitName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexOrganizationalUnitName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexOrganizationalUnitName * +nssPKIXTeletexOrganizationalUnitName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXTeletexOrganizationalUnitName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_ORGANIZATIONAL_UNIT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXTeletexOrganizationalUnitName_Encode +( + NSSPKIXTeletexOrganizationalUnitName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PDSName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PDSName ::= PrintableString (SIZE (1..ub-pds-name-length)) + * + * The private calls for this type: + * + * nssPKIXPDSName_Decode + * nssPKIXPDSName_CreateFromUTF8 + * nssPKIXPDSName_Encode + * + */ + +/* + * nssPKIXPDSName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPDSName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPDSName * +nssPKIXPDSName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXPDSName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPDSName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPDSName * +nssPKIXPDSName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXPDSName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXPDSName_Encode +( + NSSPKIXPDSName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PhysicalDeliveryCountryName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PhysicalDeliveryCountryName ::= CHOICE { + * x121-dcc-code NumericString (SIZE (ub-country-name-numeric-length)), + * iso-3166-alpha2-code PrintableString + * (SIZE (ub-country-name-alpha-length)) } + * + * The private calls for this type: + * + * nssPKIXPhysicalDeliveryCountryName_Decode + * nssPKIXPhysicalDeliveryCountryName_CreateFromUTF8 + * nssPKIXPhysicalDeliveryCountryName_Encode + * + */ + +/* + * nssPKIXPhysicalDeliveryCountryName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPhysicalDeliveryCountryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPhysicalDeliveryCountryName * +nssPKIXPhysicalDeliveryCountryName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXPhysicalDeliveryCountryName_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPhysicalDeliveryCountryName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPhysicalDeliveryCountryName * +nssPKIXPhysicalDeliveryCountryName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXPhysicalDeliveryCountryName_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PHYSICAL_DELIVERY_COUNTRY_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXPhysicalDeliveryCountryName_Encode +( + NSSPKIXPhysicalDeliveryCountryName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PostalCode + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PostalCode ::= CHOICE { + * numeric-code NumericString (SIZE (1..ub-postal-code-length)), + * printable-code PrintableString (SIZE (1..ub-postal-code-length)) } + * + * The private calls for this type: + * + * nssPKIXPostalCode_Decode + * nssPKIXPostalCode_CreateFromUTF8 + * nssPKIXPostalCode_Encode + * + */ + +/* + * nssPKIXPostalCode_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPostalCode upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPostalCode * +nssPKIXPostalCode_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXPostalCode_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPostalCode upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPostalCode * +nssPKIXPostalCode_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXPostalCode_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POSTAL_CODE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXPostalCode_Encode +( + NSSPKIXPostalCode *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PDSParameter + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PDSParameter ::= SET { + * printable-string PrintableString + * (SIZE(1..ub-pds-parameter-length)) OPTIONAL, + * teletex-string TeletexString + * (SIZE(1..ub-pds-parameter-length)) OPTIONAL } + * + * The private calls for this type: + * + * nssPKIXPDSParameter_Decode + * nssPKIXPDSParameter_CreateFromUTF8 + * nssPKIXPDSParameter_Create + * nssPKIXPDSParameter_Delete + * nssPKIXPDSParameter_Encode + * nssPKIXPDSParameter_GetUTF8Encoding + * nssPKIXPDSParameter_HasPrintableString + * nssPKIXPDSParameter_GetPrintableString + * nssPKIXPDSParameter_SetPrintableString + * nssPKIXPDSParameter_RemovePrintableString + * nssPKIXPDSParameter_HasTeletexString + * nssPKIXPDSParameter_GetTeletexString + * nssPKIXPDSParameter_SetTeletexString + * nssPKIXPDSParameter_RemoveTeletexString + * nssPKIXPDSParameter_Equal + * nssPKIXPDSParameter_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXPDSParameter_verifyPointer + */ + +/* + * nssPKIXPDSParameter_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPDSParameter upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPDSParameter * +nssPKIXPDSParameter_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXPDSParameter_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPDSParameter upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPDSParameter * +nssPKIXPDSParameter_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXPDSParameter_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXPDSParameter upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPDSParameter * +nssPKIXPDSParameter_Create +( + NSSArena *arenaOpt, + NSSUTF8 *printableStringOpt, + NSSUTF8 *teletexStringOpt +); + +/* + * nssPKIXPDSParameter_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPDSParameter_Destroy +( + NSSPKIXPDSParameter *p +); + +/* + * nssPKIXPDSParameter_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXPDSParameter_Encode +( + NSSPKIXPDSParameter *p, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXPDSParameter_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXPDSParameter_GetUTF8Encoding +( + NSSPKIXPDSParameter *p, + NSSArena *arenaOpt +); + +/* + * nssPKIXPDSParameter_HasPrintableString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXPDSParameter_HasPrintableString +( + NSSPKIXPDSParameter *p, + PRStatus *statusOpt +); + +/* + * nssPKIXPDSParameter_GetPrintableString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXPDSParameter_GetPrintableString +( + NSSPKIXPDSParameter *p, + NSSArena *arenaOpt +); + +/* + * nssPKIXPDSParameter_SetPrintableString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPDSParameter_SetPrintableString +( + NSSPKIXPDSParameter *p, + NSSUTF8 *printableString +); + +/* + * nssPKIXPDSParameter_RemovePrintableString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPDSParameter_RemovePrintableString +( + NSSPKIXPDSParameter *p +); + +/* + * nssPKIXPDSParameter_HasTeletexString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXPDSParameter_HasTeletexString +( + NSSPKIXPDSParameter *p, + PRStatus *statusOpt +); + +/* + * nssPKIXPDSParameter_GetTeletexString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXPDSParameter_GetTeletexString +( + NSSPKIXPDSParameter *p, + NSSArena *arenaOpt +); + +/* + * nssPKIXPDSParameter_SetTeletexString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPDSParameter_SetTeletexString +( + NSSPKIXPDSParameter *p, + NSSUTF8 *teletexString +); + +/* + * nssPKIXPDSParameter_RemoveTeletexString + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPDSParameter_RemoveTeletexString +( + NSSPKIXPDSParameter *p +); + +/* + * nssPKIXPDSParameter_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXPDSParameter_Equal +( + NSSPKIXPDSParameter *p1, + NSSPKIXPDSParameter *p2, + PRStatus *statusOpt +); + +/* + * nssPKIXPDSParameter_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PDS_PARAMETER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPDSParameter upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPDSParameter * +nssPKIXPDSParameter_Duplicate +( + NSSPKIXPDSParameter *p, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXPDSParameter_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXPDSParameter + * 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_PKIX_PDS_PARAMETER + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXPDSParameter_verifyPointer +( + NSSPKIXPDSParameter *p +); +#endif /* DEBUG */ + +/* + * fgmr: what about these PDS types? + * + * PhysicalDeliveryOfficeName + * + * PhysicalDeliveryOfficeNumber + * + * ExtensionORAddressComponents + * + * PhysicalDeliveryPersonalName + * + * PhysicalDeliveryOrganizationName + * + * ExtensionPhysicalDeliveryAddressComponents + * + * StreetAddress + * + * PostOfficeBoxAddress + * + * PosteRestanteAddress + * + * UniquePostalName + * + * LocalPostalAttributes + * + */ + +/* + * UnformattedPostalAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * UnformattedPostalAddress ::= SET { + * printable-address SEQUENCE SIZE (1..ub-pds-physical-address-lines) OF + * PrintableString (SIZE (1..ub-pds-parameter-length)) OPTIONAL, + * teletex-string TeletexString + * (SIZE (1..ub-unformatted-address-length)) OPTIONAL } + * + * The private calls for the type: + * + * + */ + +/* + * ExtendedNetworkAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtendedNetworkAddress ::= CHOICE { + * e163-4-address SEQUENCE { + * number [0] NumericString (SIZE (1..ub-e163-4-number-length)), + * sub-address [1] NumericString + * (SIZE (1..ub-e163-4-sub-address-length)) OPTIONAL }, + * psap-address [0] PresentationAddress } + * + * The private calls for the type: + * + * nssPKIXExtendedNetworkAddress_Decode + * nssPKIXExtendedNetworkAddress_Create + * nssPKIXExtendedNetworkAddress_Encode + * nssPKIXExtendedNetworkAddress_Destroy + * nssPKIXExtendedNetworkAddress_GetChoice + * nssPKIXExtendedNetworkAddress_Get + * nssPKIXExtendedNetworkAddress_GetE1634Address + * nssPKIXExtendedNetworkAddress_GetPsapAddress + * nssPKIXExtendedNetworkAddress_Set + * nssPKIXExtendedNetworkAddress_SetE163Address + * nssPKIXExtendedNetworkAddress_SetPsapAddress + * nssPKIXExtendedNetworkAddress_Equal + * nssPKIXExtendedNetworkAddress_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXExtendedNetworkAddress_verifyPointer + * + */ + +/* + * nssPKIXExtendedNetworkAddress_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtendedNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtendedNetworkAddress * +nssPKIXExtendedNetworkAddress_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXExtendedNetworkAddress_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_INVALID_PKIX_PRESENTATION_ADDRESS + * + * Return value: + * A valid pointer to an NSSPKIXExtendedNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtendedNetworkAddress * +nssPKIXExtendedNetworkAddress_Create +( + NSSArena *arenaOpt, + NSSPKIXExtendedNetworkAddressChoice choice, + void *address +); + +/* + * nssPKIXExtendedNetworkAddress_CreateFromE1634Address + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * + * Return value: + * A valid pointer to an NSSPKIXExtendedNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtendedNetworkAddress * +nssPKIXExtendedNetworkAddress_CreateFromE1634Address +( + NSSArena *arenaOpt, + NSSPKIXe1634Address *e1634address +); + +/* + * nssPKIXExtendedNetworkAddress_CreateFromPresentationAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_PRESENTATION_ADDRESS + * + * Return value: + * A valid pointer to an NSSPKIXExtendedNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtendedNetworkAddress * +nssPKIXExtendedNetworkAddress_CreateFromPresentationAddress +( + NSSArena *arenaOpt, + NSSPKIXPresentationAddress *presentationAddress +); + +/* + * nssPKIXExtendedNetworkAddress_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtendedNetworkAddress_Destroy +( + NSSPKIXExtendedNetworkAddress *ena +); + +/* + * nssPKIXExtendedNetworkAddress_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXExtendedNetworkAddress_Encode +( + NSSPKIXExtendedNetworkAddress *ena, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXExtendedNetworkAddress_GetChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * + * Return value: + * A valid element of the NSSPKIXExtendedNetworkAddressChoice upon + * success + * The value nssPKIXExtendedNetworkAddress_NSSinvalid upon failure + */ + +NSS_EXTERN NSSPKIXExtendedNetworkAddressChoice +nssPKIXExtendedNetworkAddress_GetChoice +( + NSSPKIXExtendedNetworkAddress *ena +); + +/* + * nssPKIXExtendedNetworkAddress_GetSpecifiedChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A pointer... + * NULL upon failure + */ + +NSS_EXTERN void * +nssPKIXExtendedNetworkAddress_GetSpecifiedChoice +( + NSSPKIXExtendedNetworkAddress *ena, + NSSPKIXExtendedNetworkAddressChoice which, + NSSArena *arenaOpt +); + +/* + * nssPKIXExtendedNetworkAddress_GetE1634Address + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A valid pointer to an NSSPKIXe1643Address upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXe1643Address * +nssPKIXExtendedNetworkAddress_GetE1634Address +( + NSSPKIXExtendedNetworkAddress *ena, + NSSArena *arenaOpt +); + +/* + * nssPKIXExtendedNetworkAddress_GetPresentationAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A valid pointer to an NSSPKIXPresentationAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPresentationAddress * +nssPKIXExtendedNetworkAddress_GetPresentationAddress +( + NSSPKIXExtendedNetworkAddress *ena, + NSSArena *arenaOpt +); + +/* + * nssPKIXExtendedNetworkAddress_SetSpecifiedChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_INVALID_PKIX_PRESENTATION_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtendedNetworkAddress_SetSpecifiedChoice +( + NSSPKIXExtendedNetworkAddress *ena, + NSSPKIXExtendedNetworkAddressChoice which, + void *address +); + +/* + * nssPKIXExtendedNetworkAddress_SetE163Address + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtendedNetworkAddress_SetE163Address +( + NSSPKIXExtendedNetworkAddress *ena, + NSSPKIXe1634Address *e1634address +); + +/* + * nssPKIXExtendedNetworkAddress_SetPresentationAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_PRESENTATION_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtendedNetworkAddress_SetPresentationAddress +( + NSSPKIXExtendedNetworkAddress *ena, + NSSPKIXPresentationAddress *presentationAddress +); + +/* + * nssPKIXExtendedNetworkAddress_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXExtendedNetworkAddress_Equal +( + NSSPKIXExtendedNetworkAddress *ena1, + NSSPKIXExtendedNetworkAddress *ena2, + PRStatus *statusOpt +); + +/* + * nssPKIXExtendedNetworkAddress_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXTENDED_NETWORK_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtendedNetworkAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtendedNetworkAddress * +nssPKIXExtendedNetworkAddress_Duplicate +( + NSSPKIXExtendedNetworkAddress *ena, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXExtendedNetworkAddress_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXExtendedNetworkAddress + * 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_PKIX_EXTENDED_NETWORK_ADDRESS + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXExtendedNetworkAddress_verifyPointer +( + NSSPKIXExtendedNetworkAddress *p +); +#endif /* DEBUG */ + +/* + * e163-4-address + * + * Helper structure for ExtendedNetworkAddress. + * -- fgmr comments -- + * + * From RFC 2459: + * + * e163-4-address SEQUENCE { + * number [0] NumericString (SIZE (1..ub-e163-4-number-length)), + * sub-address [1] NumericString + * (SIZE (1..ub-e163-4-sub-address-length)) OPTIONAL }, + * + * The private calls for the type: + * + * nssPKIXe1634Address_Decode + * nssPKIXe1634Address_Create + * nssPKIXe1634Address_Destroy + * nssPKIXe1634Address_Encode + * nssPKIXe1634Address_GetNumber + * nssPKIXe1634Address_SetNumber + * nssPKIXe1634Address_HasSubAddress + * nssPKIXe1634Address_GetSubAddress + * nssPKIXe1634Address_SetSubAddress + * nssPKIXe1634Address_RemoveSubAddress + * nssPKIXe1634Address_Equal + * nssPKIXe1634Address_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXe1634Address_verifyPointer + * + */ + +/* + * nssPKIXe1634Address_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXe1634Address upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXe1634Address * +nssPKIXe1634Address_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXe1634Address_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXe1634Address upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXe1634Address * +nssPKIXe1634Address_Create +( + NSSArena *arenaOpt, + NSSUTF8 *number, + NSSUTF8 *subAddressOpt +); + +/* + * nssPKIXe1634Address_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXe1634Address_Destroy +( + NSSPKIXe1634Address *e +); + +/* + * nssPKIXe1634Address_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXe1634Address_Encode +( + NSSPKIXe1634Address *e, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXe1634Address_GetNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXe1634Address_GetNumber +( + NSSPKIXe1634Address *e, + NSSArena *arenaOpt +); + +/* + * nssPKIXe1634Address_SetNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXe1634Address_SetNumber +( + NSSPKIXe1634Address *e, + NSSUTF8 *number +); + +/* + * nssPKIXe1634Address_HasSubAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXe1634Address_HasSubAddress +( + NSSPKIXe1634Address *e, + PRStatus *statusOpt +); + +/* + * nssPKIXe1634Address_GetSubAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXe1634Address_GetSubAddress +( + NSSPKIXe1634Address *e, + NSSArena *arenaOpt +); + +/* + * nssPKIXe1634Address_SetSubAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXe1634Address_SetSubAddress +( + NSSPKIXe1634Address *e, + NSSUTF8 *subAddress +); + +/* + * nssPKIXe1634Address_RemoveSubAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXe1634Address_RemoveSubAddress +( + NSSPKIXe1634Address *e +); + +/* + * nssPKIXe1634Address_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXe1634Address_Equal +( + NSSPKIXe1634Address *e1, + NSSPKIXe1634Address *e2, + PRStatus *statusOpt +); + +/* + * nssPKIXe1634Address_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_E163_4_ADDRESS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXe1634Address upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXe1634Address * +nssPKIXe1634Address_Duplicate +( + NSSPKIXe1634Address *e, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXe1634Address_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXe1634Address + * 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_PKIX_E163_4_ADDRESS + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXe1634Address_verifyPointer +( + NSSPKIXe1634Address *p +); +#endif /* DEBUG */ + +/* + * PresentationAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PresentationAddress ::= SEQUENCE { + * pSelector [0] EXPLICIT OCTET STRING OPTIONAL, + * sSelector [1] EXPLICIT OCTET STRING OPTIONAL, + * tSelector [2] EXPLICIT OCTET STRING OPTIONAL, + * nAddresses [3] EXPLICIT SET SIZE (1..MAX) OF OCTET STRING } + * + * The private calls for the type: + * + * nssPKIXPresentationAddress_Decode + * nssPKIXPresentationAddress_Create + * nssPKIXPresentationAddress_Destroy + * nssPKIXPresentationAddress_Encode + * nssPKIXPresentationAddress_HasPSelector + * nssPKIXPresentationAddress_GetPSelector + * nssPKIXPresentationAddress_SetPSelector + * nssPKIXPresentationAddress_RemovePSelector + * nssPKIXPresentationAddress_HasSSelector + * nssPKIXPresentationAddress_GetSSelector + * nssPKIXPresentationAddress_SetSSelector + * nssPKIXPresentationAddress_RemoveSSelector + * nssPKIXPresentationAddress_HasTSelector + * nssPKIXPresentationAddress_GetTSelector + * nssPKIXPresentationAddress_SetTSelector + * nssPKIXPresentationAddress_RemoveTSelector + * nssPKIXPresentationAddress_HasNAddresses + * nssPKIXPresentationAddress_GetNAddresses + * nssPKIXPresentationAddress_SetNAddresses + * nssPKIXPresentationAddress_RemoveNAddresses + *{NAddresses must be more complex than that} + * nssPKIXPresentationAddress_Compare + * nssPKIXPresentationAddress_Duplicate + * + * In debug builds, the following call is available: + * + * _verifyPointer + * + */ + +/* + * TeletexDomainDefinedAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexDomainDefinedAttributes ::= SEQUENCE SIZE + * (1..ub-domain-defined-attributes) OF TeletexDomainDefinedAttribute + * + * The private calls for the type: + * + * nssPKIXTeletexDomainDefinedAttributes_Decode + * nssPKIXTeletexDomainDefinedAttributes_Create + * nssPKIXTeletexDomainDefinedAttributes_Destroy + * nssPKIXTeletexDomainDefinedAttributes_Encode + * nssPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttributeCount + * nssPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttributes + * nssPKIXTeletexDomainDefinedAttributes_SetTeletexDomainDefinedAttributes + * nssPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttribute + * nssPKIXTeletexDomainDefinedAttributes_SetTeletexDomainDefinedAttribute + * nssPKIXTeletexDomainDefinedAttributes_InsertTeletexDomainDefinedAttribute + * nssPKIXTeletexDomainDefinedAttributes_AppendTeletexDomainDefinedAttribute + * nssPKIXTeletexDomainDefinedAttributes_RemoveTeletexDomainDefinedAttribute + * nssPKIXTeletexDomainDefinedAttributes_FindTeletexDomainDefinedAttribute + * nssPKIXTeletexDomainDefinedAttributes_Equal + * nssPKIXTeletexDomainDefinedAttributes_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXTeletexDomainDefinedAttributes_verifyPointer + * + */ + +/* + * nssPKIXTeletexDomainDefinedAttributes_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttributes + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttributes * +nssPKIXTeletexDomainDefinedAttributes_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttributes + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttributes * +nssPKIXTeletexDomainDefinedAttributes_Create +( + NSSArena *arenaOpt, + NSSPKIXTeletexDomainDefinedAttribute *tdda1, + ... +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexDomainDefinedAttributes_Destroy +( + NSSPKIXTeletexDomainDefinedAttributes *tddas +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXTeletexDomainDefinedAttributes_Encode +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttributeCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttributeCount +( + NSSPKIXTeletexDomainDefinedAttributes *tddas +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXTeletexDomainDefinedAttribute + * pointers upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttribute ** +nssPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttributes +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + NSSPKIXTeletexDomainDefinedAttribute *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_SetTeletexDomainDefinedAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexDomainDefinedAttributes_SetTeletexDomainDefinedAttributes +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + NSSPKIXTeletexDomainDefinedAttribute *tdda[], + PRInt32 count +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttribute upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttribute * +nssPKIXTeletexDomainDefinedAttributes_GetTeletexDomainDefinedAttribute +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_SetTeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexDomainDefinedAttributes_SetTeletexDomainDefinedAttribute +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + PRInt32 i, + NSSPKIXTeletexDomainDefinedAttribute *tdda +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_InsertTeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexDomainDefinedAttributes_InsertTeletexDomainDefinedAttribute +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + PRInt32 i, + NSSPKIXTeletexDomainDefinedAttribute *tdda +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_AppendTeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexDomainDefinedAttributes_AppendTeletexDomainDefinedAttribute +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + NSSPKIXTeletexDomainDefinedAttribute *tdda +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_RemoveTeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexDomainDefinedAttributes_RemoveTeletexDomainDefinedAttribute +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + PRInt32 i +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_FindTeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * The nonnegative integer upon success + * -1 upon failure + */ + +NSS_EXTERN PRInt32 +nssPKIXTeletexDomainDefinedAttributes_FindTeletexDomainDefinedAttribute +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + NSSPKIXTeletexDomainDefinedAttribute *tdda +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXTeletexDomainDefinedAttributes_Equal +( + NSSPKIXTeletexDomainDefinedAttributes *tddas1, + NSSPKIXTeletexDomainDefinedAttributes *tddas2, + PRStatus *statusOpt +); + +/* + * nssPKIXTeletexDomainDefinedAttributes_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttributes + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttributes * +nssPKIXTeletexDomainDefinedAttributes_Duplicate +( + NSSPKIXTeletexDomainDefinedAttributes *tddas, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXTeletexDomainDefinedAttributes_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXTeletexDomainDefinedAttributes + * 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_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTES + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexDomainDefinedAttributes_verifyPointer +( + NSSPKIXTeletexDomainDefinedAttributes *p +); +#endif /* DEBUG */ + +/* + * TeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexDomainDefinedAttribute ::= SEQUENCE { + * type TeletexString + * (SIZE (1..ub-domain-defined-attribute-type-length)), + * value TeletexString + * (SIZE (1..ub-domain-defined-attribute-value-length)) } + * + * The private calls for the type: + * + * nssPKIXTeletexDomainDefinedAttribute_Decode + * nssPKIXTeletexDomainDefinedAttribute_CreateFromUTF8 + * nssPKIXTeletexDomainDefinedAttribute_Create + * nssPKIXTeletexDomainDefinedAttribute_Destroy + * nssPKIXTeletexDomainDefinedAttribute_Encode + * nssPKIXTeletexDomainDefinedAttribute_GetUTF8Encoding + * nssPKIXTeletexDomainDefinedAttribute_GetType + * nssPKIXTeletexDomainDefinedAttribute_SetType + * nssPKIXTeletexDomainDefinedAttribute_GetValue + * nssPKIXTeletexDomainDefinedAttribute_GetValue + * nssPKIXTeletexDomainDefinedAttribute_Equal + * nssPKIXTeletexDomainDefinedAttribute_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXTeletexDomainDefinedAttribute_verifyPointer + * + */ + +/* + * nssPKIXTeletexDomainDefinedAttribute_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttribute * +nssPKIXTeletexDomainDefinedAttribute_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXTeletexDomainDefinedAttribute_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttribute * +nssPKIXTeletexDomainDefinedAttribute_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXTeletexDomainDefinedAttribute_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttribute * +nssPKIXTeletexDomainDefinedAttribute_Create +( + NSSArena *arenaOpt, + NSSUTF8 *type, + NSSUTF8 *value +); + +/* + * nssPKIXTeletexDomainDefinedAttribute_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexDomainDefinedAttribute_Destroy +( + NSSPKIXTeletexDomainDefinedAttribute *tdda +); + +/* + * nssPKIXTeletexDomainDefinedAttribute_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXTeletexDomainDefinedAttribute_Encode +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexDomainDefinedAttribute_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXTeletexDomainDefinedAttribute_GetUTF8Encoding +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexDomainDefinedAttribute_GetType + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXTeletexDomainDefinedAttribute_GetType +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexDomainDefinedAttribute_SetType + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexDomainDefinedAttribute_SetType +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSUTF8 *type +); + +/* + * nssPKIXTeletexDomainDefinedAttribute_GetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXTeletexDomainDefinedAttribute_GetValue +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSArena *arenaOpt +); + +/* + * nssPKIXTeletexDomainDefinedAttribute_SetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexDomainDefinedAttribute_SetValue +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSUTF8 *value +); + +/* + * nssPKIXTeletexDomainDefinedAttribute_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXTeletexDomainDefinedAttribute_Equal +( + NSSPKIXTeletexDomainDefinedAttribute *tdda1, + NSSPKIXTeletexDomainDefinedAttribute *tdda2, + PRStatus *statusOpt +); + +/* + * nssPKIXTeletexDomainDefinedAttribute_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTeletexDomainDefinedAttribute + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXTeletexDomainDefinedAttribute * +nssPKIXTeletexDomainDefinedAttribute_Duplicate +( + NSSPKIXTeletexDomainDefinedAttribute *tdda, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXTeletexDomainDefinedAttribute_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXTeletexDomainDefinedAttribute + * 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_PKIX_TELETEX_DOMAIN_DEFINED_ATTRIBUTE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXTeletexDomainDefinedAttribute_verifyPointer +( + NSSPKIXTeletexDomainDefinedAttribute *p +); +#endif /* DEBUG */ + +/* + * AuthorityKeyIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AuthorityKeyIdentifier ::= SEQUENCE { + * keyIdentifier [0] KeyIdentifier OPTIONAL, + * authorityCertIssuer [1] GeneralNames OPTIONAL, + * authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL } + * -- authorityCertIssuer and authorityCertSerialNumber shall both + * -- be present or both be absent + * + * The private calls for the type: + * + * nssPKIXAuthorityKeyIdentifier_Decode + * nssPKIXAuthorityKeyIdentifier_Create + * nssPKIXAuthorityKeyIdentifier_Destroy + * nssPKIXAuthorityKeyIdentifier_Encode + * nssPKIXAuthorityKeyIdentifier_HasKeyIdentifier + * nssPKIXAuthorityKeyIdentifier_GetKeyIdentifier + * nssPKIXAuthorityKeyIdentifier_SetKeyIdentifier + * nssPKIXAuthorityKeyIdentifier_RemoveKeyIdentifier + * nssPKIXAuthorityKeyIdentifier_HasAuthorityCertIssuerAndSerialNumber + * nssPKIXAuthorityKeyIdentifier_RemoveAuthorityCertIssuerAndSerialNumber + * nssPKIXAuthorityKeyIdentifier_GetAuthorityCertIssuer + * nssPKIXAuthorityKeyIdentifier_GetAuthorityCertSerialNumber + * nssPKIXAuthorityKeyIdentifier_SetAuthorityCertIssuerAndSerialNumber + * nssPKIXAuthorityKeyIdentifier_Equal + * nssPKIXAuthorityKeyIdentifier_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXAuthorityKeyIdentifier_verifyPointer + * + */ + +/* + * nssPKIXAuthorityKeyIdentifier_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAuthorityKeyIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAuthorityKeyIdentifier * +nssPKIXAuthorityKeyIdentifier_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXAuthorityKeyIdentifier_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_ARGUMENTS + * + * Return value: + * A valid pointer to an NSSPKIXAuthorityKeyIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAuthorityKeyIdentifier * +nssPKIXAuthorityKeyIdentifier_Create +( + NSSArena *arenaOpt, + NSSPKIXKeyIdentifier *keyIdentifierOpt, + NSSPKIXGeneralNames *authorityCertIssuerOpt, + NSSPKIXCertificateSerialNumber *authorityCertSerialNumberOpt +); + +/* + * nssPKIXAuthorityKeyIdentifier_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAuthorityKeyIdentifier_Destroy +( + NSSPKIXAuthorityKeyIdentifier *aki +); + +/* + * nssPKIXAuthorityKeyIdentifier_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXAuthorityKeyIdentifier_Encode +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXAuthorityKeyIdentifier_HasKeyIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXAuthorityKeyIdentifier_HasKeyIdentifier +( + NSSPKIXAuthorityKeyIdentifier *aki, + PRStatus *statusOpt +); + +/* + * nssPKIXAuthorityKeyIdentifier_GetKeyIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_KEY_IDENTIFIER + * + * Return value: + * A valid pointer to an NSSPKIXKeyIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXKeyIdentifier * +nssPKIXAuthorityKeyIdentifier_GetKeyIdentifier +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSPKIXKeyIdentifier *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXAuthorityKeyIdentifier_SetKeyIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAuthorityKeyIdentifier_SetKeyIdentifier +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSPKIXKeyIdentifier *keyIdentifier +); + +/* + * nssPKIXAuthorityKeyIdentifier_RemoveKeyIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_HAS_NO_KEY_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAuthorityKeyIdentifier_RemoveKeyIdentifier +( + NSSPKIXAuthorityKeyIdentifier *aki +); + +/* + * nssPKIXAuthorityKeyIdentifier_HasAuthorityCertIssuerAndSerialNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * + * Return value: + * PR_TRUE if it has them + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXAuthorityKeyIdentifier_HasAuthorityCertIssuerAndSerialNumber +( + NSSPKIXAuthorityKeyIdentifier *aki, + PRStatus *statusOpt +); + +/* + * nssPKIXAuthorityKeyIdentifier_RemoveAuthorityCertIssuerAndSerialNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_HAS_NO_AUTHORITY_CERT_ISSUER_AND_SERIAL_NUMBER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAuthorityKeyIdentifier_RemoveAuthorityCertIssuerAndSerialNumber +( + NSSPKIXAuthorityKeyIdentifier *aki +); + +/* + * nssPKIXAuthorityKeyIdentifier_GetAuthorityCertIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_AUTHORITY_CERT_ISSUER_AND_SERIAL_NUMBER + * + * Return value: + * A valid pointer to an NSSPKIXGeneralNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralNames * +nssPKIXAuthorityKeyIdentifier_GetAuthorityCertIssuer +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSArena *arenaOpt +); + +/* + * nssPKIXAuthorityKeyIdentifier_GetAuthorityCertSerialNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_AUTHORITY_CERT_ISSUER_AND_SERIAL_NUMBER + * + * Return value: + * A valid pointer to an NSSPKIXCertificateSerialNumber upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificateSerialNumber * +nssPKIXAuthorityKeyIdentifier_GetAuthorityCertSerialNumber +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSPKIXCertificateSerialNumber *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXAuthorityKeyIdentifier_SetAuthorityCertIssuerAndSerialNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAuthorityKeyIdentifier_SetAuthorityCertIssuerAndSerialNumber +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSPKIXGeneralNames *issuer, + NSSPKIXCertificateSerialNumber *serialNumber +); + +/* + * nssPKIXAuthorityKeyIdentifier_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXAuthorityKeyIdentifier_Equal +( + NSSPKIXAuthorityKeyIdentifier *aki1, + NSSPKIXAuthorityKeyIdentifier *aki2, + PRStatus *statusOpt +); + +/* + * nssPKIXAuthorityKeyIdentifier_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_KEY_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAuthorityKeyIdentifier upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAuthorityKeyIdentifier * +nssPKIXAuthorityKeyIdentifier_Duplicate +( + NSSPKIXAuthorityKeyIdentifier *aki, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXAuthorityKeyIdentifier_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXAuthorityKeyIdentifier + * 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_PKIX_AUTHORITY_KEY_IDENTIFIER + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXAuthorityKeyIdentifier_verifyPointer +( + NSSPKIXAuthorityKeyIdentifier *p +); +#endif /* DEBUG */ + +/* + * KeyUsage + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * KeyUsage ::= BIT STRING { + * digitalSignature (0), + * nonRepudiation (1), + * keyEncipherment (2), + * dataEncipherment (3), + * keyAgreement (4), + * keyCertSign (5), + * cRLSign (6), + * encipherOnly (7), + * decipherOnly (8) } + * + * The private calls for the type: + * + * nssPKIXKeyUsage_Decode + * nssPKIXKeyUsage_CreateFromUTF8 + * nssPKIXKeyUsage_CreateFromValue + * nssPKIXKeyUsage_Destroy + * nssPKIXKeyUsage_Encode + * nssPKIXKeyUsage_GetUTF8Encoding + * nssPKIXKeyUsage_GetValue + * nssPKIXKeyUsage_SetValue + * { bitwise accessors? } + * nssPKIXKeyUsage_Equal + * nssPKIXKeyUsage_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXKeyUsage_verifyPointer + * + */ + +/* + * nssPKIXKeyUsage_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXKeyUsage upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXKeyUsage * +nssPKIXKeyUsage_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXKeyUsage_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXKeyUsage upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXKeyUsage * +nssPKIXKeyUsage_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXKeyUsage_CreateFromValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE_VALUE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXKeyUsage upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXKeyUsage * +nssPKIXKeyUsage_CreateFromValue +( + NSSArena *arenaOpt, + NSSPKIXKeyUsageValue value +); + +/* + * nssPKIXKeyUsage_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXKeyUsage_Destroy +( + NSSPKIXKeyUsage *keyUsage +); + +/* + * nssPKIXKeyUsage_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXKeyUsage_Encode +( + NSSPKIXKeyUsage *keyUsage, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXKeyUsage_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXKeyUsage_GetUTF8Encoding +( + NSSPKIXKeyUsage *keyUsage, + NSSArena *arenaOpt +); + +/* + * nssPKIXKeyUsage_GetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * + * Return value: + * A set of NSSKeyUsageValue values OR-d together upon success + * NSSKeyUsage_NSSinvalid upon failure + */ + +NSS_EXTERN NSSKeyUsageValue +nssPKIXKeyUsage_GetValue +( + NSSPKIXKeyUsage *keyUsage +); + +/* + * nssPKIXKeyUsage_SetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * NSS_ERROR_INVALID_PKIX_KEY_USAGE_VALUE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXKeyUsage_SetValue +( + NSSPKIXKeyUsage *keyUsage, + NSSPKIXKeyUsageValue value +); + +/* + * nssPKIXKeyUsage_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXKeyUsage_Equal +( + NSSPKIXKeyUsage *keyUsage1, + NSSPKIXKeyUsage *keyUsage2, + PRStatus *statusOpt +); + +/* + * nssPKIXKeyUsage_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_KEY_USAGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXKeyUsage upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXKeyUsage * +nssPKIXKeyUsage_Duplicate +( + NSSPKIXKeyUsage *keyUsage, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXKeyUsage_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXKeyUsage + * 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_PKIX_KEY_USAGE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXKeyUsage_verifyPointer +( + NSSPKIXKeyUsage *p +); +#endif /* DEBUG */ + +/* + * PrivateKeyUsagePeriod + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PrivateKeyUsagePeriod ::= SEQUENCE { + * notBefore [0] GeneralizedTime OPTIONAL, + * notAfter [1] GeneralizedTime OPTIONAL } + * -- either notBefore or notAfter shall be present + * + * The private calls for the type: + * + * nssPKIXPrivateKeyUsagePeriod_Decode + * nssPKIXPrivateKeyUsagePeriod_Create + * nssPKIXPrivateKeyUsagePeriod_Destroy + * nssPKIXPrivateKeyUsagePeriod_Encode + * nssPKIXPrivateKeyUsagePeriod_HasNotBefore + * nssPKIXPrivateKeyUsagePeriod_GetNotBefore + * nssPKIXPrivateKeyUsagePeriod_SetNotBefore + * nssPKIXPrivateKeyUsagePeriod_RemoveNotBefore + * nssPKIXPrivateKeyUsagePeriod_HasNotAfter + * nssPKIXPrivateKeyUsagePeriod_GetNotAfter + * nssPKIXPrivateKeyUsagePeriod_SetNotAfter + * nssPKIXPrivateKeyUsagePeriod_RemoveNotAfter + * nssPKIXPrivateKeyUsagePeriod_Equal + * nssPKIXPrivateKeyUsagePeriod_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXPrivateKeyUsagePeriod_verifyPointer + * + */ + +/* + * nssPKIXPrivateKeyUsagePeriod_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPrivateKeyUsagePeriod upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPrivateKeyUsagePeriod * +nssPKIXPrivateKeyUsagePeriod_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXPrivateKeyUsagePeriod_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_TIME + * NSS_ERROR_INVALID_ARGUMENTS + * + * Return value: + * A valid pointer to an NSSPKIXPrivateKeyUsagePeriod upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPrivateKeyUsagePeriod * +nssPKIXPrivateKeyUsagePeriod_Create +( + NSSArena *arenaOpt, + NSSTime *notBeforeOpt, + NSSTime *notAfterOpt +); + +/* + * nssPKIXPrivateKeyUsagePeriod_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPrivateKeyUsagePeriod_Destroy +( + NSSPKIXPrivateKeyUsagePeriod *period +); + +/* + * nssPKIXPrivateKeyUsagePeriod_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_DATA + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXPrivateKeyUsagePeriod_Encode +( + NSSPKIXPrivateKeyUsagePeriod *period, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXPrivateKeyUsagePeriod_HasNotBefore + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXPrivateKeyUsagePeriod_HasNotBefore +( + NSSPKIXPrivateKeyUsagePeriod *period, + PRStatus *statusOpt +); + +/* + * nssPKIXPrivateKeyUsagePeriod_GetNotBefore + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_NOT_BEFORE + * + * Return value: + * NSSTime {fgmr!} + * NULL upon failure + */ + +NSS_EXTERN NSSTime * +nssPKIXPrivateKeyUsagePeriod_GetNotBefore +( + NSSPKIXPrivateKeyUsagePeriod *period, + NSSArena *arenaOpt +); + +/* + * nssPKIXPrivateKeyUsagePeriod_SetNotBefore + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_INVALID_TIME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPrivateKeyUsagePeriod_SetNotBefore +( + NSSPKIXPrivateKeyUsagePeriod *period, + NSSTime *notBefore +); + +/* + * nssPKIXPrivateKeyUsagePeriod_RemoveNotBefore + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_HAS_NO_NOT_BEFORE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPrivateKeyUsagePeriod_RemoveNotBefore +( + NSSPKIXPrivateKeyUsagePeriod *period +); + +/* + * nssPKIXPrivateKeyUsagePeriod_HasNotAfter + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXPrivateKeyUsagePeriod_HasNotAfter +( + NSSPKIXPrivateKeyUsagePeriod *period, + PRStatus *statusOpt +); + +/* + * nssPKIXPrivateKeyUsagePeriod_GetNotAfter + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_NOT_AFTER + * + * Return value: + * NSSTime {fgmr!} + * NULL upon failure + */ + +NSS_EXTERN NSSTime * +nssPKIXPrivateKeyUsagePeriod_GetNotAfter +( + NSSPKIXPrivateKeyUsagePeriod *period, + NSSArena *arenaOpt +); + +/* + * nssPKIXPrivateKeyUsagePeriod_SetNotAfter + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_INVALID_TIME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPrivateKeyUsagePeriod_SetNotAfter +( + NSSPKIXPrivateKeyUsagePeriod *period, + NSSTime *notAfter +); + +/* + * nssPKIXPrivateKeyUsagePeriod_RemoveNotAfter + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_HAS_NO_NOT_AFTER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPrivateKeyUsagePeriod_RemoveNotAfter +( + NSSPKIXPrivateKeyUsagePeriod *period +); + +/* + * nssPKIXPrivateKeyUsagePeriod_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXPrivateKeyUsagePeriod_Equal +( + NSSPKIXPrivateKeyUsagePeriod *period1, + NSSPKIXPrivateKeyUsagePeriod *period2, + PRStatus *statusOpt +); + +/* + * nssPKIXPrivateKeyUsagePeriod_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_PRIVATE_KEY_USAGE_PERIOD + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPrivateKeyUsagePeriod upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPrivateKeyUsagePeriod * +nssPKIXPrivateKeyUsagePeriod_Duplicate +( + NSSPKIXPrivateKeyUsagePeriod *period, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXPrivateKeyUsagePeriod_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXPrivateKeyUsagePeriod + * 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_PKIX_PRIVATE_KEY_USAGE_PERIOD + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXPrivateKeyUsagePeriod_verifyPointer +( + NSSPKIXPrivateKeyUsagePeriod *p +); +#endif /* DEBUG */ + +/* + * CertificatePolicies + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CertificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation + * + * The private calls for the type: + * + * nssPKIXCertificatePolicies_Decode + * nssPKIXCertificatePolicies_Create + * nssPKIXCertificatePolicies_Destroy + * nssPKIXCertificatePolicies_Encode + * nssPKIXCertificatePolicies_GetPolicyInformationCount + * nssPKIXCertificatePolicies_GetPolicyInformations + * nssPKIXCertificatePolicies_SetPolicyInformations + * nssPKIXCertificatePolicies_GetPolicyInformation + * nssPKIXCertificatePolicies_SetPolicyInformation + * nssPKIXCertificatePolicies_InsertPolicyInformation + * nssPKIXCertificatePolicies_AppendPolicyInformation + * nssPKIXCertificatePolicies_RemovePolicyInformation + * nssPKIXCertificatePolicies_FindPolicyInformation + * nssPKIXCertificatePolicies_Equal + * nssPKIXCertificatePolicies_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXCertificatePolicies_verifyPointer + * + */ + +/* + * nssPKIXCertificatePolicies_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCertificatePolicies upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificatePolicies * +nssPKIXCertificatePolicies_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXCertificatePolicies_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * + * Return value: + * A valid pointer to an NSSPKIXCertificatePolicies upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificatePolicies * +nssPKIXCertificatePolicies_Create +( + NSSArena *arenaOpt, + NSSPKIXPolicyInformation *pi1, + ... +); + +/* + * nssPKIXCertificatePolicies_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificatePolicies_Destroy +( + NSSPKIXCertificatePolicies *cp +); + +/* + * nssPKIXCertificatePolicies_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXCertificatePolicies_Encode +( + NSSPKIXCertificatePolicies *cp, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXCertificatePolicies_GetPolicyInformationCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXCertificatePolicies_GetPolicyInformationCount +( + NSSPKIXCertificatePolicies *cp +); + +/* + * nssPKIXCertificatePolicies_GetPolicyInformations + * + * We regret the function name. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXPolicyInformation pointers + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyInformation ** +nssPKIXCertificatePolicies_GetPolicyInformations +( + NSSPKIXCertificatePolicies *cp, + NSSPKIXPolicyInformation *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXCertificatePolicies_SetPolicyInformations + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificatePolicies_SetPolicyInformations +( + NSSPKIXCertificatePolicies *cp, + NSSPKIXPolicyInformation *pi[], + PRInt32 count +); + +/* + * nssPKIXCertificatePolicies_GetPolicyInformation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyInformation upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyInformation * +nssPKIXCertificatePolicies_GetPolicyInformation +( + NSSPKIXCertificatePolicies *cp, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXCertificatePolicies_SetPolicyInformation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificatePolicies_SetPolicyInformation +( + NSSPKIXCertificatePolicies *cp, + PRInt32 i, + NSSPKIXPolicyInformation *pi +); + +/* + * nssPKIXCertificatePolicies_InsertPolicyInformation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificatePolicies_InsertPolicyInformation +( + NSSPKIXCertificatePolicies *cp, + PRInt32 i, + NSSPKIXPolicyInformation *pi +); + +/* + * nssPKIXCertificatePolicies_AppendPolicyInformation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificatePolicies_AppendPolicyInformation +( + NSSPKIXCertificatePolicies *cp, + NSSPKIXPolicyInformation *pi +); + +/* + * nssPKIXCertificatePolicies_RemovePolicyInformation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCertificatePolicies_RemovePolicyInformation +( + NSSPKIXCertificatePolicies *cp, + PRInt32 i +); + +/* + * nssPKIXCertificatePolicies_FindPolicyInformation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * + * Return value: + * The nonnegative integer upon success + * -1 upon failure + */ + +NSS_EXTERN PRInt32 +nssPKIXCertificatePolicies_FindPolicyInformation +( + NSSPKIXCertificatePolicies *cp, + NSSPKIXPolicyInformation *pi +); + +/* + * nssPKIXCertificatePolicies_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXCertificatePolicies_Equal +( + NSSPKIXCertificatePolicies *cp1, + NSSPKIXCertificatePolicies *cp2, + PRStatus *statusOpt +); + +/* + * nssPKIXCertificatePolicies_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CERTIFICATE_POLICIES + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCertificatePolicies upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertificatePolicies * +nssPKIXCertificatePolicies_Duplicate +( + NSSPKIXCertificatePolicies *cp, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXCertificatePolicies_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXCertificatePolicies + * 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_PKIX_CERTIFICATE_POLICIES + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXCertificatePolicies_verifyPointer +( + NSSPKIXCertificatePolicies *p +); +#endif /* DEBUG */ + +/* + * PolicyInformation + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyInformation ::= SEQUENCE { + * policyIdentifier CertPolicyId, + * policyQualifiers SEQUENCE SIZE (1..MAX) OF + * PolicyQualifierInfo OPTIONAL } + * + * The private calls for the type: + * + * nssPKIXPolicyInformation_Decode + * nssPKIXPolicyInformation_Create + * nssPKIXPolicyInformation_Destroy + * nssPKIXPolicyInformation_Encode + * nssPKIXPolicyInformation_GetPolicyIdentifier + * nssPKIXPolicyInformation_SetPolicyIdentifier + * nssPKIXPolicyInformation_GetPolicyQualifierCount + * nssPKIXPolicyInformation_GetPolicyQualifiers + * nssPKIXPolicyInformation_SetPolicyQualifiers + * nssPKIXPolicyInformation_GetPolicyQualifier + * nssPKIXPolicyInformation_SetPolicyQualifier + * nssPKIXPolicyInformation_InsertPolicyQualifier + * nssPKIXPolicyInformation_AppendPolicyQualifier + * nssPKIXPolicyInformation_RemovePolicyQualifier + * nssPKIXPolicyInformation_Equal + * nssPKIXPolicyInformation_Duplicate + * { and accessors by specific policy qualifier ID } + * + * In debug builds, the following call is available: + * + * nssPKIXPolicyInformation_verifyPointer + * + */ + +/* + * nssPKIXPolicyInformation_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyInformation upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyInformation * +nssPKIXPolicyInformation_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXPolicyInformation_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * + * Return value: + * A valid pointer to an NSSPKIXPolicyInformation upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyInformation * +nssPKIXPolicyInformation_Create +( + NSSArena *arenaOpt, + NSSPKIXCertPolicyId *id, + NSSPKIXPolicyQualifierInfo *pqi1, + ... +); + +/* + * nssPKIXPolicyInformation_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyInformation_Destroy +( + NSSPKIXPolicyInformation *pi +); + +/* + * nssPKIXPolicyInformation_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXPolicyInformation_Encode +( + NSSPKIXPolicyInformation *pi, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXPolicyInformation_GetPolicyIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid OID upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertPolicyId * +nssPKIXPolicyInformation_GetPolicyIdentifier +( + NSSPKIXPolicyInformation *pi +); + +/* + * nssPKIXPolicyInformation_SetPolicyIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyInformation_SetPolicyIdentifier +( + NSSPKIXPolicyInformation *pi, + NSSPKIXCertPolicyIdentifier *cpi +); + +/* + * nssPKIXPolicyInformation_GetPolicyQualifierCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXPolicyInformation_GetPolicyQualifierCount +( + NSSPKIXPolicyInformation *pi +); + +/* + * nssPKIXPolicyInformation_GetPolicyQualifiers + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXPolicyQualifierInfo pointers + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyQualifierInfo ** +nssPKIXPolicyInformation_GetPolicyQualifiers +( + NSSPKIXPolicyInformation *pi, + NSSPKIXPolicyQualifierInfo *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXPolicyInformation_SetPolicyQualifiers + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyInformation_SetPolicyQualifiers +( + NSSPKIXPolicyInformation *pi, + NSSPKIXPolicyQualifierInfo *pqi[], + PRInt32 count +); + +/* + * nssPKIXPolicyInformation_GetPolicyQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyQualifierInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyQualifierInfo * +nssPKIXPolicyInformation_GetPolicyQualifier +( + NSSPKIXPolicyInformation *pi, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXPolicyInformation_SetPolicyQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyInformation_SetPolicyQualifier +( + NSSPKIXPolicyInformation *pi, + PRInt32 i, + NSSPKIXPolicyQualifierInfo *pqi +); + +/* + * nssPKIXPolicyInformation_InsertPolicyQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyInformation_InsertPolicyQualifier +( + NSSPKIXPolicyInformation *pi, + PRInt32 i, + NSSPKIXPolicyQualifierInfo *pqi +); + +/* + * nssPKIXPolicyInformation_AppendPolicyQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyInformation_AppendPolicyQualifier +( + NSSPKIXPolicyInformation *pi, + PRInt32 i, + NSSPKIXPolicyQualifierInfo *pqi +); + +/* + * nssPKIXPolicyInformation_RemovePolicyQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyInformation_RemovePolicyQualifier +( + NSSPKIXPolicyInformation *pi, + PRInt32 i +); + +/* + * nssPKIXPolicyInformation_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXPolicyInformation_Equal +( + NSSPKIXPolicyInformation *pi1, + NSSPKIXPolicyInformation *pi2, + PRStatus *statusOpt +); + +/* + * nssPKIXPolicyInformation_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_INFORMATION + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyInformation upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyInformation * +nssPKIXPolicyInformation_Duplicate +( + NSSPKIXPolicyInformation *pi, + NSSArena *arenaOpt +); + +/* + * { and accessors by specific policy qualifier ID } + * + */ + +#ifdef DEBUG +/* + * nssPKIXPolicyInformation_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXPolicyInformation + * 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_PKIX_POLICY_INFORMATION + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyInformation_verifyPointer +( + NSSPKIXPolicyInformation *p +); +#endif /* DEBUG */ + +/* + * PolicyQualifierInfo + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyQualifierInfo ::= SEQUENCE { + * policyQualifierId PolicyQualifierId, + * qualifier ANY DEFINED BY policyQualifierId } + * + * The private calls for the type: + * + * nssPKIXPolicyQualifierInfo_Decode + * nssPKIXPolicyQualifierInfo_Create + * nssPKIXPolicyQualifierInfo_Destroy + * nssPKIXPolicyQualifierInfo_Encode + * nssPKIXPolicyQualifierInfo_GetPolicyQualifierID + * nssPKIXPolicyQualifierInfo_SetPolicyQualifierID + * nssPKIXPolicyQualifierInfo_GetQualifier + * nssPKIXPolicyQualifierInfo_SetQualifier + * nssPKIXPolicyQualifierInfo_Equal + * nssPKIXPolicyQualifierInfo_Duplicate + * { and accessors by specific qualifier id/type } + * + * In debug builds, the following call is available: + * + * nssPKIXPolicyQualifierInfo_verifyPointer + * + */ + +/* + * nssPKIXPolicyQualifierInfo_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyQualifierInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyQualifierInfo * +nssPKIXPolicyQualifierInfo_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXPolicyQualifierInfo_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_ID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXPolicyQualifierInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyQualifierInfo * +nssPKIXPolicyQualifierInfo_Create +( + NSSArena *arenaOpt, + NSSPKIXPolicyQualifierId *policyQualifierId, + NSSItem *qualifier +); + +/* + * nssPKIXPolicyQualifierInfo_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyQualifierInfo_Destroy +( + NSSPKIXPolicyQualifierInfo *pqi +); + +/* + * nssPKIXPolicyQualifierInfo_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXPolicyQualifierInfo_Encode +( + NSSPKIXPolicyQualifierInfo *pqi, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXPolicyQualifierInfo_GetPolicyQualifierId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXPolicyQualifierId (an NSSOID) upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyQualifierId * +nssPKIXPolicyQualifierInfo_GetPolicyQualifierId +( + NSSPKIXPolicyQualifierInfo *pqi, + NSSArena *arenaOpt +); + +/* + * nssPKIXPolicyQualifierInfo_SetPolicyQualifierId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_ID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyQualifierInfo_SetPolicyQualifierId +( + NSSPKIXPolicyQualifierInfo *pqi, + NSSPKIXPolicyQualifierId *pqid +); + +/* + * nssPKIXPolicyQualifierInfo_GetQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +nssPKIXPolicyQualifierInfo_GetQualifier +( + NSSPKIXPolicyQualifierInfo *pqi, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXPolicyQualifierInfo_SetQualifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyQualifierInfo_SetQualifier +( + NSSPKIXPolicyQualifierInfo *pqi, + NSSItem *qualifier +); + +/* + * nssPKIXPolicyQualifierInfo_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXPolicyQualifierInfo_Equal +( + NSSPKIXPolicyQualifierInfo *pqi1, + NSSPKIXPolicyQualifierInfo *pqi2, + PRStatus *statusOpt +); + +/* + * nssPKIXPolicyQualifierInfo_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_QUALIFIER_INFO + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyQualifierInfo upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyQualifierInfo * +nssPKIXPolicyQualifierInfo_Duplicate +( + NSSPKIXPolicyQualifierInfo *pqi, + NSSArena *arenaOpt +); + +/* + * { and accessors by specific qualifier id/type } + * + */ +#ifdef DEBUG +/* + * nssPKIXPolicyQualifierInfo_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXPolicyQualifierInfo + * 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_PKIX_POLICY_QUALIFIER_INFO + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyQualifierInfo_verifyPointer +( + NSSPKIXPolicyQualifierInfo *p +); +#endif /* DEBUG */ + +/* + * CPSuri + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CPSuri ::= IA5String + * + * The private calls for this type: + * + * nssPKIXCPSuri_Decode + * nssPKIXCPSuri_CreateFromUTF8 + * nssPKIXCPSuri_Encode + * + */ + +/* + * nssPKIXCPSuri_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCPSuri upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCPSuri * +nssPKIXCPSuri_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXCPSuri_CreateFromUTF8 + * + * { basically just enforces the length and charset limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCPSuri upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCPSuri * +nssPKIXCPSuri_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXCPSuri_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CPS_URI + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXCPSuri_Encode +( + NSSPKIXCPSuri *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * UserNotice + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * UserNotice ::= SEQUENCE { + * noticeRef NoticeReference OPTIONAL, + * explicitText DisplayText OPTIONAL} + * + * The private calls for this type: + * + * nssPKIXUserNotice_Decode + * nssPKIXUserNotice_Create + * nssPKIXUserNotice_Destroy + * nssPKIXUserNotice_Encode + * nssPKIXUserNotice_HasNoticeRef + * nssPKIXUserNotice_GetNoticeRef + * nssPKIXUserNotice_SetNoticeRef + * nssPKIXUserNotice_RemoveNoticeRef + * nssPKIXUserNotice_HasExplicitText + * nssPKIXUserNotice_GetExplicitText + * nssPKIXUserNotice_SetExplicitText + * nssPKIXUserNotice_RemoveExplicitText + * nssPKIXUserNotice_Equal + * nssPKIXUserNotice_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXUserNotice_verifyPointer + * + */ + + +/* + * nssPKIXUserNotice_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXUserNotice upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXUserNotice * +nssPKIXUserNotice_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXUserNotice_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_INVALID_PKIX_DISPLAY_TEXT + * + * Return value: + * A valid pointer to an NSSPKIXUserNotice upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXUserNotice * +nssPKIXUserNotice_Create +( + NSSArena *arenaOpt, + NSSPKIXNoticeReference *noticeRef, + NSSPKIXDisplayText *explicitText +); + +/* + * nssPKIXUserNotice_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXUserNotice_Destroy +( + NSSPKIXUserNotice *userNotice +); + +/* + * nssPKIXUserNotice_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXUserNotice_Encode +( + NSSPKIXUserNotice *userNotice, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXUserNotice_HasNoticeRef + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXUserNotice_HasNoticeRef +( + NSSPKIXUserNotice *userNotice, + PRStatus *statusOpt +); + +/* + * nssPKIXUserNotice_GetNoticeRef + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_NOTICE_REF + * + * Return value: + * A valid pointer to an NSSPKIXNoticeReference upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNoticeReference * +nssPKIXUserNotice_GetNoticeRef +( + NSSPKIXUserNotice *userNotice, + NSSArena *arenaOpt +); + +/* + * nssPKIXUserNotice_SetNoticeRef + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXUserNotice_SetNoticeRef +( + NSSPKIXUserNotice *userNotice, + NSSPKIXNoticeReference *noticeRef +); + +/* + * nssPKIXUserNotice_RemoveNoticeRef + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_HAS_NO_NOTICE_REF + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXUserNotice_RemoveNoticeRef +( + NSSPKIXUserNotice *userNotice +); + +/* + * nssPKIXUserNotice_HasExplicitText + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * + * Return value: + * PR_TRUE if it has some + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXUserNotice_HasExplicitText +( + NSSPKIXUserNotice *userNotice, + PRStatus *statusOpt +); + +/* + * nssPKIXUserNotice_GetExplicitText + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_EXPLICIT_TEXT + * + * Return value: + * A valid pointer to an NSSPKIXDisplayText string upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDisplayText * +nssPKIXUserNotice_GetExplicitText +( + NSSPKIXUserNotice *userNotice, + NSSArena *arenaOpt +); + +/* + * nssPKIXUserNotice_SetExplicitText + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_INVALID_PKIX_DISPLAY_TEXT + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXUserNotice_SetExplicitText +( + NSSPKIXUserNotice *userNotice, + NSSPKIXDisplayText *explicitText +); + +/* + * nssPKIXUserNotice_RemoveExplicitText + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_HAS_NO_EXPLICIT_TEXT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXUserNotice_RemoveExplicitText +( + NSSPKIXUserNotice *userNotice +); + +/* + * nssPKIXUserNotice_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXUserNotice_Equal +( + NSSPKIXUserNotice *userNotice1, + NSSPKIXUserNotice *userNotice2, + PRStatus *statusOpt +); + +/* + * nssPKIXUserNotice_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_USER_NOTICE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXUserNotice upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXUserNotice * +nssPKIXUserNotice_Duplicate +( + NSSPKIXUserNotice *userNotice, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXUserNotice_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXUserNotice + * 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_PKIX_USER_NOTICE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXUserNotice_verifyPointer +( + NSSPKIXUserNotice *p +); +#endif /* DEBUG */ + +/* + * NoticeReference + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NoticeReference ::= SEQUENCE { + * organization DisplayText, + * noticeNumbers SEQUENCE OF INTEGER } + * + * The private calls for this type: + * + * nssPKIXNoticeReference_Decode + * nssPKIXNoticeReference_Create + * nssPKIXNoticeReference_Destroy + * nssPKIXNoticeReference_Encode + * nssPKIXNoticeReference_GetOrganization + * nssPKIXNoticeReference_SetOrganization + * nssPKIXNoticeReference_GetNoticeNumberCount + * nssPKIXNoticeReference_GetNoticeNumbers + * nssPKIXNoticeReference_SetNoticeNumbers + * nssPKIXNoticeReference_GetNoticeNumber + * nssPKIXNoticeReference_SetNoticeNumber + * nssPKIXNoticeReference_InsertNoticeNumber + * nssPKIXNoticeReference_AppendNoticeNumber + * nssPKIXNoticeReference_RemoveNoticeNumber + * { maybe number-exists-p gettor? } + * nssPKIXNoticeReference_Equal + * nssPKIXNoticeReference_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXNoticeReference_verifyPointer + * + */ + +/* + * nssPKIXNoticeReference_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNoticeReference upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNoticeReference * +nssPKIXNoticeReference_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXNoticeReference_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_DISPLAY_TEXT + * + * Return value: + * A valid pointer to an NSSPKIXNoticeReference upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNoticeReference * +nssPKIXNoticeReference_Create +( + NSSArena *arenaOpt, + NSSPKIXDisplayText *organization, + PRUint32 noticeCount, + PRInt32 noticeNumber1, + ... +); + +/* + * { fgmr -- or should the call that takes PRInt32 be _CreateFromValues, + * and the _Create call take NSSBER integers? } + */ + +/* + * nssPKIXNoticeReference_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXNoticeReference_Destroy +( + NSSPKIXNoticeReference *nr +); + +/* + * nssPKIXNoticeReference_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXNoticeReference_Encode +( + NSSPKIXNoticeReference *nr, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXNoticeReference_GetOrganization + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXDisplayText string upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDisplayText * +nssPKIXNoticeReference_GetOrganization +( + NSSPKIXNoticeReference *nr, + NSSArena *arenaOpt +); + +/* + * nssPKIXNoticeReference_SetOrganization + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_INVALID_PKIX_DISPLAY_TEXT + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXNoticeReference_SetOrganization +( + NSSPKIXNoticeReference *nr, + NSSPKIXDisplayText *organization +); + +/* + * nssPKIXNoticeReference_GetNoticeNumberCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXNoticeReference_GetNoticeNumberCount +( + NSSPKIXNoticeReference *nr +); + +/* + * nssPKIXNoticeReference_GetNoticeNumbers + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of PRInt32 values upon success + * NULL upon failure + */ + +NSS_EXTERN PRInt32 * +nssPKIXNoticeReference_GetNoticeNumbers +( + NSSPKIXNoticeReference *nr, + PRInt32 rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXNoticeReference_SetNoticeNumbers + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXNoticeReference_SetNoticeNumbers +( + NSSPKIXNoticeReference *nr, + PRInt32 noticeNumbers[], + PRInt32 count +); + +/* + * nssPKIXNoticeReference_GetNoticeNumber + * + * -- fgmr comments -- + * Because there is no natural "invalid" notice number value, we must + * pass the number by reference, and return an explicit status value. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_POINTER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXNoticeReference_GetNoticeNumber +( + NSSPKIXNoticeReference *nr, + PRInt32 i, + PRInt32 *noticeNumberP +); + +/* + * nssPKIXNoticeReference_SetNoticeNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXNoticeReference_SetNoticeNumber +( + NSSPKIXNoticeReference *nr, + PRInt32 i, + PRInt32 noticeNumber +); + +/* + * nssPKIXNoticeReference_InsertNoticeNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXNoticeReference_InsertNoticeNumber +( + NSSPKIXNoticeReference *nr, + PRInt32 i, + PRInt32 noticeNumber +); + +/* + * nssPKIXNoticeReference_AppendNoticeNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXNoticeReference_AppendNoticeNumber +( + NSSPKIXNoticeReference *nr, + PRInt32 noticeNumber +); + +/* + * nssPKIXNoticeReference_RemoveNoticeNumber + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXNoticeReference_RemoveNoticeNumber +( + NSSPKIXNoticeReference *nr, + PRInt32 i +); + +/* + * { maybe number-exists-p gettor? } + */ + +/* + * nssPKIXNoticeReference_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXNoticeReference_Equal +( + NSSPKIXNoticeReference *nr1, + NSSPKIXNoticeReference *nr2, + PRStatus *statusOpt +); + +/* + * nssPKIXNoticeReference_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NOTICE_REFERENCE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNoticeReference upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNoticeReference * +nssPKIXNoticeReference_Duplicate +( + NSSPKIXNoticeReference *nr, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXNoticeReference_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXNoticeReference + * 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_PKIX_NOTICE_REFERENCE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXNoticeReference_verifyPointer +( + NSSPKIXNoticeReference *p +); +#endif /* DEBUG */ + +/* + * DisplayText + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DisplayText ::= CHOICE { + * visibleString VisibleString (SIZE (1..200)), + * bmpString BMPString (SIZE (1..200)), + * utf8String UTF8String (SIZE (1..200)) } + * + * The private calls for this type: + * + * nssPKIXDisplayText_Decode + * nssPKIXDisplayText_CreateFromUTF8 + * nssPKIXDisplayText_Encode + * + */ + +/* + * nssPKIXDisplayText_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDisplayText upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDisplayText * +nssPKIXDisplayText_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXDisplayText_CreateFromUTF8 + * + * { basically just enforces the length and charset limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDisplayText upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDisplayText * +nssPKIXDisplayText_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXDisplayText_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISPLAY_TEXT + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXDisplayText_Encode +( + NSSPKIXDisplayText *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * PolicyMappings + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE { + * issuerDomainPolicy CertPolicyId, + * subjectDomainPolicy CertPolicyId } + * + * The private calls for this type: + * + * nssPKIXPolicyMappings_Decode + * nssPKIXPolicyMappings_Create + * nssPKIXPolicyMappings_Destroy + * nssPKIXPolicyMappings_Encode + * nssPKIXPolicyMappings_GetPolicyMappingCount + * nssPKIXPolicyMappings_GetPolicyMappings + * nssPKIXPolicyMappings_SetPolicyMappings + * nssPKIXPolicyMappings_GetPolicyMapping + * nssPKIXPolicyMappings_SetPolicyMapping + * nssPKIXPolicyMappings_InsertPolicyMapping + * nssPKIXPolicyMappings_AppendPolicyMapping + * nssPKIXPolicyMappings_RemovePolicyMapping + * nssPKIXPolicyMappings_FindPolicyMapping + * nssPKIXPolicyMappings_Equal + * nssPKIXPolicyMappings_Duplicate + * nssPKIXPolicyMappings_IssuerDomainPolicyExists + * nssPKIXPolicyMappings_SubjectDomainPolicyExists + * nssPKIXPolicyMappings_FindIssuerDomainPolicy + * nssPKIXPolicyMappings_FindSubjectDomainPolicy + * nssPKIXPolicyMappings_MapIssuerToSubject + * nssPKIXPolicyMappings_MapSubjectToIssuer + * { find's and map's: what if there's more than one? } + * + * In debug builds, the following call is available: + * + * nssPKIXPolicyMappings_verifyPointer + * + */ + +/* + * nssPKIXPolicyMappings_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyMappings upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyMappings * +nssPKIXPolicyMappings_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXPolicyMappings_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * + * Return value: + * A valid pointer to an NSSPKIXPolicyMappings upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyMappings * +nssPKIXPolicyMappings_Decode +( + NSSArena *arenaOpt, + NSSPKIXpolicyMapping *policyMapping1, + ... +); + +/* + * nssPKIXPolicyMappings_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyMappings_Destroy +( + NSSPKIXPolicyMappings *policyMappings +); + +/* + * nssPKIXPolicyMappings_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_DATA + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXPolicyMappings_Encode +( + NSSPKIXPolicyMappings *policyMappings, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXPolicyMappings_GetPolicyMappingCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXPolicyMappings_GetPolicyMappingCount +( + NSSPKIXPolicyMappings *policyMappings +); + +/* + * nssPKIXPolicyMappings_GetPolicyMappings + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXpolicyMapping pointers upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXpolicyMapping ** +nssPKIXPolicyMappings_GetPolicyMappings +( + NSSPKIXPolicyMappings *policyMappings + NSSPKIXpolicyMapping *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXPolicyMappings_SetPolicyMappings + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyMappings_SetPolicyMappings +( + NSSPKIXPolicyMappings *policyMappings + NSSPKIXpolicyMapping *policyMapping[] + PRInt32 count +); + +/* + * nssPKIXPolicyMappings_GetPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXpolicyMapping upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXpolicyMapping * +nssPKIXPolicyMappings_GetPolicyMapping +( + NSSPKIXPolicyMappings *policyMappings + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXPolicyMappings_SetPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyMappings_SetPolicyMapping +( + NSSPKIXPolicyMappings *policyMappings + PRInt32 i, + NSSPKIXpolicyMapping *policyMapping +); + +/* + * nssPKIXPolicyMappings_InsertPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyMappings_InsertPolicyMapping +( + NSSPKIXPolicyMappings *policyMappings + PRInt32 i, + NSSPKIXpolicyMapping *policyMapping +); + +/* + * nssPKIXPolicyMappings_AppendPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyMappings_AppendPolicyMapping +( + NSSPKIXPolicyMappings *policyMappings + NSSPKIXpolicyMapping *policyMapping +); + +/* + * nssPKIXPolicyMappings_RemovePolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyMappings_RemovePolicyMapping +( + NSSPKIXPolicyMappings *policyMappings + PRInt32 i +); + +/* + * nssPKIXPolicyMappings_FindPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXPolicyMappings_FindPolicyMapping +( + NSSPKIXPolicyMappings *policyMappings + NSSPKIXpolicyMapping *policyMapping +); + +/* + * nssPKIXPolicyMappings_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXPolicyMappings_Equal +( + NSSPKIXPolicyMappings *policyMappings1, + NSSPKIXpolicyMappings *policyMappings2, + PRStatus *statusOpt +); + +/* + * nssPKIXPolicyMappings_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXPolicyMappings upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyMappings * +nssPKIXPolicyMappings_Duplicate +( + NSSPKIXPolicyMappings *policyMappings, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXPolicyMappings_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXPolicyMappings + * 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_PKIX_POLICY_MAPPINGS + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyMappings_verifyPointer +( + NSSPKIXPolicyMappings *p +); +#endif /* DEBUG */ + +/* + * nssPKIXPolicyMappings_IssuerDomainPolicyExists + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * + * Return value: + * PR_TRUE if the specified domain policy OID exists + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXPolicyMappings_IssuerDomainPolicyExists +( + NSSPKIXPolicyMappings *policyMappings, + NSSPKIXCertPolicyId *issuerDomainPolicy, + PRStatus *statusOpt +); + +/* + * nssPKIXPolicyMappings_SubjectDomainPolicyExists + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * + * Return value: + * PR_TRUE if the specified domain policy OID exists + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXPolicyMappings_SubjectDomainPolicyExists +( + NSSPKIXPolicyMappings *policyMappings, + NSSPKIXCertPolicyId *subjectDomainPolicy, + PRStatus *statusOpt +); + +/* + * nssPKIXPolicyMappings_FindIssuerDomainPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXPolicyMappings_FindIssuerDomainPolicy +( + NSSPKIXPolicyMappings *policyMappings, + NSSPKIXCertPolicyId *issuerDomainPolicy +); + +/* + * nssPKIXPolicyMappings_FindSubjectDomainPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXPolicyMappings_FindSubjectDomainPolicy +( + NSSPKIXPolicyMappings *policyMappings, + NSSPKIXCertPolicyId *issuerDomainPolicy +); + +/* + * nssPKIXPolicyMappings_MapIssuerToSubject + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_NOT_FOUND + * + * Return value: + * A valid pointer to an NSSPKIXCertPolicyId upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertPolicyId * +nssPKIXPolicyMappings_MapIssuerToSubject +( + NSSPKIXPolicyMappings *policyMappings, + NSSPKIXCertPolicyId *issuerDomainPolicy +); + +/* + * nssPKIXPolicyMappings_MapSubjectToIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPINGS + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_NOT_FOUND + * + * Return value: + * A valid pointer to an NSSPKIXCertPolicyId upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCertPolicyId * +nssPKIXPolicyMappings_MapSubjectToIssuer +( + NSSPKIXPolicyMappings *policyMappings, + NSSPKIXCertPolicyId *issuerDomainPolicy +); + +/* + * policyMapping + * + * Helper structure for PolicyMappings + * + * SEQUENCE { + * issuerDomainPolicy CertPolicyId, + * subjectDomainPolicy CertPolicyId } + * + * The private calls for this type: + * + * nssPKIXpolicyMapping_Decode + * nssPKIXpolicyMapping_Create + * nssPKIXpolicyMapping_Destroy + * nssPKIXpolicyMapping_Encode + * nssPKIXpolicyMapping_GetIssuerDomainPolicy + * nssPKIXpolicyMapping_SetIssuerDomainPolicy + * nssPKIXpolicyMapping_GetSubjectDomainPolicy + * nssPKIXpolicyMapping_SetSubjectDomainPolicy + * nssPKIXpolicyMapping_Equal + * nssPKIXpolicyMapping_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXpolicyMapping_verifyPointer + * + */ + +/* + * nssPKIXpolicyMapping_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXpolicyMapping upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXpolicyMapping * +nssPKIXpolicyMapping_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXpolicyMapping_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * + * Return value: + * A valid pointer to an NSSPKIXpolicyMapping upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXpolicyMapping * +nssPKIXpolicyMapping_Create +( + NSSArena *arenaOpt, + NSSPKIXCertPolicyId *issuerDomainPolicy, + NSSPKIXCertPolicyId *subjectDomainPolicy +); + +/* + * nssPKIXpolicyMapping_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXpolicyMapping_Destroy +( + NSSPKIXpolicyMapping *policyMapping +); + +/* + * nssPKIXpolicyMapping_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_DATA + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXpolicyMapping_Encode +( + NSSPKIXpolicyMapping *policyMapping, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXpolicyMapping_GetIssuerDomainPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXCertPolicyId OID upon success + * NULL upon faliure + */ + +NSS_EXTERN NSSPKIXCertPolicyId * +nssPKIXpolicyMapping_GetIssuerDomainPolicy +( + NSSPKIXpolicyMapping *policyMapping +); + +/* + * nssPKIXpolicyMapping_SetIssuerDomainPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXpolicyMapping_SetIssuerDomainPolicy +( + NSSPKIXpolicyMapping *policyMapping, + NSSPKIXCertPolicyId *issuerDomainPolicy +); + +/* + * nssPKIXpolicyMapping_GetSubjectDomainPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXCertPolicyId OID upon success + * NULL upon faliure + */ + +NSS_EXTERN NSSPKIXCertPolicyId * +nssPKIXpolicyMapping_GetSubjectDomainPolicy +( + NSSPKIXpolicyMapping *policyMapping +); + +/* + * nssPKIXpolicyMapping_SetSubjectDomainPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_INVALID_PKIX_CERT_POLICY_ID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXpolicyMapping_SetSubjectDomainPolicy +( + NSSPKIXpolicyMapping *policyMapping, + NSSPKIXCertPolicyId *subjectDomainPolicy +); + +/* + * nssPKIXpolicyMapping_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXpolicyMapping_Equal +( + NSSPKIXpolicyMapping *policyMapping1, + NSSPKIXpolicyMapping *policyMapping2, + PRStatus *statusOpt +); + +/* + * nssPKIXpolicyMapping_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_MAPPING + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXpolicyMapping upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXpolicyMapping * +nssPKIXpolicyMapping_Duplicate +( + NSSPKIXpolicyMapping *policyMapping, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXpolicyMapping_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXpolicyMapping + * 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_PKIX_POLICY_MAPPING + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXpolicyMapping_verifyPointer +( + NSSPKIXpolicyMapping *p +); +#endif /* DEBUG */ + +/* + * GeneralName + * + * This structure contains a union of the possible general names, + * of which there are several. + * + * From RFC 2459: + * + * GeneralName ::= CHOICE { + * otherName [0] AnotherName, + * rfc822Name [1] IA5String, + * dNSName [2] IA5String, + * x400Address [3] ORAddress, + * directoryName [4] Name, + * ediPartyName [5] EDIPartyName, + * uniformResourceIdentifier [6] IA5String, + * iPAddress [7] OCTET STRING, + * registeredID [8] OBJECT IDENTIFIER } + * + * The private calls for this type: + * + * nssPKIXGeneralName_Decode + * nssPKIXGeneralName_CreateFromUTF8 + * nssPKIXGeneralName_Create + * nssPKIXGeneralName_CreateFromOtherName + * nssPKIXGeneralName_CreateFromRfc822Name + * nssPKIXGeneralName_CreateFromDNSName + * nssPKIXGeneralName_CreateFromX400Address + * nssPKIXGeneralName_CreateFromDirectoryName + * nssPKIXGeneralName_CreateFromEDIPartyName + * nssPKIXGeneralName_CreateFromUniformResourceIdentifier + * nssPKIXGeneralName_CreateFromIPAddress + * nssPKIXGeneralName_CreateFromRegisteredID + * nssPKIXGeneralName_Destroy + * nssPKIXGeneralName_Encode + * nssPKIXGeneralName_GetUTF8Encoding + * nssPKIXGeneralName_GetChoice + * nssPKIXGeneralName_GetOtherName + * nssPKIXGeneralName_GetRfc822Name + * nssPKIXGeneralName_GetDNSName + * nssPKIXGeneralName_GetX400Address + * nssPKIXGeneralName_GetDirectoryName + * nssPKIXGeneralName_GetEDIPartyName + * nssPKIXGeneralName_GetUniformResourceIdentifier + * nssPKIXGeneralName_GetIPAddress + * nssPKIXGeneralName_GetRegisteredID + * nssPKIXGeneralName_GetSpecifiedChoice + * nssPKIXGeneralName_Equal + * nssPKIXGeneralName_Duplicate + * (in pki1 I had specific attribute value gettors here too) + * + * In debug builds, the following call is available: + * + * nssPKIXGeneralName_verifyPointer + * + */ + +/* + * nssPKIXGeneralName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXGeneralName_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +); + +/* + * nssPKIXGeneralName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME_CHOICE + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_INVALID_PKIX_IA5_STRING + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_INVALID_OID + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralName_Create +( + NSSArena *arenaOpt, + NSSPKIXGeneralNameChoice choice, + void *content +); + +/* + * nssPKIXGeneralName_CreateFromOtherName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralName_CreateFromOtherName +( + NSSArena *arenaOpt, + NSSPKIXAnotherName *otherName +); + +/* + * nssPKIXGeneralName_CreateFromRfc822Name + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_IA5_STRING + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralName_CreateFromRfc822Name +( + NSSArena *arenaOpt, + NSSUTF8 *rfc822Name +); + +/* + * nssPKIXGeneralName_CreateFromDNSName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_IA5_STRING + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralName_CreateFromDNSName +( + NSSArena *arenaOpt, + NSSUTF8 *dNSName +); + +/* + * nssPKIXGeneralName_CreateFromX400Address + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_OR_ADDRESS + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralName_CreateFromX400Address +( + NSSArena *arenaOpt, + NSSPKIXORAddress *x400Address +); + +/* + * nssPKIXGeneralName_CreateFromDirectoryName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralName_CreateFromDirectoryName +( + NSSArena *arenaOpt, + NSSPKIXName *directoryName +); + +/* + * nssPKIXGeneralName_CreateFromEDIPartyName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralName_CreateFromEDIPartyName +( + NSSArena *arenaOpt, + NSSPKIXEDIPartyName *ediPartyname +); + +/* + * nssPKIXGeneralName_CreateFromUniformResourceIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_IA5_STRING + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralName_CreateFromUniformResourceIdentifier +( + NSSArena *arenaOpt, + NSSUTF8 *uniformResourceIdentifier +); + +/* + * nssPKIXGeneralName_CreateFromIPAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralName_CreateFromIPAddress +( + NSSArena *arenaOpt, + NSSItem *iPAddress +); + +/* + * nssPKIXGeneralName_CreateFromRegisteredID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralName_CreateFromRegisteredID +( + NSSArena *arenaOpt, + NSSOID *registeredID +); + +/* + * nssPKIXGeneralName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralName_Destroy +( + NSSPKIXGeneralName *generalName +); + +/* + * nssPKIXGeneralName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXGeneralName_Encode +( + NSSPKIXGeneralName *generalName, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralName_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXGeneralName_GetUTF8Encoding +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralName_GetChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * + * Return value: + * A valid NSSPKIXGeneralNameChoice value upon success + * NSSPKIXGeneralNameChoice_NSSinvalid upon failure + */ + +NSS_EXTERN NSSPKIXGeneralNameChoice +nssPKIXGeneralName_GetChoice +( + NSSPKIXGeneralName *generalName +); + +/* + * nssPKIXGeneralName_GetOtherName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAnotherName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAnotherName * +nssPKIXGeneralName_GetOtherName +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralName_GetRfc822Name + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXGeneralName_GetRfc822Name +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralName_GetDNSName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXGeneralName_GetDNSName +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralName_GetX400Address + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXORAddress upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXORAddress * +nssPKIXGeneralName_GetX400Address +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralName_GetDirectoryName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXName * +nssPKIXGeneralName_GetDirectoryName +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralName_GetEDIPartyName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXEDIPartyName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXEDIPartyName * +nssPKIXGeneralName_GetEDIPartyName +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralName_GetUniformResourceIdentifier + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXGeneralName_GetUniformResourceIdentifier +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralName_GetIPAddress + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +nssPKIXGeneralName_GetIPAddress +( + NSSPKIXGeneralName *generalName, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralName_GetRegisteredID + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSOID upon success + * NULL upon failure + */ + +NSS_EXTERN NSSOID * +nssPKIXGeneralName_GetRegisteredID +( + NSSPKIXGeneralName *generalName +); + +/* + * nssPKIXGeneralName_GetSpecifiedChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer upon success + * NULL upon failure + */ + +NSS_EXTERN void * +nssPKIXGeneralName_GetSpecifiedChoice +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXGeneralName_Equal +( + NSSPKIXGeneralName *generalName1, + NSSPKIXGeneralName *generalName2, + PRStatus *statusOpt +); + +/* + * nssPKIXGeneralName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralName_Duplicate +( + NSSPKIXGeneralName *generalName, + NSSArena *arenaOpt +); + +/* + * (in pki1 I had specific attribute value gettors here too) + * + */ + +#ifdef DEBUG +/* + * nssPKIXGeneralName_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXGeneralName + * 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_PKIX_GENERAL_NAME + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralName_verifyPointer +( + NSSPKIXGeneralName *p +); +#endif /* DEBUG */ + +/* + * GeneralNames + * + * This structure contains a sequence of GeneralName objects. + * + * From RFC 2459: + * + * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName + * + * The private calls for this type: + * + * nssPKIXGeneralNames_Decode + * nssPKIXGeneralNames_Create + * nssPKIXGeneralNames_Destroy + * nssPKIXGeneralNames_Encode + * nssPKIXGeneralNames_GetGeneralNameCount + * nssPKIXGeneralNames_GetGeneralNames + * nssPKIXGeneralNames_SetGeneralNames + * nssPKIXGeneralNames_GetGeneralName + * nssPKIXGeneralNames_SetGeneralName + * nssPKIXGeneralNames_InsertGeneralName + * nssPKIXGeneralNames_AppendGeneralName + * nssPKIXGeneralNames_RemoveGeneralName + * nssPKIXGeneralNames_FindGeneralName + * nssPKIXGeneralNames_Equal + * nssPKIXGeneralNames_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXGeneralNames_verifyPointer + * + */ + +/* + * nssPKIXGeneralNames_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralNames * +nssPKIXGeneralNames_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXGeneralNames_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * + * Return value: + * A valid pointer to an NSSPKIXGeneralNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralNames * +nssPKIXGeneralNames_Create +( + NSSArena *arenaOpt, + NSSPKIXGeneralName *generalName1, + ... +); + +/* + * nssPKIXGeneralNames_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralNames_Destroy +( + NSSPKIXGeneralNames *generalNames +); + +/* + * nssPKIXGeneralNames_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXGeneralNames_Encode +( + NSSPKIXGeneralNames *generalNames, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralNames_GetGeneralNameCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXGeneralNames_GetGeneralNameCount +( + NSSPKIXGeneralNames *generalNames +); + +/* + * nssPKIXGeneralNames_GetGeneralNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXGeneralName pointers upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName ** +nssPKIXGeneralNames_GetGeneralNames +( + NSSPKIXGeneralNames *generalNames, + NSSPKIXGeneralName *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralNames_SetGeneralNames + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralNames_SetGeneralNames +( + NSSPKIXGeneralNames *generalNames, + NSSPKIXGeneralName *generalName[], + PRInt32 count +); + +/* + * nssPKIXGeneralNames_GetGeneralName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralNames_GetGeneralName +( + NSSPKIXGeneralNames *generalNames, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralNames_SetGeneralName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralNames_SetGeneralName +( + NSSPKIXGeneralNames *generalNames, + PRInt32 i, + NSSPKIXGeneralName *generalName +); + +/* + * nssPKIXGeneralNames_InsertGeneralName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralNames_InsertGeneralName +( + NSSPKIXGeneralNames *generalNames, + PRInt32 i, + NSSPKIXGeneralName *generalName +); + +/* + * nssPKIXGeneralNames_AppendGeneralName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralNames_AppendGeneralName +( + NSSPKIXGeneralNames *generalNames, + NSSPKIXGeneralName *generalName +); + +/* + * nssPKIXGeneralNames_RemoveGeneralName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralNames_RemoveGeneralName +( + NSSPKIXGeneralNames *generalNames, + PRInt32 i +); + +/* + * nssPKIXGeneralNames_FindGeneralName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXGeneralNames_FindGeneralName +( + NSSPKIXGeneralNames *generalNames, + NSSPKIXGeneralName *generalName +); + +/* + * nssPKIXGeneralNames_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXGeneralNames_Equal +( + NSSPKIXGeneralNames *generalNames1, + NSSPKIXGeneralNames *generalNames2, + PRStatus *statusOpt +); + +/* + * nssPKIXGeneralNames_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralNames * +nssPKIXGeneralNames_Duplicate +( + NSSPKIXGeneralNames *generalNames, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXGeneralNames_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXGeneralNames + * 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_PKIX_GENERAL_NAMES + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralNames_verifyPointer +( + NSSPKIXGeneralNames *p +); +#endif /* DEBUG */ + +/* + * AnotherName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AnotherName ::= SEQUENCE { + * type-id OBJECT IDENTIFIER, + * value [0] EXPLICIT ANY DEFINED BY type-id } + * + * The private calls for this type: + * + * nssPKIXAnotherName_Decode + * nssPKIXAnotherName_Create + * nssPKIXAnotherName_Destroy + * nssPKIXAnotherName_Encode + * nssPKIXAnotherName_GetTypeId + * nssPKIXAnotherName_SetTypeId + * nssPKIXAnotherName_GetValue + * nssPKIXAnotherName_SetValue + * nssPKIXAnotherName_Equal + * nssPKIXAnotherName_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXAnotherName_verifyPointer + * + */ + +/* + * nssPKIXAnotherName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAnotherName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAnotherName * +nssPKIXAnotherName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXAnotherName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAnotherName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAnotherName * +nssPKIXAnotherName_Create +( + NSSArena *arenaOpt, + NSSOID *typeId, + NSSItem *value +); + +/* + * nssPKIXAnotherName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAnotherName_Destroy +( + NSSPKIXAnotherName *anotherName +); + +/* + * nssPKIXAnotherName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXAnotherName_Encode +( + NSSPKIXAnotherName *anotherName, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXAnotherName_GetTypeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSOID upon success + * NULL upon failure + */ + +NSS_EXTERN NSSOID * +nssPKIXAnotherName_GetTypeId +( + NSSPKIXAnotherName *anotherName +); + +/* + * nssPKIXAnotherName_SetTypeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_INVALID_OID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAnotherName_SetTypeId +( + NSSPKIXAnotherName *anotherName, + NSSOID *typeId +); + +/* + * nssPKIXAnotherName_GetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_EXTERN NSSItem * +nssPKIXAnotherName_GetValue +( + NSSPKIXAnotherName *anotherName, + NSSItem *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXAnotherName_SetValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAnotherName_SetValue +( + NSSPKIXAnotherName *anotherName, + NSSItem *value +); + +/* + * nssPKIXAnotherName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXAnotherName_Equal +( + NSSPKIXAnotherName *anotherName1, + NSSPKIXAnotherName *anotherName2, + PRStatus *statusOpt +); + +/* + * nssPKIXAnotherName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ANOTHER_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAnotherName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAnotherName * +nssPKIXAnotherName_Duplicate +( + NSSPKIXAnotherName *anotherName, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXAnotherName_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXAnotherName + * 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_PKIX_ANOTHER_NAME + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXAnotherName_verifyPointer +( + NSSPKIXAnotherName *p +); +#endif /* DEBUG */ + +/* + * EDIPartyName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * + * EDIPartyName ::= SEQUENCE { + * nameAssigner [0] DirectoryString OPTIONAL, + * partyName [1] DirectoryString } + * + * The private calls for this type: + * + * nssPKIXEDIPartyName_Decode + * nssPKIXEDIPartyName_Create + * nssPKIXEDIPartyName_Destroy + * nssPKIXEDIPartyName_Encode + * nssPKIXEDIPartyName_HasNameAssigner + * nssPKIXEDIPartyName_GetNameAssigner + * nssPKIXEDIPartyName_SetNameAssigner + * nssPKIXEDIPartyName_RemoveNameAssigner + * nssPKIXEDIPartyName_GetPartyName + * nssPKIXEDIPartyName_SetPartyName + * nssPKIXEDIPartyName_Equal + * nssPKIXEDIPartyName_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXEDIPartyName_verifyPointer + * + */ + +/* + * nssPKIXEDIPartyName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXEDIPartyName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXEDIPartyName * +nssPKIXEDIPartyName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXEDIPartyName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * + * Return value: + * A valid pointer to an NSSPKIXEDIPartyName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXEDIPartyName * +nssPKIXEDIPartyName_Create +( + NSSArena *arenaOpt, + NSSUTF8 *nameAssignerOpt, + NSSUTF8 *partyName +); + +/* + * nssPKIXEDIPartyName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXEDIPartyName_Destroy +( + NSSPKIXEDIPartyName *ediPartyName +); + +/* + * nssPKIXEDIPartyName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXEDIPartyName_Encode +( + NSSPKIXEDIPartyName *ediPartyName, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXEDIPartyName_HasNameAssigner + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXEDIPartyName_HasNameAssigner +( + NSSPKIXEDIPartyName *ediPartyName +); + +/* + * nssPKIXEDIPartyName_GetNameAssigner + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_HAS_NO_NAME_ASSIGNER + * + * Return value: + * A valid pointer to an NSSUTF8 string upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXEDIPartyName_GetNameAssigner +( + NSSPKIXEDIPartyName *ediPartyName, + NSSArena *arenaOpt +); + +/* + * nssPKIXEDIPartyName_SetNameAssigner + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXEDIPartyName_SetNameAssigner +( + NSSPKIXEDIPartyName *ediPartyName, + NSSUTF8 *nameAssigner +); + +/* + * nssPKIXEDIPartyName_RemoveNameAssigner + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_HAS_NO_NAME_ASSIGNER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXEDIPartyName_RemoveNameAssigner +( + NSSPKIXEDIPartyName *ediPartyName +); + +/* + * nssPKIXEDIPartyName_GetPartyName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSUTF8 string upon success + * NULL upon failure + */ + +NSS_EXTERN NSSUTF8 * +nssPKIXEDIPartyName_GetPartyName +( + NSSPKIXEDIPartyName *ediPartyName, + NSSArena *arenaOpt +); + +/* + * nssPKIXEDIPartyName_SetPartyName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_STRING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXEDIPartyName_SetPartyName +( + NSSPKIXEDIPartyName *ediPartyName, + NSSUTF8 *partyName +); + +/* + * nssPKIXEDIPartyName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXEDIPartyName_Equal +( + NSSPKIXEDIPartyName *ediPartyName1, + NSSPKIXEDIPartyName *ediPartyName2, + PRStatus *statusOpt +); + +/* + * nssPKIXEDIPartyName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EDI_PARTY_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXEDIPartyName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXEDIPartyName * +nssPKIXEDIPartyName_Duplicate +( + NSSPKIXEDIPartyName *ediPartyName, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXEDIPartyName_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXEDIPartyName + * 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_PKIX_EDI_PARTY_NAME + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXEDIPartyName_verifyPointer +( + NSSPKIXEDIPartyName *p +); +#endif /* DEBUG */ + +/* + * SubjectDirectoryAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * SubjectDirectoryAttributes ::= SEQUENCE SIZE (1..MAX) OF Attribute + * + * The private calls for this type: + * + * nssPKIXSubjectDirectoryAttributes_Decode + * nssPKIXSubjectDirectoryAttributes_Create + * nssPKIXSubjectDirectoryAttributes_Destroy + * nssPKIXSubjectDirectoryAttributes_Encode + * nssPKIXSubjectDirectoryAttributes_GetAttributeCount + * nssPKIXSubjectDirectoryAttributes_GetAttributes + * nssPKIXSubjectDirectoryAttributes_SetAttributes + * nssPKIXSubjectDirectoryAttributes_GetAttribute + * nssPKIXSubjectDirectoryAttributes_SetAttribute + * nssPKIXSubjectDirectoryAttributes_InsertAttribute + * nssPKIXSubjectDirectoryAttributes_AppendAttribute + * nssPKIXSubjectDirectoryAttributes_RemoveAttribute + * nssPKIXSubjectDirectoryAttributes_FindAttribute + * nssPKIXSubjectDirectoryAttributes_Equal + * nssPKIXSubjectDirectoryAttributes_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXSubjectDirectoryAttributes_verifyPointer + * + */ + +/* + * nssPKIXSubjectDirectoryAttributes_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXSubjectDirectoryAttributes upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectDirectoryAttributes * +nssPKIXSubjectDirectoryAttributes_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXSubjectDirectoryAttributes_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXSubjectDirectoryAttributes upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectDirectoryAttributes * +nssPKIXSubjectDirectoryAttributes_Create +( + NSSArena *arenaOpt, + NSSPKIXAttribute *attribute1, + ... +); + +/* + * nssPKIXSubjectDirectoryAttributes_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXSubjectDirectoryAttributes_Destroy +( + NSSPKIXSubjectDirectoryAttributes *sda +); + +/* + * nssPKIXSubjectDirectoryAttributes_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXSubjectDirectoryAttributes_Encode +( + NSSPKIXSubjectDirectoryAttributes *sda, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXSubjectDirectoryAttributes_GetAttributeCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXSubjectDirectoryAttributes_GetAttributeCount +( + NSSPKIXSubjectDirectoryAttributes *sda +); + +/* + * nssPKIXSubjectDirectoryAttributes_GetAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXAttribute pointers upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttribute ** +nssPKIXSubjectDirectoryAttributes_GetAttributes +( + NSSPKIXSubjectDirectoryAttributes *sda, + NSSPKIXAttribute *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXSubjectDirectoryAttributes_SetAttributes + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXSubjectDirectoryAttributes_SetAttributes +( + NSSPKIXSubjectDirectoryAttributes *sda, + NSSAttribute *attributes[], + PRInt32 count +); + +/* + * nssPKIXSubjectDirectoryAttributes_GetAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon error + */ + +NSS_EXTERN NSSPKIXAttribute * +nssPKIXSubjectDirectoryAttributes_GetAttribute +( + NSSPKIXSubjectDirectoryAttributes *sda, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXSubjectDirectoryAttributes_SetAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXSubjectDirectoryAttributes_SetAttribute +( + NSSPKIXSubjectDirectoryAttributes *sda, + PRInt32 i, + NSSPKIXAttribute *attribute +); + +/* + * nssPKIXSubjectDirectoryAttributes_InsertAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXSubjectDirectoryAttributes_InsertAttribute +( + NSSPKIXSubjectDirectoryAttributes *sda, + PRInt32 i, + NSSPKIXAttribute *attribute +); + +/* + * nssPKIXSubjectDirectoryAttributes_AppendAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXSubjectDirectoryAttributes_AppendAttribute +( + NSSPKIXSubjectDirectoryAttributes *sda, + NSSPKIXAttribute *attribute +); + +/* + * nssPKIXSubjectDirectoryAttributes_RemoveAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXSubjectDirectoryAttributes_RemoveAttribute +( + NSSPKIXSubjectDirectoryAttributes *sda, + PRInt32 i +); + +/* + * nssPKIXSubjectDirectoryAttributes_FindAttribute + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_ATTRIBUTE + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXSubjectDirectoryAttributes_FindAttribute +( + NSSPKIXSubjectDirectoryAttributes *sda, + NSSPKIXAttribute *attribute +); + +/* + * nssPKIXSubjectDirectoryAttributes_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXSubjectDirectoryAttributes_Equal +( + NSSPKIXSubjectDirectoryAttributes *sda1, + NSSPKIXSubjectDirectoryAttributes *sda2, + PRStatus *statusOpt +); + +/* + * nssPKIXSubjectDirectoryAttributes_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXSubjectDirectoryAttributes upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXSubjectDirectoryAttributes * +nssPKIXSubjectDirectoryAttributes_Duplicate +( + NSSPKIXSubjectDirectoryAttributes *sda, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXSubjectDirectoryAttributes_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXSubjectDirectoryAttributes + * 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_PKIX_SUBJECT_DIRECTORY_ATTRIBUTES + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXSubjectDirectoryAttributes_verifyPointer +( + NSSPKIXSubjectDirectoryAttributes *p +); +#endif /* DEBUG */ + +/* + * BasicConstraints + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BasicConstraints ::= SEQUENCE { + * cA BOOLEAN DEFAULT FALSE, + * pathLenConstraint INTEGER (0..MAX) OPTIONAL } + * + * The private calls for this type: + * + * nssPKIXBasicConstraints_Decode + * nssPKIXBasicConstraints_Create + * nssPKIXBasicConstraints_Destroy + * nssPKIXBasicConstraints_Encode + * nssPKIXBasicConstraints_GetCA + * nssPKIXBasicConstraints_SetCA + * nssPKIXBasicConstraints_HasPathLenConstraint + * nssPKIXBasicConstraints_GetPathLenConstraint + * nssPKIXBasicConstraints_SetPathLenConstraint + * nssPKIXBasicConstraints_RemovePathLenConstraint + * nssPKIXBasicConstraints_Equal + * nssPKIXBasicConstraints_Duplicate + * nssPKIXBasicConstraints_CompareToPathLenConstraint + * + * In debug builds, the following call is available: + * + * nssPKIXBasicConstraints_verifyPointer + * + */ + +/* + * nssPKIXBasicConstraints_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXBasicConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBasicConstraints * +nssPKIXBasicConstraints_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXBasicConstraints_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * A valid pointer to an NSSPKIXBasicConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBasicConstraints * +nssPKIXBasicConstraints_Create +( + NSSArena *arenaOpt, + PRBool ca, + PRInt32 pathLenConstraint +); + +/* + * nssPKIXBasicConstraints_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBasicConstraints_Destroy +( + NSSPKIXBasicConstraints *basicConstraints +); + +/* + * nssPKIXBasicConstraints_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXBasicConstraints_Encode +( + NSSPKIXBasicConstraints *basicConstraints, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXBasicConstraints_GetCA + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * + * Return value: + * PR_TRUE if the CA bit is true + * PR_FALSE if it isn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXBasicConstraints_GetCA +( + NSSPKIXBasicConstraints *basicConstraints, + PRStatus *statusOpt +); + +/* + * nssPKIXBasicConstraints_SetCA + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBasicConstraints_SetCA +( + NSSPKIXBasicConstraints *basicConstraints, + PRBool ca +); + +/* + * nssPKIXBasicConstraints_HasPathLenConstraint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXBasicConstraints_HasPathLenConstraint +( + NSSPKIXBasicConstraints *basicConstraints, + PRStatus *statusOpt +); + +/* + * nssPKIXBasicConstraints_GetPathLenConstraint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * NSS_ERROR_HAS_NO_PATH_LEN_CONSTRAINT + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXBasicConstraints_GetPathLenConstraint +( + NSSPKIXBasicConstraints *basicConstraints +); + +/* + * nssPKIXBasicConstraints_SetPathLenConstraint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBasicConstraints_SetPathLenConstraint +( + NSSPKIXBasicConstraints *basicConstraints, + PRInt32 pathLenConstraint +); + +/* + * nssPKIXBasicConstraints_RemovePathLenConstraint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * NSS_ERROR_HAS_NO_PATH_LEN_CONSTRAINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXBasicConstraints_RemovePathLenConstraint +( + NSSPKIXBasicConstraints *basicConstraints +); + +/* + * nssPKIXBasicConstraints_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXBasicConstraints_Equal +( + NSSPKIXBasicConstraints *basicConstraints1, + NSSPKIXBasicConstraints *basicConstraints2, + PRStatus *statusOpt +); + +/* + * nssPKIXBasicConstraints_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXBasicConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXBasicConstraints * +nssPKIXBasicConstraints_Duplicate +( + NSSPKIXBasicConstraints *basicConstraints, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXBasicConstraints_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXBasicConstraints + * 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_PKIX_BASIC_CONSTRAINTS + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXBasicConstraints_verifyPointer +( + NSSPKIXBasicConstraints *p +); +#endif /* DEBUG */ + +/* + * nssPKIXBasicConstraints_CompareToPathLenConstraint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_BASIC_CONSTRAINTS + * NSS_ERROR_HAS_NO_PATH_LEN_CONSTRAINT + * + * Return value: + * 1 if the specified value is greater than the pathLenConstraint + * 0 if the specified value equals the pathLenConstraint + * -1 if the specified value is less than the pathLenConstraint + * -2 upon error + */ + +NSS_EXTERN PRInt32 +nssPKIXBasicConstraints_CompareToPathLenConstraint +( + NSSPKIXBasicConstraints *basicConstraints, + PRInt32 value +); + +/* + * NameConstraints + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NameConstraints ::= SEQUENCE { + * permittedSubtrees [0] GeneralSubtrees OPTIONAL, + * excludedSubtrees [1] GeneralSubtrees OPTIONAL } + * + * The private calls for this type: + * + * nssPKIXNameConstraints_Decode + * nssPKIXNameConstraints_Create + * nssPKIXNameConstraints_Destroy + * nssPKIXNameConstraints_Encode + * nssPKIXNameConstraints_HasPermittedSubtrees + * nssPKIXNameConstraints_GetPermittedSubtrees + * nssPKIXNameConstraints_SetPermittedSubtrees + * nssPKIXNameConstraints_RemovePermittedSubtrees + * nssPKIXNameConstraints_HasExcludedSubtrees + * nssPKIXNameConstraints_GetExcludedSubtrees + * nssPKIXNameConstraints_SetExcludedSubtrees + * nssPKIXNameConstraints_RemoveExcludedSubtrees + * nssPKIXNameConstraints_Equal + * nssPKIXNameConstraints_Duplicate + * { and the comparator functions } + * + * In debug builds, the following call is available: + * + * nssPKIXNameConstraints_verifyPointer + * + */ + +/* + * nssPKIXNameConstraints_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXNameConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNameConstraints * +nssPKIXNameConstraints_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXNameConstraints_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * + * Return value: + * A valid pointer to an NSSPKIXNameConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNameConstraints * +nssPKIXNameConstraints_Create +( + NSSArena *arenaOpt, + NSSPKIXGeneralSubtrees *permittedSubtrees, + NSSPKIXGeneralSubtrees *excludedSubtrees +); + +/* + * nssPKIXNameConstraints_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXNameConstraints_Destroy +( + NSSPKIXNameConstraints *nameConstraints +); + +/* + * nssPKIXNameConstraints_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXNameConstraints_Encode +( + NSSPKIXNameConstraints *nameConstraints, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXNameConstraints_HasPermittedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXNameConstraints_HasPermittedSubtrees +( + NSSPKIXNameConstraints *nameConstraints, + PRStatus *statusOpt +); + +/* + * nssPKIXNameConstraints_GetPermittedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_HAS_NO_PERMITTED_SUBTREES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtrees upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtrees * +nssPKIXNameConstraints_GetPermittedSubtrees +( + NSSPKIXNameConstraints *nameConstraints, + NSSArena *arenaOpt +); + +/* + * nssPKIXNameConstraints_SetPermittedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXNameConstraints_SetPermittedSubtrees +( + NSSPKIXNameConstraints *nameConstraints, + NSSPKIXGeneralSubtrees *permittedSubtrees +); + +/* + * nssPKIXNameConstraints_RemovePermittedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_HAS_NO_PERMITTED_SUBTREES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXNameConstraints_RemovePermittedSubtrees +( + NSSPKIXNameConstraints *nameConstraints +); + +/* + * nssPKIXNameConstraints_HasExcludedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXNameConstraints_HasExcludedSubtrees +( + NSSPKIXNameConstraints *nameConstraints, + PRStatus *statusOpt +); + +/* + * nssPKIXNameConstraints_GetExcludedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_HAS_NO_EXCLUDED_SUBTREES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtrees upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtrees * +nssPKIXNameConstraints_GetExcludedSubtrees +( + NSSPKIXNameConstraints *nameConstraints, + NSSArena *arenaOpt +); + +/* + * nssPKIXNameConstraints_SetExcludedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXNameConstraints_SetExcludedSubtrees +( + NSSPKIXNameConstraints *nameConstraints, + NSSPKIXGeneralSubtrees *excludedSubtrees +); + +/* + * nssPKIXNameConstraints_RemoveExcludedSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_HAS_NO_EXCLUDED_SUBTREES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXNameConstraints_RemoveExcludedSubtrees +( + NSSPKIXNameConstraints *nameConstraints +); + +/* + * nssPKIXNameConstraints_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXNameConstraints_Equal +( + NSSPKIXNameConstraints *nameConstraints1, + NSSPKIXNameConstraints *nameConstraints2, + PRStatus *statusOpt +); + +/* + * nssPKIXNameConstraints_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME_CONSTRAINTS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXNameConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXNameConstraints * +nssPKIXNameConstraints_Duplicate +( + NSSPKIXNameConstraints *nameConstraints, + NSSArena *arenaOpt +); + +/* + * { and the comparator functions } + * + */ + +#ifdef DEBUG +/* + * nssPKIXNameConstraints_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXNameConstraints + * 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_PKIX_NAME_CONSTRAINTS + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXNameConstraints_verifyPointer +( + NSSPKIXNameConstraints *p +); +#endif /* DEBUG */ + +/* + * GeneralSubtrees + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree + * + * The private calls for this type: + * + * nssPKIXGeneralSubtrees_Decode + * nssPKIXGeneralSubtrees_Create + * nssPKIXGeneralSubtrees_Destroy + * nssPKIXGeneralSubtrees_Encode + * nssPKIXGeneralSubtrees_GetGeneralSubtreeCount + * nssPKIXGeneralSubtrees_GetGeneralSubtrees + * nssPKIXGeneralSubtrees_SetGeneralSubtrees + * nssPKIXGeneralSubtrees_GetGeneralSubtree + * nssPKIXGeneralSubtrees_SetGeneralSubtree + * nssPKIXGeneralSubtrees_InsertGeneralSubtree + * nssPKIXGeneralSubtrees_AppendGeneralSubtree + * nssPKIXGeneralSubtrees_RemoveGeneralSubtree + * nssPKIXGeneralSubtrees_FindGeneralSubtree + * nssPKIXGeneralSubtrees_Equal + * nssPKIXGeneralSubtrees_Duplicate + * { and finders and comparators } + * + * In debug builds, the following call is available: + * + * nssPKIXGeneralSubtrees_verifyPointer + * + */ + +/* + * nssPKIXGeneralSubtrees_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtrees upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtrees * +nssPKIXGeneralSubtrees_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXGeneralSubtrees_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtrees upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtrees * +nssPKIXGeneralSubtrees_Create +( + NSSArena *arenaOpt, + NSSPKIXGeneralSubtree *generalSubtree1, + ... +); + +/* + * nssPKIXGeneralSubtrees_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralSubtrees_Destroy +( + NSSPKIXGeneralSubtrees *generalSubtrees +); + +/* + * nssPKIXGeneralSubtrees_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXGeneralSubtrees_Encode +( + NSSPKIXGeneralSubtrees *generalSubtrees, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralSubtrees_GetGeneralSubtreeCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXGeneralSubtrees_GetGeneralSubtreeCount +( + NSSPKIXGeneralSubtrees *generalSubtrees +); + +/* + * nssPKIXGeneralSubtrees_GetGeneralSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXGeneralSubtree pointers upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtree ** +nssPKIXGeneralSubtrees_GetGeneralSubtrees +( + NSSPKIXGeneralSubtrees *generalSubtrees, + NSSPKIXGeneralSubtree *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralSubtrees_SetGeneralSubtrees + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralSubtrees_SetGeneralSubtrees +( + NSSPKIXGeneralSubtrees *generalSubtrees, + NSSPKIXGeneralSubtree *generalSubtree[], + PRInt32 count +); + +/* + * nssPKIXGeneralSubtrees_GetGeneralSubtree + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtree upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtree * +nssPKIXGeneralSubtrees_GetGeneralSubtree +( + NSSPKIXGeneralSubtrees *generalSubtrees, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralSubtrees_SetGeneralSubtree + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralSubtrees_SetGeneralSubtree +( + NSSPKIXGeneralSubtrees *generalSubtrees, + PRInt32 i, + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * nssPKIXGeneralSubtrees_InsertGeneralSubtree + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralSubtrees_InsertGeneralSubtree +( + NSSPKIXGeneralSubtrees *generalSubtrees, + PRInt32 i, + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * nssPKIXGeneralSubtrees_AppendGeneralSubtree + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralSubtrees_AppendGeneralSubtree +( + NSSPKIXGeneralSubtrees *generalSubtrees, + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * nssPKIXGeneralSubtrees_RemoveGeneralSubtree + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralSubtrees_RemoveGeneralSubtree +( + NSSPKIXGeneralSubtrees *generalSubtrees, + PRInt32 i +); + +/* + * nssPKIXGeneralSubtrees_FindGeneralSubtree + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXGeneralSubtrees_FindGeneralSubtree +( + NSSPKIXGeneralSubtrees *generalSubtrees, + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * nssPKIXGeneralSubtrees_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXGeneralSubtrees_Equal +( + NSSPKIXGeneralSubtrees *generalSubtrees1, + NSSPKIXGeneralSubtrees *generalSubtrees2, + PRStatus *statusOpt +); + +/* + * nssPKIXGeneralSubtrees_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREES + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtrees upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtrees * +nssPKIXGeneralSubtrees_Duplicate +( + NSSPKIXGeneralSubtrees *generalSubtrees, + NSSArena *arenaOpt +); + +/* + * { and finders and comparators } + * + */ + +#ifdef DEBUG +/* + * nssPKIXGeneralSubtrees_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXGeneralSubtrees + * 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_PKIX_GENERAL_SUBTREES + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralSubtrees_verifyPointer +( + NSSPKIXGeneralSubtrees *p +); +#endif /* DEBUG */ + +/* + * GeneralSubtree + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * GeneralSubtree ::= SEQUENCE { + * base GeneralName, + * minimum [0] BaseDistance DEFAULT 0, + * maximum [1] BaseDistance OPTIONAL } + * + * The private calls for this type: + * + * nssPKIXGeneralSubtree_Decode + * nssPKIXGeneralSubtree_Create + * nssPKIXGeneralSubtree_Destroy + * nssPKIXGeneralSubtree_Encode + * nssPKIXGeneralSubtree_GetBase + * nssPKIXGeneralSubtree_SetBase + * nssPKIXGeneralSubtree_GetMinimum + * nssPKIXGeneralSubtree_SetMinimum + * nssPKIXGeneralSubtree_HasMaximum + * nssPKIXGeneralSubtree_GetMaximum + * nssPKIXGeneralSubtree_SetMaximum + * nssPKIXGeneralSubtree_RemoveMaximum + * nssPKIXGeneralSubtree_Equal + * nssPKIXGeneralSubtree_Duplicate + * nssPKIXGeneralSubtree_DistanceInRange + * {other tests and comparators} + * + * In debug builds, the following call is available: + * + * nssPKIXGeneralSubtree_verifyPointer + * + */ + +/* + * nssPKIXGeneralSubtree_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtree upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtree * +nssPKIXGeneralSubtree_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXGeneralSubtree_Create + * + * -- fgmr comments -- + * The optional maximum value may be omitted by specifying -1. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtree upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtree * +nssPKIXGeneralSubtree_Create +( + NSSArena *arenaOpt, + NSSPKIXBaseDistance minimum, + NSSPKIXBaseDistance maximumOpt +); + +/* + * nssPKIXGeneralSubtree_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralSubtree_Destroy +( + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * nssPKIXGeneralSubtree_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXGeneralSubtree_Encode +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralSubtree_GetBase + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXGeneralSubtree_GetBase +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSArena *arenaOpt +); + +/* + * nssPKIXGeneralSubtree_SetBase + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralSubtree_SetBase +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSPKIXGeneralName *base +); + +/* + * nssPKIXGeneralSubtree_GetMinimum + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN NSSPKIXBaseDistance +nssPKIXGeneralSubtree_GetMinimum +( + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * nssPKIXGeneralSubtree_SetMinimum + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralSubtree_SetMinimum +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSPKIXBaseDistance *minimum +); + +/* + * nssPKIXGeneralSubtree_HasMaximum + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXGeneralSubtree_HasMaximum +( + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * nssPKIXGeneralSubtree_GetMaximum + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_HAS_NO_MAXIMUM_BASE_DISTANCE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN NSSPKIXBaseDistance +nssPKIXGeneralSubtree_GetMaximum +( + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * nssPKIXGeneralSubtree_SetMaximum + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralSubtree_SetMaximum +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSPKIXBaseDistance *maximum +); + +/* + * nssPKIXGeneralSubtree_RemoveMaximum + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_HAS_NO_MAXIMUM_BASE_DISTANCE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralSubtree_RemoveMaximum +( + NSSPKIXGeneralSubtree *generalSubtree +); + +/* + * nssPKIXGeneralSubtree_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXGeneralSubtree_Equal +( + NSSPKIXGeneralSubtree *generalSubtree1, + NSSPKIXGeneralSubtree *generalSubtree2, + PRStatus *statusOpt +); + +/* + * nssPKIXGeneralSubtree_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXGeneralSubtree upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralSubtree * +nssPKIXGeneralSubtree_Duplicate +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXGeneralSubtree_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXGeneralSubtree + * 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_PKIX_GENERAL_SUBTREE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXGeneralSubtree_verifyPointer +( + NSSPKIXGeneralSubtree *p +); +#endif /* DEBUG */ + +/* + * nssPKIXGeneralSubtree_DistanceInRange + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_GENERAL_SUBTREE + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * PR_TRUE if the specified value is within the minimum and maximum + * base distances + * PR_FALSE if it isn't + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXGeneralSubtree_DistanceInRange +( + NSSPKIXGeneralSubtree *generalSubtree, + NSSPKIXBaseDistance value, + PRStatus *statusOpt +); + +/* + * {other tests and comparators} + * + */ + +/* + * PolicyConstraints + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyConstraints ::= SEQUENCE { + * requireExplicitPolicy [0] SkipCerts OPTIONAL, + * inhibitPolicyMapping [1] SkipCerts OPTIONAL } + * + * The private calls for this type: + * + * nssPKIXPolicyConstraints_Decode + * nssPKIXPolicyConstraints_Create + * nssPKIXPolicyConstraints_Destroy + * nssPKIXPolicyConstraints_Encode + * nssPKIXPolicyConstraints_HasRequireExplicitPolicy + * nssPKIXPolicyConstraints_GetRequireExplicitPolicy + * nssPKIXPolicyConstraints_SetRequireExplicitPolicy + * nssPKIXPolicyConstraints_RemoveRequireExplicitPolicy + * nssPKIXPolicyConstraints_HasInhibitPolicyMapping + * nssPKIXPolicyConstraints_GetInhibitPolicyMapping + * nssPKIXPolicyConstraints_SetInhibitPolicyMapping + * nssPKIXPolicyConstraints_RemoveInhibitPolicyMapping + * nssPKIXPolicyConstraints_Equal + * nssPKIXPolicyConstraints_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXPolicyConstraints_verifyPointer + * + */ + +/* + * nssPKIXPolicyConstraints_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyConstraints * +nssPKIXPolicyConstraints_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXPolicyConstraints_Create + * + * -- fgmr comments -- + * The optional values may be omitted by specifying -1. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * A valid pointer to an NSSPKIXPolicyConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyConstraints * +nssPKIXPolicyConstraints_Create +( + NSSArena *arenaOpt, + NSSPKIXSkipCerts requireExplicitPolicy, + NSSPKIXSkipCerts inhibitPolicyMapping +); + +/* + * nssPKIXPolicyConstraints_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyConstraints_Destroy +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * nssPKIXPolicyConstraints_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXPolicyConstraints_Encode +( + NSSPKIXPolicyConstraints *policyConstraints, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXPolicyConstraints_HasRequireExplicitPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXPolicyConstraints_HasRequireExplicitPolicy +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * nssPKIXPolicyConstraints_GetRequireExplicitPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_HAS_NO_REQUIRE_EXPLICIT_POLICY + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXPolicyConstraints_GetRequireExplicitPolicy +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * nssPKIXPolicyConstraints_SetRequireExplicitPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyConstraints_SetRequireExplicitPolicy +( + NSSPKIXPolicyConstraints *policyConstraints, + NSSPKIXSkipCerts requireExplicitPolicy +); + +/* + * nssPKIXPolicyConstraints_RemoveRequireExplicitPolicy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_HAS_NO_REQUIRE_EXPLICIT_POLICY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyConstraints_RemoveRequireExplicitPolicy +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * nssPKIXPolicyConstraints_HasInhibitPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXPolicyConstraints_HasInhibitPolicyMapping +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * nssPKIXPolicyConstraints_GetInhibitPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_HAS_NO_INHIBIT_POLICY_MAPPING + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXPolicyConstraints_GetInhibitPolicyMapping +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * nssPKIXPolicyConstraints_SetInhibitPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_INVALID_VALUE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyConstraints_SetInhibitPolicyMapping +( + NSSPKIXPolicyConstraints *policyConstraints, + NSSPKIXSkipCerts inhibitPolicyMapping +); + +/* + * nssPKIXPolicyConstraints_RemoveInhibitPolicyMapping + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_HAS_NO_INHIBIT_POLICY_MAPPING + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyConstraints_RemoveInhibitPolicyMapping +( + NSSPKIXPolicyConstraints *policyConstraints +); + +/* + * nssPKIXPolicyConstraints_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXPolicyConstraints_Equal +( + NSSPKIXPolicyConstraints *policyConstraints1, + NSSPKIXPolicyConstraints *policyConstraints2, + PRStatus *statusOpt +); + +/* + * nssPKIXPolicyConstraints_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_POLICY_CONSTRAINTS + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXPolicyConstraints upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXPolicyConstraints * +nssPKIXPolicyConstraints_Duplicate +( + NSSPKIXPolicyConstraints *policyConstraints, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXPolicyConstraints_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXPolicyConstraints + * 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_PKIX_POLICY_CONSTRAINTS + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXPolicyConstraints_verifyPointer +( + NSSPKIXPolicyConstraints *p +); +#endif /* DEBUG */ + +/* + * CRLDistPointsSyntax + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CRLDistPointsSyntax ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint + * + * The private calls for this type: + * + * nssPKIXCRLDistPointsSyntax_Decode + * nssPKIXCRLDistPointsSyntax_Create + * nssPKIXCRLDistPointsSyntax_Destroy + * nssPKIXCRLDistPointsSyntax_Encode + * nssPKIXCRLDistPointsSyntax_GetDistributionPointCount + * nssPKIXCRLDistPointsSyntax_GetDistributionPoints + * nssPKIXCRLDistPointsSyntax_SetDistributionPoints + * nssPKIXCRLDistPointsSyntax_GetDistributionPoint + * nssPKIXCRLDistPointsSyntax_SetDistributionPoint + * nssPKIXCRLDistPointsSyntax_InsertDistributionPoint + * nssPKIXCRLDistPointsSyntax_AppendDistributionPoint + * nssPKIXCRLDistPointsSyntax_RemoveDistributionPoint + * nssPKIXCRLDistPointsSyntax_FindDistributionPoint + * nssPKIXCRLDistPointsSyntax_Equal + * nssPKIXCRLDistPointsSyntax_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXCRLDistPointsSyntax_verifyPointer + * + */ + +/* + * nssPKIXCRLDistPointsSyntax_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCRLDistPointsSyntax upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCRLDistPointsSyntax * +nssPKIXCRLDistPointsSyntax_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXCRLDistPointsSyntax_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * A valid pointer to an NSSPKIXCRLDistPointsSyntax upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCRLDistPointsSyntax * +nssPKIXCRLDistPointsSyntax_Create +( + NSSArena *arenaOpt, + NSSPKIXDistributionPoint *distributionPoint1, + ... +); + +/* + * nssPKIXCRLDistPointsSyntax_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCRLDistPointsSyntax_Destroy +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax +); + +/* + * nssPKIXCRLDistPointsSyntax_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXCRLDistPointsSyntax_Encode +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXCRLDistPointsSyntax_GetDistributionPointCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXCRLDistPointsSyntax_GetDistributionPointCount +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax +); + +/* + * nssPKIXCRLDistPointsSyntax_GetDistributionPoints + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXDistributionPoint pointers + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPoints ** +nssPKIXCRLDistPointsSyntax_GetDistributionPoints +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSDistributionPoint *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXCRLDistPointsSyntax_SetDistributionPoints + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCRLDistPointsSyntax_SetDistributionPoints +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSDistributionPoint *distributionPoint[] + PRInt32 count +); + +/* + * nssPKIXCRLDistPointsSyntax_GetDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPoint * +nssPKIXCRLDistPointsSyntax_GetDistributionPoint +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSArena *arenaOpt +); + +/* + * nssPKIXCRLDistPointsSyntax_SetDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCRLDistPointsSyntax_SetDistributionPoint +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + PRInt32 i, + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * nssPKIXCRLDistPointsSyntax_InsertDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCRLDistPointsSyntax_InsertDistributionPoint +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + PRInt32 i, + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * nssPKIXCRLDistPointsSyntax_AppendDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCRLDistPointsSyntax_AppendDistributionPoint +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * nssPKIXCRLDistPointsSyntax_RemoveDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXCRLDistPointsSyntax_RemoveDistributionPoint +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + PRInt32 i +); + +/* + * nssPKIXCRLDistPointsSyntax_FindDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXCRLDistPointsSyntax_FindDistributionPoint +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * nssPKIXCRLDistPointsSyntax_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXCRLDistPointsSyntax_Equal +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax1, + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax2, + PRStatus *statusOpt +); + +/* + * nssPKIXCRLDistPointsSyntax_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_CRL_DIST_POINTS_SYNTAX + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXCRLDistPointsSyntax upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXCRLDistPointsSyntax * +nssPKIXCRLDistPointsSyntax_Duplicate +( + NSSPKIXCRLDistPointsSyntax *crlDistPointsSyntax, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXCRLDistPointsSyntax_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXCRLDistPointsSyntax + * 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_PKIX_CRL_DIST_POINTS_SYNTAX + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXCRLDistPointsSyntax_verifyPointer +( + NSSPKIXCRLDistPointsSyntax *p +); +#endif /* DEBUG */ + +/* + * DistributionPoint + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DistributionPoint ::= SEQUENCE { + * distributionPoint [0] DistributionPointName OPTIONAL, + * reasons [1] ReasonFlags OPTIONAL, + * cRLIssuer [2] GeneralNames OPTIONAL } + * + * The private calls for this type: + * + * nssPKIXDistributionPoint_Decode + * nssPKIXDistributionPoint_Create + * nssPKIXDistributionPoint_Destroy + * nssPKIXDistributionPoint_Encode + * nssPKIXDistributionPoint_HasDistributionPoint + * nssPKIXDistributionPoint_GetDistributionPoint + * nssPKIXDistributionPoint_SetDistributionPoint + * nssPKIXDistributionPoint_RemoveDistributionPoint + * nssPKIXDistributionPoint_HasReasons + * nssPKIXDistributionPoint_GetReasons + * nssPKIXDistributionPoint_SetReasons + * nssPKIXDistributionPoint_RemoveReasons + * nssPKIXDistributionPoint_HasCRLIssuer + * nssPKIXDistributionPoint_GetCRLIssuer + * nssPKIXDistributionPoint_SetCRLIssuer + * nssPKIXDistributionPoint_RemoveCRLIssuer + * nssPKIXDistributionPoint_Equal + * nssPKIXDistributionPoint_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXDistributionPoint_verifyPointer + * + */ + +/* + * nssPKIXDistributionPoint_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPoint * +nssPKIXDistributionPoint_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXDistributionPoint_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPoint * +nssPKIXDistributionPoint_Create +( + NSSArena *arenaOpt, + NSSPKIXDistributionPointName *distributionPoint, + NSSPKIXReasonFlags reasons, + NSSPKIXGeneralNames *cRLIssuer +); + +/* + * nssPKIXDistributionPoint_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXDistributionPoint_Destroy +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * nssPKIXDistributionPoint_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXDistributionPoint_Encode +( + NSSPKIXDistributionPoint *distributionPoint, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXDistributionPoint_HasDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXDistributionPoint_HasDistributionPoint +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * nssPKIXDistributionPoint_GetDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +nssPKIXDistributionPoint_GetDistributionPoint +( + NSSPKIXDistributionPoint *distributionPoint, + NSSArena *arenaOpt +); + +/* + * nssPKIXDistributionPoint_SetDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXDistributionPoint_SetDistributionPoint +( + NSSPKIXDistributionPoint *distributionPoint, + NSSPKIXDistributionPointName *name +); + +/* + * nssPKIXDistributionPoint_RemoveDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXDistributionPoint_RemoveDistributionPoint +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * nssPKIXDistributionPoint_HasReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXDistributionPoint_HasReasons +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * nssPKIXDistributionPoint_GetReasons + * + * It is unlikely that the reason flags are all zero; so zero is + * returned in error situations. + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_REASONS + * + * Return value: + * A valid nonzero NSSPKIXReasonFlags value upon success + * A valid zero NSSPKIXReasonFlags if the value is indeed zero + * Zero upon error + */ + +NSS_EXTERN NSSPKIXReasonFlags +nssPKIXDistributionPoint_GetReasons +( + NSSPKIXDistributionPoint *distributionPoint, + PRStatus *statusOpt +); + +/* + * nssPKIXDistributionPoint_SetReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXDistributionPoint_SetReasons +( + NSSPKIXDistributionPoint *distributionPoint, + NSSPKIXReasonFlags reasons +); + +/* + * nssPKIXDistributionPoint_RemoveReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_REASONS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXDistributionPoint_RemoveReasons +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * nssPKIXDistributionPoint_HasCRLIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXDistributionPoint_HasCRLIssuer +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * nssPKIXDistributionPoint_GetCRLIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_CRL_ISSUER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralNames * +nssPKIXDistributionPoint_GetCRLIssuer +( + NSSPKIXDistributionPoint *distributionPoint, + NSSArena *arenaOpt +); + +/* + * nssPKIXDistributionPoint_SetCRLIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXDistributionPoint_SetCRLIssuer +( + NSSPKIXDistributionPoint *distributionPoint, + NSSPKIXGeneralNames *cRLIssuer +); + +/* + * nssPKIXDistributionPoint_RemoveCRLIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_CRL_ISSUER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXDistributionPoint_RemoveCRLIssuer +( + NSSPKIXDistributionPoint *distributionPoint +); + +/* + * nssPKIXDistributionPoint_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXDistributionPoint_Equal +( + NSSPKIXDistributionPoint *distributionPoint1, + NSSPKIXDistributionPoint *distributionPoint2, + PRStatus *statusOpt +); + +/* + * nssPKIXDistributionPoint_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPoint * +nssPKIXDistributionPoint_Duplicate +( + NSSPKIXDistributionPoint *distributionPoint, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXDistributionPoint_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXDistributionPoint + * 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_PKIX_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXDistributionPoint_verifyPointer +( + NSSPKIXDistributionPoint *p +); +#endif /* DEBUG */ + +/* + * DistributionPointName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DistributionPointName ::= CHOICE { + * fullName [0] GeneralNames, + * nameRelativeToCRLIssuer [1] RelativeDistinguishedName } + * + * The private calls for this type: + * + * nssPKIXDistributionPointName_Decode + * nssPKIXDistributionPointName_Create + * nssPKIXDistributionPointName_CreateFromFullName + * nssPKIXDistributionPointName_CreateFromNameRelativeToCRLIssuer + * nssPKIXDistributionPointName_Destroy + * nssPKIXDistributionPointName_Encode + * nssPKIXDistributionPointName_GetChoice + * nssPKIXDistributionPointName_GetFullName + * nssPKIXDistributionPointName_GetNameRelativeToCRLIssuer + * nssPKIXDistributionPointName_Equal + * nssPKIXDistributionPointName_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXDistributionPointName_verifyPointer + * + */ + +/* + * nssPKIXDistributionPointName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +nssPKIXDistributionPointName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXDistributionPointName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME_CHOICE + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * NSS_ERROR_INVALID_PKIX_RELATIVE_DISTINGUISHED_NAME + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +nssPKIXDistributionPointName_Create +( + NSSArena *arenaOpt, + NSSPKIXDistributionPointNameChoice which, + void *name +); + +/* + * nssPKIXDistributionPointName_CreateFromFullName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_GENERAL_NAMES + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +nssPKIXDistributionPointName_CreateFromFullName +( + NSSArena *arenaOpt, + NSSPKIXGeneralNames *fullName +); + +/* + * nssPKIXDistributionPointName_CreateFromNameRelativeToCRLIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RELATIVE_DISTINGUISHED_NAME + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +nssPKIXDistributionPointName_CreateFromNameRelativeToCRLIssuer +( + NSSArena *arenaOpt, + NSSPKIXRelativeDistinguishedName *nameRelativeToCRLIssuer +); + +/* + * nssPKIXDistributionPointName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXDistributionPointName_Destroy +( + NSSPKIXDistributionPointName *dpn +); + +/* + * nssPKIXDistributionPointName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXDistributionPointName_Encode +( + NSSPKIXDistributionPointName *dpn, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXDistributionPointName_GetChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * + * Return value: + * A valid NSSPKIXDistributionPointNameChoice value upon success + * NSSPKIXDistributionPointNameChoice_NSSinvalid upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointNameChoice +nssPKIXDistributionPointName_GetChoice +( + NSSPKIXDistributionPointName *dpn +); + +/* + * nssPKIXDistributionPointName_GetFullName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralNames upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralnames * +nssPKIXDistributionPointName_GetFullName +( + NSSPKIXDistributionPointName *dpn, + NSSArena *arenaOpt +); + +/* + * nssPKIXDistributionPointName_GetNameRelativeToCRLIssuer + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_WRONG_CHOICE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +nssPKIXDistributionPointName_GetNameRelativeToCRLIssuer +( + NSSPKIXDistributionPointName *dpn, + NSSArena *arenaOpt +); + +/* + * nssPKIXDistributionPointName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXDistributionPointName_Equal +( + NSSPKIXDistributionPointName *dpn1, + NSSPKIXDistributionPointName *dpn2, + PRStatus *statusOpt +); + +/* + * nssPKIXDistributionPointName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +nssPKIXDistributionPointName_Duplicate +( + NSSPKIXDistributionPointName *dpn, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXDistributionPointName_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXDistributionPointName + * 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_PKIX_DISTRIBUTION_POINT_NAME + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXDistributionPointName_verifyPointer +( + NSSPKIXDistributionPointName *p +); +#endif /* DEBUG */ + +/* + * ReasonFlags + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ReasonFlags ::= BIT STRING { + * unused (0), + * keyCompromise (1), + * cACompromise (2), + * affiliationChanged (3), + * superseded (4), + * cessationOfOperation (5), + * certificateHold (6) } + * + * The private calls for this type: + * + * nssPKIXReasonFlags_Decode + * nssPKIXReasonFlags_Create + * nssPKIXReasonFlags_CreateFromMask + * nssPKIXReasonFlags_Destroy + * nssPKIXReasonFlags_Encode + * nssPKIXReasonFlags_GetMask + * nssPKIXReasonFlags_SetMask + * nssPKIXReasonFlags_Equal + * nssPKIXReasonFlags_Duplicate + * { bitwise accessors? } + * + * In debug builds, the following call is available: + * + * nssPKIXReasonFlags_verifyPointer + * + */ + +/* + * nssPKIXReasonFlags_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXReasonFlags upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXReasonFlags * +nssPKIXReasonFlags_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXReasonFlags_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXReasonFlags upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXReasonFlags * +nssPKIXReasonFlags_Create +( + NSSArena *arenaOpt, + PRBool keyCompromise, + PRBool cACompromise, + PRBool affiliationChanged, + PRBool superseded, + PRBool cessationOfOperation, + PRBool certificateHold +); + +/* + * nssPKIXReasonFlags_CreateFromMask + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS_MASK + * + * Return value: + * A valid pointer to an NSSPKIXReasonFlags upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXReasonFlags * +nssPKIXReasonFlags_CreateFromMask +( + NSSArena *arenaOpt, + NSSPKIXReasonFlagsMask why +); + +/* + * nssPKIXReasonFlags_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXReasonFlags_Destroy +( + NSSPKIXReasonFlags *reasonFlags +); + +/* + * nssPKIXReasonFlags_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXReasonFlags_Encode +( + NSSPKIXReasonFlags *reasonFlags, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXReasonFlags_GetMask + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * + * Return value: + * A valid mask of NSSPKIXReasonFlagsMask values upon success + * NSSPKIXReasonFlagsMask_NSSinvalid upon failure + */ + +NSS_EXTERN NSSPKIXReasonFlagsMask +nssPKIXReasonFlags_GetMask +( + NSSPKIXReasonFlags *reasonFlags +); + +/* + * nssPKIXReasonFlags_SetMask + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS_MASK + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXReasonFlags_SetMask +( + NSSPKIXReasonFlags *reasonFlags, + NSSPKIXReasonFlagsMask mask +); + +/* + * nssPKIXReasonFlags_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXReasonFlags_Equal +( + NSSPKIXReasonFlags *reasonFlags1, + NSSPKIXReasonFlags *reasonFlags2, + PRStatus *statusOpt +); + +/* + * nssPKIXReasonFlags_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXReasonFlags upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXReasonFlags * +nssPKIXReasonFlags_Duplicate +( + NSSPKIXReasonFlags *reasonFlags, + NSSArena *arenaOpt +); + +/* + * { bitwise accessors? } + * + */ + +#ifdef DEBUG +/* + * nssPKIXReasonFlags_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXReasonFlags + * 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_PKIX_REASON_FLAGS + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXReasonFlags_verifyPointer +( + NSSPKIXReasonFlags *p +); +#endif /* DEBUG */ + +/* + * ExtKeyUsageSyntax + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId + * + * The private calls for this type: + * + * nssPKIXExtKeyUsageSyntax_Decode + * nssPKIXExtKeyUsageSyntax_Create + * nssPKIXExtKeyUsageSyntax_Destroy + * nssPKIXExtKeyUsageSyntax_Encode + * nssPKIXExtKeyUsageSyntax_GetKeyPurposeIdCount + * nssPKIXExtKeyUsageSyntax_GetKeyPurposeIds + * nssPKIXExtKeyUsageSyntax_SetKeyPurposeIds + * nssPKIXExtKeyUsageSyntax_GetKeyPurposeId + * nssPKIXExtKeyUsageSyntax_SetKeyPurposeId + * nssPKIXExtKeyUsageSyntax_InsertKeyPurposeId + * nssPKIXExtKeyUsageSyntax_AppendKeyPurposeId + * nssPKIXExtKeyUsageSyntax_RemoveKeyPurposeId + * nssPKIXExtKeyUsageSyntax_FindKeyPurposeId + * nssPKIXExtKeyUsageSyntax_Equal + * nssPKIXExtKeyUsageSyntax_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXExtKeyUsageSyntax_verifyPointer + * + */ + +/* + * nssPKIXExtKeyUsageSyntax_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXExtKeyUsageSyntax upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtKeyUsageSyntax * +nssPKIXExtKeyUsageSyntax_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXExtKeyUsageSyntax_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_KEY_PURPOSE_ID + * + * Return value: + * A valid pointer to an NSSPKIXExtKeyUsageSyntax upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtKeyUsageSyntax * +nssPKIXExtKeyUsageSyntax_Create +( + NSSArena *arenaOpt, + NSSPKIXKeyPurposeId *kpid1, + ... +); + +/* + * nssPKIXExtKeyUsageSyntax_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtKeyUsageSyntax_Destroy +( + NSSPKIXExtKeyUsageSyntax *eku +); + +/* + * nssPKIXExtKeyUsageSyntax_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXExtKeyUsageSyntax_Encode +( + NSSPKIXExtKeyUsageSyntax *eku, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXExtKeyUsageSyntax_GetKeyPurposeIdCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXExtKeyUsageSyntax_GetKeyPurposeIdCount +( + NSSPKIXExtKeyUsageSyntax *eku +); + +/* + * nssPKIXExtKeyUsageSyntax_GetKeyPurposeIds + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXKeyPurposeId pointers upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXKeyPurposeId ** +nssPKIXExtKeyUsageSyntax_GetKeyPurposeIds +( + NSSPKIXExtKeyUsageSyntax *eku, + NSSPKIXKeyPurposeId *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXExtKeyUsageSyntax_SetKeyPurposeIds + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_PKIX_KEY_PURPOSE_ID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtKeyUsageSyntax_SetKeyPurposeIds +( + NSSPKIXExtKeyUsageSyntax *eku, + NSSPKIXKeyPurposeId *ids[], + PRInt32 count +); + +/* + * nssPKIXExtKeyUsageSyntax_GetKeyPurposeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXKeyPurposeId upon success + * NULL upon error + */ + +NSS_EXTERN NSSPKIXKeyPurposeId * +nssPKIXExtKeyUsageSyntax_GetKeyPurposeId +( + NSSPKIXExtKeyUsageSyntax *eku, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXExtKeyUsageSyntax_SetKeyPurposeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_PKIX_KEY_PURPOSE_ID + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtKeyUsageSyntax_SetKeyPurposeId +( + NSSPKIXExtKeyUsageSyntax *eku, + PRInt32 i, + NSSPKIXKeyPurposeId *id +); + +/* + * nssPKIXExtKeyUsageSyntax_InsertKeyPurposeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_PKIX_KEY_PURPOSE_ID + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtKeyUsageSyntax_InsertKeyPurposeId +( + NSSPKIXExtKeyUsageSyntax *eku, + PRInt32 i, + NSSPKIXKeyPurposeId *id +); + +/* + * nssPKIXExtKeyUsageSyntax_AppendKeyPurposeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_PKIX_KEY_PURPOSE_ID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtKeyUsageSyntax_AppendKeyPurposeId +( + NSSPKIXExtKeyUsageSyntax *eku, + NSSPKIXKeyPurposeId *id +); + +/* + * nssPKIXExtKeyUsageSyntax_RemoveKeyPurposeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXExtKeyUsageSyntax_RemoveKeyPurposeId +( + NSSPKIXExtKeyUsageSyntax *eku, + PRInt32 i +); + +/* + * nssPKIXExtKeyUsageSyntax_FindKeyPurposeId + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_PKIX_KEY_PURPOSE_ID + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified key purpose id upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXExtKeyUsageSyntax_FindKeyPurposeId +( + NSSPKIXExtKeyUsageSyntax *eku, + NSSPKIXKeyPurposeId *id +); + +/* + * nssPKIXExtKeyUsageSyntax_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXExtKeyUsageSyntax_Equal +( + NSSPKIXExtKeyUsageSyntax *eku1, + NSSPKIXExtKeyUsageSyntax *eku2, + PRStatus *statusOpt +); + +/* + * nssPKIXExtKeyUsageSyntax_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_EXT_KEY_USAGE_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXExtKeyUsageSyntax upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXExtKeyUsageSyntax * +nssPKIXExtKeyUsageSyntax_Duplicate +( + NSSPKIXExtKeyUsageSyntax *eku, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXExtKeyUsageSyntax_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXExtKeyUsageSyntax + * 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_PKIX_EXT_KEY_USAGE_SYNTAX + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXExtKeyUsageSyntax_verifyPointer +( + NSSPKIXExtKeyUsageSyntax *p +); +#endif /* DEBUG */ + +/* + * AuthorityInfoAccessSyntax + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AuthorityInfoAccessSyntax ::= + * SEQUENCE SIZE (1..MAX) OF AccessDescription + * + * The private calls for this type: + * + * nssPKIXAuthorityInfoAccessSyntax_Decode + * nssPKIXAuthorityInfoAccessSyntax_Create + * nssPKIXAuthorityInfoAccessSyntax_Destroy + * nssPKIXAuthorityInfoAccessSyntax_Encode + * nssPKIXAuthorityInfoAccessSyntax_GetAccessDescriptionCount + * nssPKIXAuthorityInfoAccessSyntax_GetAccessDescriptions + * nssPKIXAuthorityInfoAccessSyntax_SetAccessDescriptions + * nssPKIXAuthorityInfoAccessSyntax_GetAccessDescription + * nssPKIXAuthorityInfoAccessSyntax_SetAccessDescription + * nssPKIXAuthorityInfoAccessSyntax_InsertAccessDescription + * nssPKIXAuthorityInfoAccessSyntax_AppendAccessDescription + * nssPKIXAuthorityInfoAccessSyntax_RemoveAccessDescription + * nssPKIXAuthorityInfoAccessSyntax_FindAccessDescription + * nssPKIXAuthorityInfoAccessSyntax_Equal + * nssPKIXAuthorityInfoAccessSyntax_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXAuthorityInfoAccessSyntax_verifyPointer + * + */ + +/* + * nssPKIXAuthorityInfoAccessSyntax_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAuthorityInfoAccessSyntax upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAuthorityInfoAccessSyntax * +nssPKIXAuthorityInfoAccessSyntax_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * + * Return value: + * A valid pointer to an NSSPKIXAuthorityInfoAccessSyntax upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAuthorityInfoAccessSyntax * +nssPKIXAuthorityInfoAccessSyntax_Create +( + NSSArena *arenaOpt, + NSSPKIXAccessDescription *ad1, + ... +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAuthorityInfoAccessSyntax_Destroy +( + NSSPKIXAuthorityInfoAccessSyntax *aias +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXAuthorityInfoAccessSyntax_Encode +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_GetAccessDescriptionCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXAuthorityInfoAccessSyntax_GetAccessDescriptionCount +( + NSSPKIXAuthorityInfoAccessSyntax *aias +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_GetAccessDescriptions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXAccessDescription pointers + * upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAccessDescription ** +nssPKIXAuthorityInfoAccessSyntax_GetAccessDescriptions +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + NSSPKIXAccessDescription *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_SetAccessDescriptions + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAuthorityInfoAccessSyntax_SetAccessDescriptions +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + NSSPKIXAccessDescription *ad[], + PRInt32 count +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_GetAccessDescription + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAccessDescription upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAccessDescription * +nssPKIXAuthorityInfoAccessSyntax_GetAccessDescription +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + PRInt32 i, + NSSArena *arenaOpt +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_SetAccessDescription + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAuthorityInfoAccessSyntax_SetAccessDescription +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + PRInt32 i, + NSSPKIXAccessDescription *ad +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_InsertAccessDescription + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAuthorityInfoAccessSyntax_InsertAccessDescription +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + PRInt32 i, + NSSPKIXAccessDescription *ad +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_AppendAccessDescription + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAuthorityInfoAccessSyntax_AppendAccessDescription +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + NSSPKIXAccessDescription *ad +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_RemoveAccessDescription + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAuthorityInfoAccessSyntax_RemoveAccessDescription +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + PRInt32 i +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_FindAccessDescription + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified policy mapping upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +nssPKIXAuthorityInfoAccessSyntax_FindAccessDescription +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + NSSPKIXAccessDescription *ad +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXAuthorityInfoAccessSyntax_Equal +( + NSSPKIXAuthorityInfoAccessSyntax *aias1, + NSSPKIXAuthorityInfoAccessSyntax *aias2, + PRStatus *statusOpt +); + +/* + * nssPKIXAuthorityInfoAccessSyntax_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAuthorityInfoAccessSyntax upon + * success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAuthorityInfoAccessSyntax * +nssPKIXAuthorityInfoAccessSyntax_Duplicate +( + NSSPKIXAuthorityInfoAccessSyntax *aias, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXAuthorityInfoAccessSyntax_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXAuthorityInfoAccessSyntax + * 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_PKIX_AUTHORITY_INFO_ACCESS_SYNTAX + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXAuthorityInfoAccessSyntax_verifyPointer +( + NSSPKIXAuthorityInfoAccessSyntax *p +); +#endif /* DEBUG */ + +/* + * AccessDescription + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AccessDescription ::= SEQUENCE { + * accessMethod OBJECT IDENTIFIER, + * accessLocation GeneralName } + * + * The private calls for this type: + * + * nssPKIXAccessDescription_Decode + * nssPKIXAccessDescription_Create + * nssPKIXAccessDescription_Destroy + * nssPKIXAccessDescription_Encode + * nssPKIXAccessDescription_GetAccessMethod + * nssPKIXAccessDescription_SetAccessMethod + * nssPKIXAccessDescription_GetAccessLocation + * nssPKIXAccessDescription_SetAccessLocation + * nssPKIXAccessDescription_Equal + * nssPKIXAccessDescription_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXAccessDescription_verifyPointer + * + */ + +/* + * nssPKIXAccessDescription_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAccessDescription upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAccessDescription * +nssPKIXAccessDescription_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXAccessDescription_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * + * Return value: + * A valid pointer to an NSSPKIXAccessDescription upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAccessDescription * +nssPKIXAccessDescription_Create +( + NSSArena *arenaOpt, + NSSOID *accessMethod, + NSSPKIXGeneralName *accessLocation +); + +/* + * nssPKIXAccessDescription_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAccessDescription_Destroy +( + NSSPKIXAccessDescription *ad +); + +/* + * nssPKIXAccessDescription_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXAccessDescription_Encode +( + NSSPKIXAccessDescription *ad, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXAccessDescription_GetAccessMethod + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSOID pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSOID * +nssPKIXAccessDescription_GetAccessMethod +( + NSSPKIXAccessDescription *ad +); + +/* + * nssPKIXAccessDescription_SetAccessMethod + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_INVALID_OID + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAccessDescription_SetAccessMethod +( + NSSPKIXAccessDescription *ad, + NSSOID *accessMethod +); + +/* + * nssPKIXAccessDescription_GetAccessLocation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXGeneralName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXGeneralName * +nssPKIXAccessDescription_GetAccessLocation +( + NSSPKIXAccessDescription *ad, + NSSArena *arenaOpt +); + +/* + * nssPKIXAccessDescription_SetAccessLocation + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_INVALID_PKIX_GENERAL_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAccessDescription_SetAccessLocation +( + NSSPKIXAccessDescription *ad, + NSSPKIXGeneralName *accessLocation +); + +/* + * nssPKIXAccessDescription_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXAccessDescription_Equal +( + NSSPKIXAccessDescription *ad1, + NSSPKIXAccessDescription *ad2, + PRStatus *statusOpt +); + +/* + * nssPKIXAccessDescription_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ACCESS_DESCRIPTION + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAccessDescription upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAccessDescription * +nssPKIXAccessDescription_Duplicate +( + NSSPKIXAccessDescription *ad, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXAccessDescription_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXAccessDescription + * 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_PKIX_ACCESS_DESCRIPTION + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXAccessDescription_verifyPointer +( + NSSPKIXAccessDescription *p +); +#endif /* DEBUG */ + +/* + * IssuingDistributionPoint + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * IssuingDistributionPoint ::= SEQUENCE { + * distributionPoint [0] DistributionPointName OPTIONAL, + * onlyContainsUserCerts [1] BOOLEAN DEFAULT FALSE, + * onlyContainsCACerts [2] BOOLEAN DEFAULT FALSE, + * onlySomeReasons [3] ReasonFlags OPTIONAL, + * indirectCRL [4] BOOLEAN DEFAULT FALSE } + * + * The private calls for this type: + * + * nssPKIXIssuingDistributionPoint_Decode + * nssPKIXIssuingDistributionPoint_Create + * nssPKIXIssuingDistributionPoint_Destroy + * nssPKIXIssuingDistributionPoint_Encode + * nssPKIXIssuingDistributionPoint_HasDistributionPoint + * nssPKIXIssuingDistributionPoint_GetDistributionPoint + * nssPKIXIssuingDistributionPoint_SetDistributionPoint + * nssPKIXIssuingDistributionPoint_RemoveDistributionPoint + * nssPKIXIssuingDistributionPoint_GetOnlyContainsUserCerts + * nssPKIXIssuingDistributionPoint_SetOnlyContainsUserCerts + * nssPKIXIssuingDistributionPoint_GetOnlyContainsCACerts + * nssPKIXIssuingDistributionPoint_SetOnlyContainsCACerts + * nssPKIXIssuingDistributionPoint_HasOnlySomeReasons + * nssPKIXIssuingDistributionPoint_GetOnlySomeReasons + * nssPKIXIssuingDistributionPoint_SetOnlySomeReasons + * nssPKIXIssuingDistributionPoint_RemoveOnlySomeReasons + * nssPKIXIssuingDistributionPoint_GetIndirectCRL + * nssPKIXIssuingDistributionPoint_SetIndirectCRL + * nssPKIXIssuingDistributionPoint_Equal + * nssPKIXIssuingDistributionPoint_Duplicate + * + * In debug builds, the following call is available: + * + * nssPKIXIssuingDistributionPoint_verifyPointer + * + */ + +/* + * nssPKIXIssuingDistributionPoint_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXIssuingDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXIssuingDistributionPoint * +nssPKIXIssuingDistributionPoint_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +); + +/* + * nssPKIXIssuingDistributionPoint_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * + * Return value: + * A valid pointer to an NSSPKIXIssuingDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXIssuingDistributionPoint * +nssPKIXIssuingDistributionPoint_Create +( + NSSArena *arenaOpt, + NSSPKIXDistributionPointName *distributionPointOpt, + PRBool onlyContainsUserCerts, + PRBool onlyContainsCACerts, + NSSPKIXReasonFlags *onlySomeReasons + PRBool indirectCRL +); + +/* + * nssPKIXIssuingDistributionPoint_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXIssuingDistributionPoint_Destroy +( + NSSPKIXIssuingDistributionPoint *idp +); + +/* + * nssPKIXIssuingDistributionPoint_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXIssuingDistributionPoint_Encode +( + NSSPKIXIssuingDistributionPoint *idp, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +); + +/* + * nssPKIXIssuingDistributionPoint_HasDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXIssuingDistributionPoint_HasDistributionPoint +( + NSSPKIXIssuingDistributionPoint *idp +); + +/* + * nssPKIXIssuingDistributionPoint_GetDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXDistributionPointName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXDistributionPointName * +nssPKIXIssuingDistributionPoint_GetDistributionPoint +( + NSSPKIXIssuingDistributionPoint *idp, + NSSArena *arenaOpt +); + +/* + * nssPKIXIssuingDistributionPoint_SetDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_PKIX_DISTRIBUTION_POINT_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXIssuingDistributionPoint_SetDistributionPoint +( + NSSPKIXIssuingDistributionPoint *idp, + NSSPKIXDistributionPointName *dpn +); + +/* + * nssPKIXIssuingDistributionPoint_RemoveDistributionPoint + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXIssuingDistributionPoint_RemoveDistributionPoint +( + NSSPKIXIssuingDistributionPoint *idp +); + +/* + * nssPKIXIssuingDistributionPoint_GetOnlyContainsUserCerts + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if the onlyContainsUserCerts value is true + * PR_FALSE if it isn't + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXIssuingDistributionPoint_GetOnlyContainsUserCerts +( + NSSPKIXIssuingDistributionPoint *idp, + PRStatus *statusOpt +); + +/* + * nssPKIXIssuingDistributionPoint_SetOnlyContainsUserCerts + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXIssuingDistributionPoint_SetOnlyContainsUserCerts +( + NSSPKIXIssuingDistributionPoint *idp, + PRBool onlyContainsUserCerts +); + +/* + * nssPKIXIssuingDistributionPoint_GetOnlyContainsCACerts + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if the onlyContainsCACerts value is true + * PR_FALSE if it isn't + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXIssuingDistributionPoint_GetOnlyContainsCACerts +( + NSSPKIXIssuingDistributionPoint *idp, + PRStatus *statusOpt +); + +/* + * nssPKIXIssuingDistributionPoint_SetOnlyContainsCACerts + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXIssuingDistributionPoint_SetOnlyContainsCACerts +( + NSSPKIXIssuingDistributionPoint *idp, + PRBool onlyContainsCACerts +); + +/* + * nssPKIXIssuingDistributionPoint_HasOnlySomeReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if it has one + * PR_FALSE if it doesn't + * PR_FALSE upon failure + */ + +NSS_EXTERN PRBool +nssPKIXIssuingDistributionPoint_HasOnlySomeReasons +( + NSSPKIXIssuingDistributionPoint *idp +); + +/* + * nssPKIXIssuingDistributionPoint_GetOnlySomeReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_ONLY_SOME_REASONS + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXReasonFlags upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXReasonFlags * +nssPKIXIssuingDistributionPoint_GetOnlySomeReasons +( + NSSPKIXIssuingDistributionPoint *idp, + NSSArena *arenaOpt +); + +/* + * nssPKIXIssuingDistributionPoint_SetOnlySomeReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_INVALID_PKIX_REASON_FLAGS + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXIssuingDistributionPoint_SetOnlySomeReasons +( + NSSPKIXIssuingDistributionPoint *idp, + NSSPKIXReasonFlags *onlySomeReasons +); + +/* + * nssPKIXIssuingDistributionPoint_RemoveOnlySomeReasons + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_HAS_NO_ONLY_SOME_REASONS + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXIssuingDistributionPoint_RemoveOnlySomeReasons +( + NSSPKIXIssuingDistributionPoint *idp +); + +/* + * nssPKIXIssuingDistributionPoint_GetIndirectCRL + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if the indirectCRL value is true + * PR_FALSE if it isn't + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXIssuingDistributionPoint_GetIndirectCRL +( + NSSPKIXIssuingDistributionPoint *idp, + PRStatus *statusOpt +); + +/* + * nssPKIXIssuingDistributionPoint_SetIndirectCRL + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXIssuingDistributionPoint_SetIndirectCRL +( + NSSPKIXIssuingDistributionPoint *idp, + PRBool indirectCRL +); + +/* + * nssPKIXIssuingDistributionPoint_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +nssPKIXIssuingDistributionPoint_Equal +( + NSSPKIXIssuingDistributionPoint *idp1, + NSSPKIXIssuingDistributionPoint *idp2, + PRStatus *statusOpt +); + +/* + * nssPKIXIssuingDistributionPoint_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ISSUING_DISTRIBUTION_POINT + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXIssuingDistributionPoint upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXIssuingDistributionPoint * +nssPKIXIssuingDistributionPoint_Duplicate +( + NSSPKIXIssuingDistributionPoint *idp, + NSSArena *arenaOpt +); + +#ifdef DEBUG +/* + * nssPKIXIssuingDistributionPoint_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXIssuingDistributionPoint + * 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_PKIX_ISSUING_DISTRIBUTION_POINT + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_EXTERN PRStatus +nssPKIXIssuingDistributionPoint_verifyPointer +( + NSSPKIXIssuingDistributionPoint *p +); +#endif /* DEBUG */ + +PR_END_EXTERN_C + +#endif /* NSSPKIX_H */ diff --git a/security/nss/lib/pkix/include/pkixm.h b/security/nss/lib/pkix/include/pkixm.h new file mode 100644 index 000000000..c273848b5 --- /dev/null +++ b/security/nss/lib/pkix/include/pkixm.h @@ -0,0 +1,969 @@ +/* + * 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 PKIXM_H +#define PKIXM_H + +#ifdef DEBUG +static const char PKIXM_CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +/* + * pkixm.h + * + * This file contains the private type definitions for the + * PKIX part-1 objects. Mostly, this file contains the actual + * structure definitions for the NSSPKIX types declared in nsspkixt.h. + */ + +#ifndef PKIXTM_H +#include "pkixtm.h" +#endif /* PKIXTM_H */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +PR_BEGIN_EXTERN_C + +/* + * nss_pkix_Attribute_v_create + * + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttribute * +nss_pkix_Attribute_v_create +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + PRUint32 count, + va_list ap +); + +#ifdef DEBUG + +/* + * nss_pkix_Attribute_add_pointer + * + * This method is only present in debug builds. + * + * This module-private routine adds an NSSPKIXAttribute pointer to + * the internal pointer-tracker. This routine should only be used + * by the NSSPKIX module. This routine returns a PRStatus value; + * upon error it will place an error on the error stack and return + * PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nss_pkix_Attribute_add_pointer +( + const NSSPKIXAttribute *p +); + +/* + * nss_pkix_Attribute_remove_pointer + * + * This method is only present in debug builds. + * + * This module-private routine removes a valid NSSPKIXAttribute + * pointer from the internal pointer-tracker. This routine should + * only be used by the NSSPKIX module. This routine returns a + * PRStatus value; upon error it will place an error on the error + * stack and return PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nss_pkix_Attribute_remove_pointer +( + const NSSPKIXAttribute *p +); + +#endif /* DEBUG */ + + +#ifdef DEBUG + +NSS_EXTERN PRStatus +nss_pkix_AttributeTypeAndValue_add_pointer +( + const NSSPKIXAttributeTypeAndValue *p +); + +NSS_EXTERN PRStatus +nss_pkix_AttributeTypeAndValue_remove_pointer +( + const NSSPKIXAttributeTypeAndValue *p +); + +#endif /* DEBUG */ + +/* + * nss_pkix_X520Name_DoUTF8 + * + */ + +NSS_EXTERN PR_STATUS +nss_pkix_X520Name_DoUTF8 +( + NSSPKIXX520Name *name +); + +#ifdef DEBUG + +NSS_EXTERN PRStatus +nss_pkix_X520Name_add_pointer +( + const NSSPKIXX520Name *p +); + +NSS_EXTERN PRStatus +nss_pkix_X520Name_remove_pointer +( + const NSSPKIXX520Name *p +); + +#endif /* DEBUG */ + +/* + * nss_pkix_X520CommonName_DoUTF8 + * + */ + +NSS_EXTERN PR_STATUS +nss_pkix_X520CommonName_DoUTF8 +( + NSSPKIXX520CommonName *name +); + +#ifdef DEBUG + +NSS_EXTERN PRStatus +nss_pkix_X520CommonName_add_pointer +( + const NSSPKIXX520CommonName *p +); + +NSS_EXTERN PRStatus +nss_pkix_X520CommonName_remove_pointer +( + const NSSPKIXX520CommonName *p +); + + +NSS_EXTERN PRStatus +nss_pkix_Name_add_pointer +( + const NSSPKIXName *p +); + +NSS_EXTERN PRStatus +nss_pkix_Name_remove_pointer +( + const NSSPKIXName *p +); + +/* + * nss_pkix_RDNSequence_v_create + */ + +NSS_EXTERN NSSPKIXRDNSequence * +nss_pkix_RDNSequence_v_create +( + NSSArena *arenaOpt, + PRUint32 count, + va_list ap +); + +/* + * nss_pkix_RDNSequence_Clear + * + * Wipes out cached data. + */ + +NSS_EXTERN PRStatus +nss_pkix_RDNSequence_Clear +( + NSSPKIXRDNSequence *rdnseq +); + +#ifdef DEBUG + +#ifdef NSSDEBUG + +NSS_EXTERN PRStatus +nss_pkix_RDNSequence_register +( + NSSPKIXRDNSequence *rdnseq +); + +NSS_EXTERN PRStatus +nss_pkix_RDNSequence_deregister +( + NSSPKIXRDNSequence *rdnseq +); + +#endif /* NSSDEBUG */ + +NSS_EXTERN PRStatus +nss_pkix_RDNSequence_add_pointer +( + const NSSPKIXRDNSequence *p +); + +NSS_EXTERN PRStatus +nss_pkix_RDNSequence_remove_pointer +( + const NSSPKIXRDNSequence *p +); + +#endif /* DEBUG */ + +/* + * nss_pkix_RelativeDistinguishedName_v_create + * + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +nss_pkix_RelativeDistinguishedName_V_Create +( + NSSArena *arenaOpt, + PRUint32 count, + va_list ap +); + +/* + * nss_pkix_RelativeDistinguishedName_Clear + * + * Wipes out cached data. + */ + +NSS_EXTERN PRStatus +nss_pkix_RelativeDistinguishedName_Clear +( + NSSPKIXRelativeDistinguishedName *rdn +); + +#ifdef DEBUG + +#ifdef NSSDEBUG + +NSS_EXTERN PRStatus +nss_pkix_RelativeDistinguishedName_register +( + NSSPKIXRelativeDistinguishedName *rdn +); + +NSS_EXTERN PRStatus +nss_pkix_RelativeDistinguishedName_deregister +( + NSSPKIXRelativeDistinguishedName *rdn +); + +#endif /* NSSDEBUG */ + +NSS_EXTERN PRStatus +nss_pkix_RelativeDistinguishedName_add_pointer +( + const NSSPKIXRelativeDistinguishedName *p +); + +NSS_EXTERN PRStatus +nss_pkix_RelativeDistinguishedName_remove_pointer +( + const NSSPKIXRelativeDistinguishedName *p +); + +NSS_EXTERN PRStatus +nss_pkix_Certificate_add_pointer +( + const NSSPKIXCertificate *p +); + +NSS_EXTERN PRStatus +nss_pkix_Certificate_remove_pointer +( + const NSSPKIXCertificate *p +); + +NSS_EXTERN PRStatus +nss_pkix_TBSCertificate_add_pointer +( + const NSSPKIXTBSCertificate *p +); + +NSS_EXTERN PRStatus +nss_pkix_TBSCertificate_remove_pointer +( + const NSSPKIXTBSCertificate *p +); + +NSS_EXTERN PRStatus +nss_pkix_Validity_add_pointer +( + const NSSPKIXValidity *p +); + +NSS_EXTERN PRStatus +nss_pkix_Validity_remove_pointer +( + const NSSPKIXValidity *p +); + +NSS_EXTERN PRStatus +nss_pkix_SubjectPublicKeyInfo_add_pointer +( + const NSSPKIXSubjectPublicKeyInfo *p +); + +NSS_EXTERN PRStatus +nss_pkix_SubjectPublicKeyInfo_remove_pointer +( + const NSSPKIXSubjectPublicKeyInfo *p +); + +NSS_EXTERN PRStatus +nss_pkix_CertificateList_add_pointer +( + const NSSPKIXCertificateList *p +); + +NSS_EXTERN PRStatus +nss_pkix_CertificateList_remove_pointer +( + const NSSPKIXCertificateList *p +); + +NSS_EXTERN PRStatus +nss_pkix_TBSCertList_add_pointer +( + const NSSPKIXTBSCertList *p +); + +NSS_EXTERN PRStatus +nss_pkix_TBSCertList_remove_pointer +( + const NSSPKIXTBSCertList *p +); + +NSS_EXTERN PRStatus +nss_pkix_revokedCertificates_add_pointer +( + const NSSPKIXrevokedCertificates *p +); + +NSS_EXTERN PRStatus +nss_pkix_revokedCertificates_remove_pointer +( + const NSSPKIXrevokedCertificates *p +); + +NSS_EXTERN PRStatus +nss_pkix_revokedCertificate_add_pointer +( + const NSSPKIXrevokedCertificate *p +); + +NSS_EXTERN PRStatus +nss_pkix_revokedCertificate_remove_pointer +( + const NSSPKIXrevokedCertificate *p +); + +NSS_EXTERN PRStatus +nss_pkix_AlgorithmIdentifier_add_pointer +( + const NSSPKIXAlgorithmIdentifier *p +); + +NSS_EXTERN PRStatus +nss_pkix_AlgorithmIdentifier_remove_pointer +( + const NSSPKIXAlgorithmIdentifier *p +); + +NSS_EXTERN PRStatus +nss_pkix_ORAddress_add_pointer +( + const NSSPKIXORAddress *p +); + +NSS_EXTERN PRStatus +nss_pkix_ORAddress_remove_pointer +( + const NSSPKIXORAddress *p +); + +NSS_EXTERN PRStatus +nss_pkix_BuiltInStandardAttributes_add_pointer +( + const NSSPKIXBuiltInStandardAttributes *p +); + +NSS_EXTERN PRStatus +nss_pkix_BuiltInStandardAttributes_remove_pointer +( + const NSSPKIXBuiltInStandardAttributes *p +); + +NSS_EXTERN PRStatus +nss_pkix_PersonalName_add_pointer +( + const NSSPKIXPersonalName *p +); + +NSS_EXTERN PRStatus +nss_pkix_PersonalName_remove_pointer +( + const NSSPKIXPersonalName *p +); + +NSS_EXTERN PRStatus +nss_pkix_OrganizationalUnitNames_add_pointer +( + const NSSPKIXOrganizationalUnitNames *p +); + +NSS_EXTERN PRStatus +nss_pkix_OrganizationalUnitNames_remove_pointer +( + const NSSPKIXOrganizationalUnitNames *p +); + +NSS_EXTERN PRStatus +nss_pkix_BuiltInDomainDefinedAttributes_add_pointer +( + const NSSPKIXBuiltInDomainDefinedAttributes *p +); + +NSS_EXTERN PRStatus +nss_pkix_BuiltInDomainDefinedAttributes_remove_pointer +( + const NSSPKIXBuiltInDomainDefinedAttributes *p +); + +NSS_EXTERN PRStatus +nss_pkix_BuiltInDomainDefinedAttribute_add_pointer +( + const NSSPKIXBuiltInDomainDefinedAttribute *p +); + +NSS_EXTERN PRStatus +nss_pkix_BuiltInDomainDefinedAttribute_remove_pointer +( + const NSSPKIXBuiltInDomainDefinedAttribute *p +); + +NSS_EXTERN PRStatus +nss_pkix_ExtensionAttributes_add_pointer +( + const NSSPKIXExtensionAttributes *p +); + +NSS_EXTERN PRStatus +nss_pkix_ExtensionAttributes_remove_pointer +( + const NSSPKIXExtensionAttribute *p +); + +NSS_EXTERN PRStatus +nss_pkix_ExtensionAttribute_add_pointer +( + const NSSPKIXExtensionAttribute *p +); + +NSS_EXTERN PRStatus +nss_pkix_ExtensionAttribute_remove_pointer +( + const NSSPKIXExtensionAttribute *p +); + +NSS_EXTERN PRStatus +nss_pkix_TeletexPersonalName_add_pointer +( + const NSSPKIXTeletexPersonalName *p +); + +NSS_EXTERN PRStatus +nss_pkix_TeletexPersonalName_remove_pointer +( + const NSSPKIXTeletexPersonalName *p +); + +NSS_EXTERN PRStatus +nss_pkix_TeletexOrganizationalUnitNames_add_pointer +( + const NSSPKIXTeletexOrganizationalUnitNames *p +); + +NSS_EXTERN PRStatus +nss_pkix_TeletexOrganizationalUnitNames_remove_pointer +( + const NSSPKIXTeletexOrganizationalUnitNames *p +); + +NSS_EXTERN PRStatus +nss_pkix_PDSParameter_add_pointer +( + const NSSPKIXPDSParameter *p +); + +NSS_EXTERN PRStatus +nss_pkix_PDSParameter_remove_pointer +( + const NSSPKIXPDSParameter *p +); + +NSS_EXTERN PRStatus +nss_pkix_ExtendedNetworkAddress_add_pointer +( + const NSSPKIXExtendedNetworkAddress *p +); + +NSS_EXTERN PRStatus +nss_pkix_ExtendedNetworkAddress_remove_pointer +( + const NSSPKIXExtendedNetworkAddress *p +); + +NSS_EXTERN PRStatus +nss_pkix_e1634Address_add_pointer +( + const NSSPKIXe1634Address *p +); + +NSS_EXTERN PRStatus +nss_pkix_e1634Address_remove_pointer +( + const NSSPKIXe1634Address *p +); + +NSS_EXTERN PRStatus +nss_pkix_TeletexDomainDefinedAttributes_add_pointer +( + const NSSPKIXTeletexDomainDefinedAttributes *p +); + +NSS_EXTERN PRStatus +nss_pkix_TeletexDomainDefinedAttributes_remove_pointer +( + const NSSPKIXTeletexDomainDefinedAttributes *p +); + +NSS_EXTERN PRStatus +nss_pkix_TeletexDomainDefinedAttribute_add_pointer +( + const NSSPKIXTeletexDomainDefinedAttribute *p +); + +NSS_EXTERN PRStatus +nss_pkix_TeletexDomainDefinedAttribute_remove_pointer +( + const NSSPKIXTeletexDomainDefinedAttribute *p +); + +NSS_EXTERN PRStatus +nss_pkix_AuthorityKeyIdentifier_add_pointer +( + const NSSPKIXAuthorityKeyIdentifier *p +); + +NSS_EXTERN PRStatus +nss_pkix_AuthorityKeyIdentifier_remove_pointer +( + const NSSPKIXAuthorityKeyIdentifier *p +); + +NSS_EXTERN PRStatus +nss_pkix_KeyUsage_add_pointer +( + const NSSPKIXKeyUsage *p +); + +NSS_EXTERN PRStatus +nss_pkix_KeyUsage_remove_pointer +( + const NSSPKIXKeyUsage *p +); + +NSS_EXTERN PRStatus +nss_pkix_PrivateKeyUsagePeriod_add_pointer +( + const NSSPKIXPrivateKeyUsagePeriod *p +); + +NSS_EXTERN PRStatus +nss_pkix_PrivateKeyUsagePeriod_remove_pointer +( + const NSSPKIXPrivateKeyUsagePeriod *p +); + +NSS_EXTERN PRStatus +nss_pkix_CertificatePolicies_add_pointer +( + const NSSPKIXCertificatePolicies *p +); + +NSS_EXTERN PRStatus +nss_pkix_CertificatePolicies_remove_pointer +( + const NSSPKIXCertificatePolicies *p +); + +NSS_EXTERN PRStatus +nss_pkix_PolicyInformation_add_pointer +( + const NSSPKIXPolicyInformation *p +); + +NSS_EXTERN PRStatus +nss_pkix_PolicyInformation_remove_pointer +( + const NSSPKIXPolicyInformation *p +); + +NSS_EXTERN PRStatus +nss_pkix_PolicyQualifierInfo_add_pointer +( + const NSSPKIXPolicyQualifierInfo *p +); + +NSS_EXTERN PRStatus +nss_pkix_PolicyQualifierInfo_remove_pointer +( + const NSSPKIXPolicyQualifierInfo *p +); + +NSS_EXTERN PRStatus +nss_pkix_UserNotice_add_pointer +( + const NSSPKIXUserNotice *p +); + +NSS_EXTERN PRStatus +nss_pkix_UserNotice_remove_pointer +( + const NSSPKIXUserNotice *p +); + +NSS_EXTERN PRStatus +nss_pkix_NoticeReference_add_pointer +( + const NSSPKIXNoticeReference *p +); + +NSS_EXTERN PRStatus +nss_pkix_NoticeReference_remove_pointer +( + const NSSPKIXNoticeReference *p +); + +NSS_EXTERN PRStatus +nss_pkix_PolicyMappings_add_pointer +( + const NSSPKIXPolicyMappings *p +); + +NSS_EXTERN PRStatus +nss_pkix_PolicyMappings_remove_pointer +( + const NSSPKIXPolicyMappings *p +); + +NSS_EXTERN PRStatus +nss_pkix_policyMapping_add_pointer +( + const NSSPKIXpolicyMapping *p +); + +NSS_EXTERN PRStatus +nss_pkix_policyMapping_remove_pointer +( + const NSSPKIXpolicyMapping *p +); + +NSS_EXTERN PRStatus +nss_pkix_GeneralName_add_pointer +( + const NSSPKIXGeneralName *p +); + +NSS_EXTERN PRStatus +nss_pkix_GeneralName_remove_pointer +( + const NSSPKIXGeneralName *p +); + +NSS_EXTERN PRStatus +nss_pkix_GeneralNames_add_pointer +( + const NSSPKIXGeneralNames *p +); + +NSS_EXTERN PRStatus +nss_pkix_GeneralNames_remove_pointer +( + const NSSPKIXGeneralNames *p +); + +NSS_EXTERN PRStatus +nss_pkix_AnotherName_add_pointer +( + const NSSPKIXAnotherName *p +); + +NSS_EXTERN PRStatus +nss_pkix_AnotherName_remove_pointer +( + const NSSPKIXAnotherName *p +); + +NSS_EXTERN PRStatus +nss_pkix_EDIPartyName_add_pointer +( + const NSSPKIXEDIPartyName *p +); + +NSS_EXTERN PRStatus +nss_pkix_EDIPartyName_remove_pointer +( + const NSSPKIXEDIPartyName *p +); + +NSS_EXTERN PRStatus +nss_pkix_SubjectDirectoryAttributes_add_pointer +( + const NSSPKIXSubjectDirectoryAttributes *p +); + +NSS_EXTERN PRStatus +nss_pkix_SubjectDirectoryAttributes_remove_pointer +( + const NSSPKIXSubjectDirectoryAttributes *p +); + +NSS_EXTERN PRStatus +nss_pkix_BasicConstraints_add_pointer +( + const NSSPKIXBasicConstraints *p +); + +NSS_EXTERN PRStatus +nss_pkix_BasicConstraints_remove_pointer +( + const NSSPKIXBasicConstraints *p +); + +NSS_EXTERN PRStatus +nss_pkix_NameConstraints_add_pointer +( + const NSSPKIXNameConstraints *p +); + +NSS_EXTERN PRStatus +nss_pkix_NameConstraints_remove_pointer +( + const NSSPKIXNameConstraints *p +); + +NSS_EXTERN PRStatus +nss_pkix_GeneralSubtrees_add_pointer +( + const NSSPKIXGeneralSubtrees *p +); + +NSS_EXTERN PRStatus +nss_pkix_GeneralSubtrees_remove_pointer +( + const NSSPKIXGeneralSubtrees *p +); + +NSS_EXTERN PRStatus +nss_pkix_GeneralSubtree_add_pointer +( + const NSSPKIXGeneralSubtree *p +); + +NSS_EXTERN PRStatus +nss_pkix_GeneralSubtree_remove_pointer +( + const NSSPKIXGeneralSubtree *p +); + +NSS_EXTERN PRStatus +nss_pkix_PolicyConstraints_add_pointer +( + const NSSPKIXPolicyConstraints *p +); + +NSS_EXTERN PRStatus +nss_pkix_PolicyConstraints_remove_pointer +( + const NSSPKIXPolicyConstraints *p +); + +NSS_EXTERN PRStatus +nss_pkix_CRLDistPointsSyntax_add_pointer +( + const NSSPKIXCRLDistPointsSyntax *p +); + +NSS_EXTERN PRStatus +nss_pkix_CRLDistPointsSyntax_remove_pointer +( + const NSSPKIXCRLDistPointsSyntax *p +); + +NSS_EXTERN PRStatus +nss_pkix_DistributionPoint_add_pointer +( + const NSSPKIXDistributionPoint *p +); + +NSS_EXTERN PRStatus +nss_pkix_DistributionPoint_remove_pointer +( + const NSSPKIXDistributionPoint *p +); + +NSS_EXTERN PRStatus +nss_pkix_DistributionPointName_add_pointer +( + const NSSPKIXDistributionPointName *p +); + +NSS_EXTERN PRStatus +nss_pkix_DistributionPointName_remove_pointer +( + const NSSPKIXDistributionPointName *p +); + +NSS_EXTERN PRStatus +nss_pkix_ReasonFlags_add_pointer +( + const NSSPKIXReasonFlags *p +); + +NSS_EXTERN PRStatus +nss_pkix_ReasonFlags_remove_pointer +( + const NSSPKIXReasonFlags *p +); + +NSS_EXTERN PRStatus +nss_pkix_ExtKeyUsageSyntax_add_pointer +( + const NSSPKIXExtKeyUsageSyntax *p +); + +NSS_EXTERN PRStatus +nss_pkix_ExtKeyUsageSyntax_remove_pointer +( + const NSSPKIXExtKeyUsageSyntax *p +); + +NSS_EXTERN PRStatus +nss_pkix_AuthorityInfoAccessSyntax_add_pointer +( + const NSSPKIXAuthorityInfoAccessSyntax *p +); + +NSS_EXTERN PRStatus +nss_pkix_AuthorityInfoAccessSyntax_remove_pointer +( + const NSSPKIXAuthorityInfoAccessSyntax *p +); + +NSS_EXTERN PRStatus +nss_pkix_AccessDescription_add_pointer +( + const NSSPKIXAccessDescription *p +); + +NSS_EXTERN PRStatus +nss_pkix_AccessDescription_remove_pointer +( + const NSSPKIXAccessDescription *p +); + +NSS_EXTERN PRStatus +nss_pkix_IssuingDistributionPoint_add_pointer +( + const NSSPKIXIssuingDistributionPoint *p +); + +NSS_EXTERN PRStatus +nss_pkix_IssuingDistributionPoint_remove_pointer +( + const NSSPKIXIssuingDistributionPoint *p +); + +#endif /* DEBUG */ + +PR_END_EXTERN_C + +#endif /* PKIXM_H */ diff --git a/security/nss/lib/pkix/include/pkixt.h b/security/nss/lib/pkix/include/pkixt.h new file mode 100644 index 000000000..b620cfb8c --- /dev/null +++ b/security/nss/lib/pkix/include/pkixt.h @@ -0,0 +1,57 @@ +/* + * 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 PKIXT_H +#define PKIXT_H + +#ifdef DEBUG +static const char PKIXT_CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +/* + * pkixt.h + * + * This file contains the private type definitions for the + * PKIX part-1 objects. Mostly, this file contains the actual + * structure definitions for the NSSPKIX types declared in nsspkixt.h. + */ + +#ifndef NSSPKIXT_H +#include "nsspkixt.h" +#endif /* NSSPKIXT_H */ + +PR_BEGIN_EXTERN_C + +PR_END_EXTERN_C + +#endif /* PKIXT_H */ diff --git a/security/nss/lib/pkix/include/pkixtm.h b/security/nss/lib/pkix/include/pkixtm.h new file mode 100644 index 000000000..1a9e57af0 --- /dev/null +++ b/security/nss/lib/pkix/include/pkixtm.h @@ -0,0 +1,1581 @@ +/* + * 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 PKIXTM_H +#define PKIXTM_H + +#ifdef DEBUG +static const char PKIXTM_CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +/* + * pkixtm.h + * + * This file contains the module-private type definitions for the + * PKIX part-1 objects. Mostly, this file contains the actual + * structure definitions for the NSSPKIX types declared in nsspkixt.h. + */ + +#ifndef NSSPKIXT_H +#include "nsspkixt.h" +#endif /* NSSPKIXT_H */ + +PR_BEGIN_EXTERN_C + +/* + * Attribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Attribute ::= SEQUENCE { + * type AttributeType, + * values SET OF AttributeValue + * -- at least one value is required -- } + * + */ + +struct NSSPKIXAttributeStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSBER *ber; + NSSDER *der; + nssASN1Item asn1type; + nssASN1Item **asn1values; + NSSPKIXAttributeType *type; + PRUint32 valuesCount; +}; + +/* + * AttributeTypeAndValue + * + * This structure contains an attribute type (indicated by an OID), + * and the type-specific value. RelativeDistinguishedNamess consist + * of a set of these. These are distinct from Attributes (which have + * SET of values), from AttributeDescriptions (which have qualifiers + * on the types), and from AttributeValueAssertions (which assert a + * a value comparison under some matching rule). + * + * From RFC 2459: + * + * AttributeTypeAndValue ::= SEQUENCE { + * type AttributeType, + * value AttributeValue } + * + */ + +struct NSSPKIXAttributeTypeAndValueStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + nssASN1Item asn1type; + nssASN1Item asn1value; + NSSPKIXAttributeType *type; + NSSUTF8 *utf8; +}; + +/* + * X520Name + * + * From RFC 2459: + * + * X520name ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-name)), + * printableString PrintableString (SIZE (1..ub-name)), + * universalString UniversalString (SIZE (1..ub-name)), + * utf8String UTF8String (SIZE (1..ub-name)), + * bmpString BMPString (SIZE(1..ub-name)) } + * + * + * ub-name INTEGER ::= 32768 + * + */ + +struct NSSPKIXX520NameStr { + nssASN1Item string; + NSSUTF8 *utf8; + NSSDER *der; + PRBool wasPrintable; + PRBool inArena; +}; + +/* + * From RFC 2459: + * + * X520CommonName ::= CHOICE { + * teletexString TeletexString (SIZE (1..ub-common-name)), + * printableString PrintableString (SIZE (1..ub-common-name)), + * universalString UniversalString (SIZE (1..ub-common-name)), + * utf8String UTF8String (SIZE (1..ub-common-name)), + * bmpString BMPString (SIZE(1..ub-common-name)) } + * + * ub-common-name INTEGER ::= 64 + * + */ + +struct NSSPKIXX520CommonNameStr { +}; + +/* + * Name + * + * This structure contains a union of the possible name formats, + * which at the moment is limited to an RDNSequence. + * + * From RFC 2459: + * + * Name ::= CHOICE { -- only one possibility for now -- + * rdnSequence RDNSequence } + * + */ + +struct NSSPKIXNameStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *ber; + NSSDER *der; + NSSUTF8 *utf; + NSSPKIXNameChoice choice; + union { + NSSPKIXRDNSequence *rdnSequence; + } u; +}; + +/* + * RDNSequence + * + * This structure contains a sequence of RelativeDistinguishedName + * objects. + * + * From RFC 2459: + * + * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName + * + */ + +struct NSSPKIXRDNSequenceStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSBER *ber; + NSSDER *der; + NSSUTF8 *utf8; + PRUint32 count; + NSSPKIXRelativeDistinguishedName **rdns; +}; + +/* + * RelativeDistinguishedName + * + * This structure contains an unordered set of AttributeTypeAndValue + * objects. RDNs are used to distinguish a set of objects underneath + * a common object. + * + * Often, a single ATAV is sufficient to make a unique distinction. + * For example, if a company assigns its people unique uid values, + * then in the Name "uid=smith,ou=People,o=Acme,c=US" the "uid=smith" + * ATAV by itself forms an RDN. However, sometimes a set of ATAVs is + * needed. For example, if a company needed to distinguish between + * two Smiths by specifying their corporate divisions, then in the + * Name "(cn=Smith,ou=Sales),ou=People,o=Acme,c=US" the parenthesised + * set of ATAVs forms the RDN. + * + * From RFC 2459: + * + * RelativeDistinguishedName ::= + * SET SIZE (1 .. MAX) OF AttributeTypeAndValue + * + */ + +struct NSSPKIXRelativeDistinguishedNameStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSBER *ber; + NSSUTF8 *utf8; + PRUint32 count; + NSSPKIXAttributeTypeAndValue **atavs; +}; + +/* + * Certificate + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Certificate ::= SEQUENCE { + * tbsCertificate TBSCertificate, + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING } + * + */ + +struct NSSPKIXCertificateStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXTBSCertificate *tbsCertificate; + NSSPKIXAlgorithmIdentifier *signatureAlgorithm; + NSSItem *signature; +}; + +/* + * TBSCertificate + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TBSCertificate ::= SEQUENCE { + * version [0] Version DEFAULT v1, + * serialNumber CertificateSerialNumber, + * signature AlgorithmIdentifier, + * issuer Name, + * validity Validity, + * subject Name, + * subjectPublicKeyInfo SubjectPublicKeyInfo, + * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, + * -- If present, version shall be v2 or v3 + * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, + * -- If present, version shall be v2 or v3 + * extensions [3] Extensions OPTIONAL + * -- If present, version shall be v3 -- } + * + */ + +struct NSSPKIXTBSCertificateStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXVersion version; + NSSPKIXCertificateSerialNumber serialNumber; + NSSPKIXAlgorithmIdentifier *signature; + NSSPKIXName *issuer; + NSSPKIXValidity *validity; + NSSPKIXName *subject; + NSSPKIXSubjectPublicKeyInfo *subjectPublicKeyInfo; + NSSPKIXUniqueIdentifier *issuerUniqueID; + NSSPKIXUniqueIdentifier *subjectUniqueID; + NSSPKIXExtensions *extensions; +}; + +/* + * Validity + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Validity ::= SEQUENCE { + * notBefore Time, + * notAfter Time } + * + */ + +struct NSSPKIXValidityStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * Time + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Time ::= CHOICE { + * utcTime UTCTime, + * generalTime GeneralizedTime } + * + */ + +struct NSSPKIXTimeStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSBER *ber; + nssASN1Item asn1item; + PRTime prTime; + PRBool prTimeValid; +}; + +/* + * SubjectPublicKeyInfo + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * SubjectPublicKeyInfo ::= SEQUENCE { + * algorithm AlgorithmIdentifier, + * subjectPublicKey BIT STRING } + * + */ + +struct NSSPKIXSubjectPublicKeyInfoStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXAlgorithmIdentifier *algorithm; + NSSItem *subjectPublicKey; +}; + +/* + * Extensions + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension + * + */ + +struct NSSPKIXExtensionsStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * Extension + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * Extension ::= SEQUENCE { + * extnID OBJECT IDENTIFIER, + * critical BOOLEAN DEFAULT FALSE, + * extnValue OCTET STRING } + * + */ + +struct NSSPKIXExtensionStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSOID *extnID; + PRBool critical; + NSSItem *extnValue; +}; + +/* + * CertificateList + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CertificateList ::= SEQUENCE { + * tbsCertList TBSCertList, + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING } + * + */ + +struct NSSPKIXCertificateListStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXTBSCertList *tbsCertList; + NSSPKIXAlgorithmIdentifier *signatureAlgorithm; + NSSItem *signature; +}; + +/* + * TBSCertList + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TBSCertList ::= SEQUENCE { + * version Version OPTIONAL, + * -- if present, shall be v2 + * signature AlgorithmIdentifier, + * issuer Name, + * thisUpdate Time, + * nextUpdate Time OPTIONAL, + * revokedCertificates SEQUENCE OF SEQUENCE { + * userCertificate CertificateSerialNumber, + * revocationDate Time, + * crlEntryExtensions Extensions OPTIONAL + * -- if present, shall be v2 + * } OPTIONAL, + * crlExtensions [0] Extensions OPTIONAL + * -- if present, shall be v2 -- } + * + */ + +struct NSSPKIXTBSCertListStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXVersion version; + NSSPKIXAlgorithmIdentifier *signature; + NSSPKIXName *issuer; + -time- thisUpdate; + -time- nextUpdate; + NSSPKIXrevokedCertificates *revokedCertificates; + NSSPKIXExtensions *crlExtensions; +}; + +/* + * revokedCertificates + * + * This is a "helper type" to simplify handling of TBSCertList objects. + * + * revokedCertificates SEQUENCE OF SEQUENCE { + * userCertificate CertificateSerialNumber, + * revocationDate Time, + * crlEntryExtensions Extensions OPTIONAL + * -- if present, shall be v2 + * } OPTIONAL, + * + */ + +struct NSSPKIXrevokedCertificatesStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * revokedCertificate + * + * This is a "helper type" to simplify handling of TBSCertList objects. + * + * SEQUENCE { + * userCertificate CertificateSerialNumber, + * revocationDate Time, + * crlEntryExtensions Extensions OPTIONAL + * -- if present, shall be v2 + * } OPTIONAL, + * + */ + +struct NSSPKIXrevokedCertificateStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXCertificateSerialNumber *userCertificate; + -time- revocationDate; + NSSPKIXExtensions *crlEntryExtensions; +}; + +/* + * AlgorithmIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * (1988 syntax) + * + * AlgorithmIdentifier ::= SEQUENCE { + * algorithm OBJECT IDENTIFIER, + * parameters ANY DEFINED BY algorithm OPTIONAL } + * -- contains a value of the type + * -- registered for use with the + * -- algorithm object identifier value + * + * + */ + +struct NSSPKIXAlgorithmIdentifierStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSBER *ber; + NSSOID *algorithm; + NSSItem *parameters; +}; + +/* + * -- types related to NSSPKIXAlgorithmIdentifiers: + * + * Dss-Sig-Value ::= SEQUENCE { + * r INTEGER, + * s INTEGER } + * + * DomainParameters ::= SEQUENCE { + * p INTEGER, -- odd prime, p=jq +1 + * g INTEGER, -- generator, g + * q INTEGER, -- factor of p-1 + * j INTEGER OPTIONAL, -- subgroup factor, j>= 2 + * validationParms ValidationParms OPTIONAL } + * + * ValidationParms ::= SEQUENCE { + * seed BIT STRING, + * pgenCounter INTEGER } + * + * Dss-Parms ::= SEQUENCE { + * p INTEGER, + * q INTEGER, + * g INTEGER } + * + */ + +/* + * ORAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ORAddress ::= SEQUENCE { + * built-in-standard-attributes BuiltInStandardAttributes, + * built-in-domain-defined-attributes + * BuiltInDomainDefinedAttributes OPTIONAL, + * -- see also teletex-domain-defined-attributes + * extension-attributes ExtensionAttributes OPTIONAL } + * -- The OR-address is semantically absent from the OR-name if the + * -- built-in-standard-attribute sequence is empty and the + * -- built-in-domain-defined-attributes and extension-attributes are + * -- both omitted. + * + */ + +struct NSSPKIXORAddressStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXBuiltInStandardAttributes *builtInStandardAttributes; + NSSPKIXBuiltInDomainDefinedAttributes *builtInDomainDefinedAttributes; + NSSPKIXExtensionsAttributes *extensionAttributes; +}; + +/* + * BuiltInStandardAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BuiltInStandardAttributes ::= SEQUENCE { + * country-name CountryName OPTIONAL, + * administration-domain-name AdministrationDomainName OPTIONAL, + * network-address [0] NetworkAddress OPTIONAL, + * -- see also extended-network-address + * terminal-identifier [1] TerminalIdentifier OPTIONAL, + * private-domain-name [2] PrivateDomainName OPTIONAL, + * organization-name [3] OrganizationName OPTIONAL, + * -- see also teletex-organization-name + * numeric-user-identifier [4] NumericUserIdentifier OPTIONAL, + * personal-name [5] PersonalName OPTIONAL, + * -- see also teletex-personal-name + * organizational-unit-names [6] OrganizationalUnitNames OPTIONAL + * -- see also teletex-organizational-unit-names -- } + * + */ + +struct NSSPKIXBuiltInStandardAttributesStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXCountryName *countryName; + NSSPKIXAdministrationDomainName *administrationDomainName; + NSSPKIXNetworkAddress *networkAddress; + NSSPKIXTerminalIdentifier *terminalIdentifier; + NSSPKIXPrivateDomainName *privateDomainName; + NSSPKIXOrganizationName *organizationName; + NSSPKIXNumericUserIdentifier *numericUserIdentifier; + NSSPKIXPersonalName *personalName; + NSSPKIXOrganizationalUnitNames *organizationalUnitNames; +}; + +/* + * PersonalName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PersonalName ::= SET { + * surname [0] PrintableString (SIZE (1..ub-surname-length)), + * given-name [1] PrintableString + * (SIZE (1..ub-given-name-length)) OPTIONAL, + * initials [2] PrintableString (SIZE (1..ub-initials-length)) OPTIONAL, + * generation-qualifier [3] PrintableString + * (SIZE (1..ub-generation-qualifier-length)) OPTIONAL } + * + */ + +struct NSSPKIXPersonalNameStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSUTF8 *surname; + NSSUTF8 *givenName; + NSSUTF8 *initials; + NSSUTF8 *generationQualifier; +}; + +/* + * OrganizationalUnitNames + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * OrganizationalUnitNames ::= SEQUENCE SIZE (1..ub-organizational-units) + * OF OrganizationalUnitName + * + */ + +struct NSSPKIXOrganizationalUnitNamesStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * BuiltInDomainDefinedAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BuiltInDomainDefinedAttributes ::= SEQUENCE SIZE + * (1..ub-domain-defined-attributes) OF + * BuiltInDomainDefinedAttribute + * + */ + +struct NSSPKIXBuiltInDomainDefinedAttributesStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * BuiltInDomainDefinedAttribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BuiltInDomainDefinedAttribute ::= SEQUENCE { + * type PrintableString (SIZE + * (1..ub-domain-defined-attribute-type-length)), + * value PrintableString (SIZE + * (1..ub-domain-defined-attribute-value-length))} + * + */ + +struct NSSPKIXBuiltInDomainDefinedAttributeStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSUTF8 *type; + NSSUTF8 *value; +}; + +/* + * ExtensionAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtensionAttributes ::= SET SIZE (1..ub-extension-attributes) OF + * ExtensionAttribute + * + */ + +struct NSSPKIXExtensionAttributesStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * ExtensionAttribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtensionAttribute ::= SEQUENCE { + * extension-attribute-type [0] INTEGER (0..ub-extension-attributes), + * extension-attribute-value [1] + * ANY DEFINED BY extension-attribute-type } + * + */ + +struct NSSPKIXExtensionAttributeStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXExtensionsAttributeType extensionAttributeType; + NSSItem *extensionAttributeValue; +}; + +/* + * TeletexPersonalName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexPersonalName ::= SET { + * surname [0] TeletexString (SIZE (1..ub-surname-length)), + * given-name [1] TeletexString + * (SIZE (1..ub-given-name-length)) OPTIONAL, + * initials [2] TeletexString (SIZE (1..ub-initials-length)) OPTIONAL, + * generation-qualifier [3] TeletexString (SIZE + * (1..ub-generation-qualifier-length)) OPTIONAL } + * + */ + +struct NSSPKIXTeletexPersonalNameStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSUTF8 *surname; + NSSUTF8 *givenName; + NSSUTF8 *initials; + NSSUTF8 *generationQualifier; +}; + +/* + * TeletexOrganizationalUnitNames + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexOrganizationalUnitNames ::= SEQUENCE SIZE + * (1..ub-organizational-units) OF TeletexOrganizationalUnitName + * + */ + +struct NSSPKIXTeletexOrganizationalUnitNamesStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * PDSParameter + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PDSParameter ::= SET { + * printable-string PrintableString + * (SIZE(1..ub-pds-parameter-length)) OPTIONAL, + * teletex-string TeletexString + * (SIZE(1..ub-pds-parameter-length)) OPTIONAL } + * + */ + +struct NSSPKIXPDSParameterStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSUTF8 *printableString; + NSSTUF8 *teletexString; +}; + +/* + * UnformattedPostalAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * UnformattedPostalAddress ::= SET { + * printable-address SEQUENCE SIZE (1..ub-pds-physical-address-lines) OF + * PrintableString (SIZE (1..ub-pds-parameter-length)) OPTIONAL, + * teletex-string TeletexString + * (SIZE (1..ub-unformatted-address-length)) OPTIONAL } + * + */ + +struct NSSPKIXUnformattedPostalAddressStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... + NSSUTF8 *teletexString; +}; + +/* + * ExtendedNetworkAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtendedNetworkAddress ::= CHOICE { + * e163-4-address SEQUENCE { + * number [0] NumericString (SIZE (1..ub-e163-4-number-length)), + * sub-address [1] NumericString + * (SIZE (1..ub-e163-4-sub-address-length)) OPTIONAL }, + * psap-address [0] PresentationAddress } + * + */ + +struct NSSPKIXExtendedNetworkAddressStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXExtendedNetworkAddressChoice choice; + union { + NSSe1634address *e1634Address; + NSSPKIXPresentationAddress *psapAddress; + } u; +}; + +/* + * e163-4-address + * + * Helper structure for ExtendedNetworkAddress. + * -- fgmr comments -- + * + * From RFC 2459: + * + * e163-4-address SEQUENCE { + * number [0] NumericString (SIZE (1..ub-e163-4-number-length)), + * sub-address [1] NumericString + * (SIZE (1..ub-e163-4-sub-address-length)) OPTIONAL }, + * + */ + +struct NSSe1634addressStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSUTF8 *number; + NSSUTF8 *subAddress; +}; + +/* + * PresentationAddress + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PresentationAddress ::= SEQUENCE { + * pSelector [0] EXPLICIT OCTET STRING OPTIONAL, + * sSelector [1] EXPLICIT OCTET STRING OPTIONAL, + * tSelector [2] EXPLICIT OCTET STRING OPTIONAL, + * nAddresses [3] EXPLICIT SET SIZE (1..MAX) OF OCTET STRING } + * + */ + +struct NSSPKIXPresentationAddressStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSItem *pSelector; + NSSItem *sSelector; + NSSItem *tSelector; + NSSItem *nAddresses[]; --fgmr-- +}; + +/* + * TeletexDomainDefinedAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexDomainDefinedAttributes ::= SEQUENCE SIZE + * (1..ub-domain-defined-attributes) OF TeletexDomainDefinedAttribute + * + */ + +struct NSSPKIXTeletexDomainDefinedAttributesStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * TeletexDomainDefinedAttribute + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * TeletexDomainDefinedAttribute ::= SEQUENCE { + * type TeletexString + * (SIZE (1..ub-domain-defined-attribute-type-length)), + * value TeletexString + * (SIZE (1..ub-domain-defined-attribute-value-length)) } + * + */ + +struct NSSPKIXTeletexDomainDefinedAttributeStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSUTF8 *type; + NSSUTF8 *value; +}; + +/* + * AuthorityKeyIdentifier + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AuthorityKeyIdentifier ::= SEQUENCE { + * keyIdentifier [0] KeyIdentifier OPTIONAL, + * authorityCertIssuer [1] GeneralNames OPTIONAL, + * authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL } + * -- authorityCertIssuer and authorityCertSerialNumber shall both + * -- be present or both be absent + * + */ + +struct NSSPKIXAuthorityKeyIdentifierStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXKeyIdentifier *keyIdentifier; + NSSPKIXGeneralNames *authorityCertIssuer; + NSSPKIXCertificateSerialNumber *authorityCertSerialNumber; +}; + +/* + * KeyUsage + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * KeyUsage ::= BIT STRING { + * digitalSignature (0), + * nonRepudiation (1), + * keyEncipherment (2), + * dataEncipherment (3), + * keyAgreement (4), + * keyCertSign (5), + * cRLSign (6), + * encipherOnly (7), + * decipherOnly (8) } + * + */ + +struct NSSPKIXKeyUsageStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXKeyUsageValue keyUsage; +}; + +/* + * PrivateKeyUsagePeriod + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PrivateKeyUsagePeriod ::= SEQUENCE { + * notBefore [0] GeneralizedTime OPTIONAL, + * notAfter [1] GeneralizedTime OPTIONAL } + * -- either notBefore or notAfter shall be present + * + */ + +struct NSSPKIXPrivateKeyUsagePeriodStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + --time-- + --time-- +}; + +/* + * CertificatePolicies + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CertificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation + * + */ + +struct NSSPKIXCertificatePoliciesStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * PolicyInformation + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyInformation ::= SEQUENCE { + * policyIdentifier CertPolicyId, + * policyQualifiers SEQUENCE SIZE (1..MAX) OF + * PolicyQualifierInfo OPTIONAL } + * + */ + +struct NSSPKIXPolicyInformationStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXCertPolicyId *policyIdentifier; + NSSPKIXPolicyQualifierInfo *policyQualifiers[]; + --fgmr-- +}; + +/* + * PolicyQualifierInfo + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyQualifierInfo ::= SEQUENCE { + * policyQualifierId PolicyQualifierId, + * qualifier ANY DEFINED BY policyQualifierId } + * + */ + +struct NSSPKIXPolicyQualifierInfoStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXPolicyQualifierId *policyQualifierId; + NSSItem *qualifier; +}; + +/* + * UserNotice + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * UserNotice ::= SEQUENCE { + * noticeRef NoticeReference OPTIONAL, + * explicitText DisplayText OPTIONAL} + * + */ + +struct NSSPKIXUserNoticeStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXNoticeReference *noticeRef; + NSSPKIXDisplayText *explicitText; +}; + +/* + * NoticeReference + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NoticeReference ::= SEQUENCE { + * organization DisplayText, + * noticeNumbers SEQUENCE OF INTEGER } + * + */ + +struct NSSPKIXNoticeReferenceStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXDisplayText *organization; + NSSItem *noticeNumbers[]; --fgmr-- + ... +}; + +/* + * PolicyMappings + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE { + * issuerDomainPolicy CertPolicyId, + * subjectDomainPolicy CertPolicyId } + * + */ + +struct NSSPKIXPolicyMappingsStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXpolicyMapping *policyMappings[]; --fgmr-- + ... +}; + +/* + * policyMapping + * + * Helper structure for PolicyMappings + * + * SEQUENCE { + * issuerDomainPolicy CertPolicyId, + * subjectDomainPolicy CertPolicyId } + * + */ + +struct NSSPKIXpolicyMappingStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXCertPolicyId *issuerDomainPolicy; + NSSPKIXCertPolicyId *subjectDomainPolicy; +}; + +/* + * GeneralName + * + * This structure contains a union of the possible general names, + * of which there are several. + * + * From RFC 2459: + * + * GeneralName ::= CHOICE { + * otherName [0] AnotherName, + * rfc822Name [1] IA5String, + * dNSName [2] IA5String, + * x400Address [3] ORAddress, + * directoryName [4] Name, + * ediPartyName [5] EDIPartyName, + * uniformResourceIdentifier [6] IA5String, + * iPAddress [7] OCTET STRING, + * registeredID [8] OBJECT IDENTIFIER } + * + */ + +struct NSSPKIXGeneralNameStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXGeneralNameChoice choice; + union { + NSSPKIXAnotherName *otherName; + NSSUTF8 *rfc822Name; + NSSUTF8 *dNSName; + NSSPKIXORAddress *x400Address; + NSSPKIXName *directoryName; + NSSEDIPartyName *ediPartyName; + NSSUTF8 *uniformResourceIdentifier; + NSSItem *iPAddress; + NSSOID *registeredID; + } u; +}; + +/* + * GeneralNames + * + * This structure contains a sequence of GeneralName objects. + * + * From RFC 2459: + * + * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName + * + */ + +struct NSSPKIXGeneralNamesStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * AnotherName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AnotherName ::= SEQUENCE { + * type-id OBJECT IDENTIFIER, + * value [0] EXPLICIT ANY DEFINED BY type-id } + * + */ + +struct NSSPKIXAnotherNameStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSOID *typeId; + NSSItem *value; +}; + +/* + * EDIPartyName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * + * EDIPartyName ::= SEQUENCE { + * nameAssigner [0] DirectoryString OPTIONAL, + * partyName [1] DirectoryString } + * + */ + +struct NSSPKIXEDIPartyNameStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXDirectoryString *nameAssigner; + NSSPKIXDirectoryString *partyname; +}; + +/* + * SubjectDirectoryAttributes + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * SubjectDirectoryAttributes ::= SEQUENCE SIZE (1..MAX) OF Attribute + * + */ + +struct NSSPKIXSubjectDirectoryAttributesStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * BasicConstraints + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * BasicConstraints ::= SEQUENCE { + * cA BOOLEAN DEFAULT FALSE, + * pathLenConstraint INTEGER (0..MAX) OPTIONAL } + * + */ + +struct NSSPKIXBasicConstraintsStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + PRBool cA; + PRInt32 pathLenConstraint; --fgmr-- +}; + +/* + * NameConstraints + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * NameConstraints ::= SEQUENCE { + * permittedSubtrees [0] GeneralSubtrees OPTIONAL, + * excludedSubtrees [1] GeneralSubtrees OPTIONAL } + * + */ + +struct NSSPKIXNameConstraintsStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXGeneralSubtrees *permittedSubtrees; + NSSPKIXGeneralSubtrees *excludedSubtrees; +}; + +/* + * GeneralSubtrees + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree + * + */ + +struct NSSPKIXGeneralSubtreesStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * GeneralSubtree + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * GeneralSubtree ::= SEQUENCE { + * base GeneralName, + * minimum [0] BaseDistance DEFAULT 0, + * maximum [1] BaseDistance OPTIONAL } + * + */ + +struct NSSPKIXGeneralSubtreeStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXGeneralName; + NSSPKIXBaseDistance minimum; + NSSPKIXBaseDistance maximum; +}; + +/* + * PolicyConstraints + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * PolicyConstraints ::= SEQUENCE { + * requireExplicitPolicy [0] SkipCerts OPTIONAL, + * inhibitPolicyMapping [1] SkipCerts OPTIONAL } + * + */ + +struct NSSPKIXPolicyConstraintsStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXSkipCerts *requireExplicitPolicy; + NSSPKIXSkipCerts *inhibitPolicyMapping; +}; + +/* + * CRLDistPointsSyntax + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * CRLDistPointsSyntax ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint + * + */ + +struct NSSPKIXCRLDistPointsSyntaxStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * DistributionPoint + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DistributionPoint ::= SEQUENCE { + * distributionPoint [0] DistributionPointName OPTIONAL, + * reasons [1] ReasonFlags OPTIONAL, + * cRLIssuer [2] GeneralNames OPTIONAL } + * + */ + +struct NSSPKIXDistributionPointStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXDistributionPointName *distributionPoint; + NSSPKIXReasonFlags *reasons; + NSSPKIXGeneralNames *cRLIssuer; +}; + +/* + * DistributionPointName + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * DistributionPointName ::= CHOICE { + * fullName [0] GeneralNames, + * nameRelativeToCRLIssuer [1] RelativeDistinguishedName } + * + */ + +struct NSSPKIXDistributionPointNameStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXDistributionPointNameChoice choice; + union { + NSSPKIXGeneralNames *fullName; + NSSPKIXRelativeDistinguishedName *nameRelativeToCRLIssuer; + } u; +}; + +/* + * ReasonFlags + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ReasonFlags ::= BIT STRING { + * unused (0), + * keyCompromise (1), + * cACompromise (2), + * affiliationChanged (3), + * superseded (4), + * cessationOfOperation (5), + * certificateHold (6) } + * + */ + +struct NSSPKIXReasonFlagsStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXReasonFlagsMask reasonFlags; +}; + +/* + * ExtKeyUsageSyntax + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId + * + */ + +struct NSSPKIXExtKeyUsageSyntaxStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * AuthorityInfoAccessSyntax + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AuthorityInfoAccessSyntax ::= + * SEQUENCE SIZE (1..MAX) OF AccessDescription + * + */ + +struct NSSPKIXAuthorityInfoAccessSyntaxStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + ... +}; + +/* + * AccessDescription + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * AccessDescription ::= SEQUENCE { + * accessMethod OBJECT IDENTIFIER, + * accessLocation GeneralName } + * + */ + +struct NSSPKIXAccessDescriptionStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSOID *accessMethod; + NSSPKIXGeneralName *accessLocation; +}; + +/* + * IssuingDistributionPoint + * + * -- fgmr comments -- + * + * From RFC 2459: + * + * IssuingDistributionPoint ::= SEQUENCE { + * distributionPoint [0] DistributionPointName OPTIONAL, + * onlyContainsUserCerts [1] BOOLEAN DEFAULT FALSE, + * onlyContainsCACerts [2] BOOLEAN DEFAULT FALSE, + * onlySomeReasons [3] ReasonFlags OPTIONAL, + * indirectCRL [4] BOOLEAN DEFAULT FALSE } + * + */ + +struct NSSPKIXIssuingDistributionPointStr { + NSSArena *arena; + PRBool i_allocated_arena; + NSSDER *der; + NSSPKIXDistributionPointName *distributionPoint; + PRBool onlyContainsUserCerts; + PRBool onlyContainsCACerts; + NSSPKIXReasonFlags onlySomeReasons; + PRBool indirectCRL; +}; + +PR_END_EXTERN_C + +#endif /* PKIXTM_H */ diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/Create.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/Create.c new file mode 100644 index 000000000..cf95b4e26 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/Create.c @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAlgorithmIdentifier_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_POINTER + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAlgorithmIdentifier * +NSSPKIXAlgorithmIdentifier_Create +( + NSSArena *arenaOpt, + NSSOID *algorithm, + NSSItem *parameters +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } + } + + if( PR_SUCCESS != nssOID_verifyPointer(algorithm) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } + + if( PR_SUCCESS != nssItem_verifyPointer(parameters) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXAlgorithmIdentifier_Create(arenaOpt, algorithm, parameters); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/Decode.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/Decode.c new file mode 100644 index 000000000..1e4e47b03 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/Decode.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAlgorithmIdentifier_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAlgorithmIdentifier * +NSSPKIXAlgorithmIdentifier_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXAlgorithmIdentifier_Decode(arenaOpt, ber); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/Destroy.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/Destroy.c new file mode 100644 index 000000000..f2a901151 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/Destroy.c @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAlgorithmIdentifier_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXAlgorithmIdentifier_Destroy +( + NSSPKIXAlgorithmIdentifier *algid +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXAlgorithmIdentifier_Destroy(algid); +} + diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/Duplicate.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/Duplicate.c new file mode 100644 index 000000000..186ab49bc --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/Duplicate.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAlgorithmIdentifier_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAlgorithmIdentifier * +NSSPKIXAlgorithmIdentifier_Duplicate +( + NSSPKIXAlgorithmIdentifier *algid, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXAlgorithmIdentifier_Duplicate(algid, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/Encode.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/Encode.c new file mode 100644 index 000000000..d390b3595 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/Encode.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAlgorithmIdentifier_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSBER * +NSSPKIXAlgorithmIdentifier_Encode +( + NSSPKIXAlgorithmIdentifier *algid, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXAlgorithmIdentifier_Encode(algid, encoding, rvOpt, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/Equal.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/Equal.c new file mode 100644 index 000000000..65c52a2ba --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/Equal.c @@ -0,0 +1,83 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAlgorithmIdentifier_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_IMPLEMENT PRBool +NSSPKIXAlgorithmIdentifier_Equal +( + NSSPKIXAlgorithmIdentifier *algid1, + NSSPKIXAlgorithmIdentifier *algid2, + PRStatus *statusOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; + } + + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; + } +#endif /* DEBUG */ + + return nssPKIXAlgorithmIdentifier_Equal(algid1, algid2, statusOpt); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/GetAlgorithm.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/GetAlgorithm.c new file mode 100644 index 000000000..be7493a66 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/GetAlgorithm.c @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAlgorithmIdentifier_GetAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSOID pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSOID * +NSSPKIXAlgorithmIdentifier_GetAlgorithm +( + NSSPKIXAlgorithmIdentifier *algid +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return (NSSOID *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXAlgorithmIdentifier_GetAlgorithm(algid); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/GetParameters.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/GetParameters.c new file mode 100644 index 000000000..e94622e23 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/GetParameters.c @@ -0,0 +1,80 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAlgorithmIdentifier_GetParameters + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSItem * +NSSPKIXAlgorithmIdentifier_GetParameters +( + NSSPKIXAlgorithmIdentifier *algid, + NSSItem *rvOpt, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return (NSSItem *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSItem *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXAlgorithmIdentifier_GetParameters(algid, rvOpt, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/MClear.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/MClear.c new file mode 100644 index 000000000..0797fbd49 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/MClear.c @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +/* + * nss_pkix_AlgorithmIdentifier_Clear + * + * Wipes out cached data. + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_AlgorithmIdentifier_Clear +( + NSSPKIXAlgorithmIdentifier *algid +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( (NSSBER *)NULL != algid->ber ) { + nss_ZFreeIf(algid->ber->data); + nss_ZFreeIf(algid->ber); + } + + if( (NSSDER *)NULL != algid->der ) { + nss_ZFreeIf(algid->der->data); + nss_ZFreeIf(algid->der); + } + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/PCreate.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/PCreate.c new file mode 100644 index 000000000..c527a6a56 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/PCreate.c @@ -0,0 +1,138 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAlgorithmIdentifier_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_POINTER + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAlgorithmIdentifier * +nssPKIXAlgorithmIdentifier_Create +( + NSSArena *arenaOpt, + NSSOID *algorithm, + NSSItem *parameters +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXAlgorithmIdentifier *rv = (NSSPKIXAlgorithmIdentifier *)NULL; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } + } + + if( PR_SUCCESS != nssOID_verifyPointer(algorithm) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } + + if( PR_SUCCESS != nssItem_verifyPointer(parameters) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXAlgorithmIdentifier); + if( (NSSPKIXAlgorithmIdentifier *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->algorithm = algorithm; + rv->parameters = nssItem_Duplicate(parameters, arena, (NSSItem *)NULL); + if( (NSSItem *)NULL == rv->parameters ) { + goto loser; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_AlgorithmIdentifier_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXAlgorithmIdentifier *)NULL; +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/PDecode.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/PDecode.c new file mode 100644 index 000000000..9713d34db --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/PDecode.c @@ -0,0 +1,137 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAlgorithmIdentifier_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAlgorithmIdentifier * +nssPKIXAlgorithmIdentifier_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXAlgorithmIdentifier *rv = (NSSPKIXAlgorithmIdentifier *)NULL; + PRStatus status; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXAlgorithmIdentifier); + if( (NSSPKIXAlgorithmIdentifier *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->ber = nssItem_Duplicate(ber, arena, (NSSItem *)NULL); + if( (NSSItem *)NULL == rv->ber ) { + goto loser; + } + + status = nssASN1_DecodeBER(arena, rv, nssPKIXAlgorithmIdentifier_template, ber); + if( PR_SUCCESS != status ) { + goto loser; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_AlgorithmIdentifier_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXAlgorithmIdentifier *)NULL; +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/PDestroy.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/PDestroy.c new file mode 100644 index 000000000..7ef4d1fe1 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/PDestroy.c @@ -0,0 +1,76 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAlgorithmIdentifier_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXAlgorithmIdentifier_Destroy +( + NSSPKIXAlgorithmIdentifier *algid +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + +#ifdef DEBUG + (void)nss_pkix_AlgorithmIdentifier_remove_pointer(algid); +#endif /* DEBUG */ + + if( PR_TRUE == algid->i_allocated_arena ) { + return nssArena_Destroy(algid->arena); + } + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/PDuplicate.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/PDuplicate.c new file mode 100644 index 000000000..ae3cf72b2 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/PDuplicate.c @@ -0,0 +1,144 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAlgorithmIdentifier_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAlgorithmIdentifier upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAlgorithmIdentifier * +nssPKIXAlgorithmIdentifier_Duplicate +( + NSSPKIXAlgorithmIdentifier *algid, + NSSArena *arenaOpt +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXAlgorithmIdentifier *rv = (NSSPKIXAlgorithmIdentifier *)NULL; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAlgorithmIdentifier *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXAlgorithmIdentifier); + if( (NSSPKIXAlgorithmIdentifier *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + + rv->ber = nssItem_Duplicate(algid->ber, arena, (NSSItem *)NULL); + if( (NSSItem *)NULL == rv->ber ) { + goto loser; + } + + rv->der = nssItem_Duplicate(algid->der, arena, (NSSItem *)NULL); + if( (NSSItem *)NULL == rv->der ) { + goto loser; + } + + rv->algorithm = algid->algorithm; + + rv->parameters = nssItem_Duplicate(algid->parameters, arena, (NSSItem *)NULL); + if( (NSSItem *)NULL == rv->parameters ) { + goto loser; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_AlgorithmIdentifier_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXAlgorithmIdentifier *)NULL; +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/PEncode.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/PEncode.c new file mode 100644 index 000000000..c9939350a --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/PEncode.c @@ -0,0 +1,117 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAlgorithmIdentifier_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSBER * +nssPKIXAlgorithmIdentifier_Encode +( + NSSPKIXAlgorithmIdentifier *algid, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* NSSDEBUG */ + + switch( encoding ) { + case NSSASN1BER: + if( (NSSBER *)NULL != algid->ber ) { + it = algid->ber; + goto done; + } + /*FALLTHROUGH*/ + case NSSASN1DER: + if( (NSSDER *)NULL != algid->der ) { + it = algid->der; + goto done; + } + break; + default: + nss_SetError(NSS_ERROR_UNSUPPORTED_ENCODING); + return (NSSBER *)NULL; + } + + it = nssASN1_EncodeItem(algid->arena, (NSSItem *)NULL, algid, + nssPKIXAlgorithmIdentifier_template, encoding); + if( (NSSBER *)NULL == it ) { + return (NSSBER *)NULL; + } + + switch( encoding ) { + case NSSASN1BER: + algid->ber = it; + break; + case NSSASN1DER: + algid->der = it; + break; + default: + PR_ASSERT(0); + break; + } + + done: + return nssItem_Duplicate(it, arenaOpt, rvOpt); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/PEqual.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/PEqual.c new file mode 100644 index 000000000..423dfdb74 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/PEqual.c @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAlgorithmIdentifier_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_IMPLEMENT PRBool +nssPKIXAlgorithmIdentifier_Equal +( + NSSPKIXAlgorithmIdentifier *algid1, + NSSPKIXAlgorithmIdentifier *algid2, + PRStatus *statusOpt +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; + } + + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; + } +#endif /* NSSDEBUG */ + + if( algid1->algorithm != algid2->algorithm ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_SUCCESS; + } + return PR_FALSE; + } + + return nssItem_Equal(algid1->parameters, algid2->parameters, statusOpt); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/PGetAlgorithm.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/PGetAlgorithm.c new file mode 100644 index 000000000..4c7c37b6e --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/PGetAlgorithm.c @@ -0,0 +1,69 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAlgorithmIdentifier_GetAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSOID pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSOID * +nssPKIXAlgorithmIdentifier_GetAlgorithm +( + NSSPKIXAlgorithmIdentifier *algid +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return (NSSOID *)NULL; + } +#endif /* NSSDEBUG */ + + return algid->algorithm; +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/PGetParameters.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/PGetParameters.c new file mode 100644 index 000000000..5d6f1decb --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/PGetParameters.c @@ -0,0 +1,78 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAlgorithmIdentifier_GetParameters + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSItem upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSItem * +nssPKIXAlgorithmIdentifier_GetParameters +( + NSSPKIXAlgorithmIdentifier *algid, + NSSItem *rvOpt, + NSSArena *arenaOpt +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return (NSSItem *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSItem *)NULL; + } + } +#endif /* NSSDEBUG */ + + return nssItem_Duplicate(algid->parameters, arenaOpt, rvOpt); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/PSetAlgorithm.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/PSetAlgorithm.c new file mode 100644 index 000000000..ccf9f23e2 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/PSetAlgorithm.c @@ -0,0 +1,75 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAlgorithmIdentifier_SetAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_OID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXAlgorithmIdentifier_SetAlgorithm +( + NSSPKIXAlgorithmIdentifier *algid, + NSSOID *algorithm +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssOID_verifyPointer(algorithm) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + algid->algorithm = algorithm; + return nss_pkix_AlgorithmIdentifier_Clear(algid); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/PSetParameters.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/PSetParameters.c new file mode 100644 index 000000000..d5a7e8424 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/PSetParameters.c @@ -0,0 +1,86 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAlgorithmIdentifier_SetParameters + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_POINTER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXAlgorithmIdentifier_SetParameters +( + NSSPKIXAlgorithmIdentifier *algid, + NSSItem *parameters +) +{ + NSSItem *prev; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssItem_verifyPointer(parameters) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + prev = algid->parameters; + + algid->parameters = nssItem_Duplicate(parameters, algid->arena, (NSSItem *)NULL); + if( (NSSItem *)NULL == algid->parameters ) { + algid->parameters = prev; + return PR_FAILURE; + } + + (void)nssItem_Destroy(prev); + return nss_pkix_AlgorithmIdentifier_Clear(algid); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/SetAlgorithm.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/SetAlgorithm.c new file mode 100644 index 000000000..d829643e0 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/SetAlgorithm.c @@ -0,0 +1,76 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAlgorithmIdentifier_SetAlgorithm + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_OID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXAlgorithmIdentifier_SetAlgorithm +( + NSSPKIXAlgorithmIdentifier *algid, + NSSOID *algorithm +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssOID_verifyPointer(algorithm) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXAlgorithmIdentifier_SetAlgorithm(algid, algorithm); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/SetParameters.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/SetParameters.c new file mode 100644 index 000000000..d751fb689 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/SetParameters.c @@ -0,0 +1,77 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAlgorithmIdentifier_SetParameters + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ALGORITHM_IDENTIFIER + * NSS_ERROR_INVALID_POINTER + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXAlgorithmIdentifier_SetParameters +( + NSSPKIXAlgorithmIdentifier *algid, + NSSItem *parameters +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAlgorithmIdentifier_verifyPointer(algid) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssItem_verifyPointer(parameters) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXAlgorithmIdentifier_SetParameters(algid, parameters); +} diff --git a/security/nss/lib/pkix/src/AlgorithmIdentifier/verifyPointer.c b/security/nss/lib/pkix/src/AlgorithmIdentifier/verifyPointer.c new file mode 100644 index 000000000..c9a9f8072 --- /dev/null +++ b/security/nss/lib/pkix/src/AlgorithmIdentifier/verifyPointer.c @@ -0,0 +1,182 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +#ifdef DEBUG + +extern const NSSError NSS_ERROR_INTERNAL_ERROR; + +static nssPointerTracker pkix_algid_pointer_tracker; + +/* + * nss_pkix_AlgorithmIdentifier_add_pointer + * + * This method is only present in debug builds. + * + * This module-private routine adds an NSSPKIXAlgorithmIdentifier pointer to + * the internal pointer-tracker. This routine should only be used + * by the NSSPKIX module. This routine returns a PRStatus value; + * upon error it will place an error on the error stack and return + * PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_AlgorithmIdentifier_add_pointer +( + const NSSPKIXAlgorithmIdentifier *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_algid_pointer_tracker); + if( PR_SUCCESS != rv ) { + return rv; + } + + rv = nssPointerTracker_add(&pkix_algid_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + NSSError e = NSS_GetError(); + if( NSS_ERROR_NO_MEMORY != e ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + + return rv; + } + + rv = nssArena_registerDestructor(p->arena, + nss_pkix_AlgorithmIdentifier_remove_pointer, p); + if( PR_SUCCESS != rv ) { + (void)nss_pkix_AlgorithmIdentifier_remove_pointer(p); + return rv; + } + + return rv; +} + +/* + * nss_pkix_AlgorithmIdentifier_remove_pointer + * + * This method is only present in debug builds. + * + * This module-private routine removes a valid NSSPKIXAlgorithmIdentifier + * pointer from the internal pointer-tracker. This routine should + * only be used by the NSSPKIX module. This routine returns a + * PRStatus value; upon error it will place an error on the error + * stack and return PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_AlgorithmIdentifier_remove_pointer +( + const NSSPKIXAlgorithmIdentifier *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_remove(&pkix_algid_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + + /* + * nssArena_deregisterDestructor(p->arena, + * nss_pkix_AlgorithmIdentifier_remove_pointer, p); + */ + + return rv; +} + +/* + * nssPKIXAlgorithmIdentifier_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXAlgorithmIdentifier + * 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_PKIX_ATTRIBUTE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_IMPLEMENT PRStatus +nssPKIXAlgorithmIdentifier_verifyPointer +( + NSSPKIXAlgorithmIdentifier *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_algid_pointer_tracker); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_ATTRIBUTE); + return PR_FAILURE; + } + + rv = nssPointerTracker_verify(&pkix_algid_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_ATTRIBUTE); + return PR_FAILURE; + } + + return PR_SUCCESS; +} + +#endif /* DEBUG */ + diff --git a/security/nss/lib/pkix/src/Attribute/AddValue.c b/security/nss/lib/pkix/src/Attribute/AddValue.c new file mode 100644 index 000000000..aad082c50 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/AddValue.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_AddValue + * + * This routine adds the specified attribute value to the set in + * the specified NSSPKIXAttribute. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXAttribute_AddValue +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeValue *value +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssItem_verifyPointer(value) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXAttribute_AddValue(attribute, value); +} + diff --git a/security/nss/lib/pkix/src/Attribute/Create.c b/security/nss/lib/pkix/src/Attribute/Create.c new file mode 100644 index 000000000..9fe406b2d --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/Create.c @@ -0,0 +1,141 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_Create + * + * This routine creates an NSSPKIXAttribute from specified components. + * This routine may return NULL upon error, in which case it will have + * created an error stack. If the optional arena argument is non-NULL, + * that arena will be used for the required memory. There must be at + * least one attribute value specified. The final argument must be + * NULL, to indicate the end of the set of attribute values. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_INSUFFICIENT_VALUES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXAttribute * +NSSPKIXAttribute_Create +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + NSSPKIXAttributeValue *value1, + ... +) +{ + va_list ap; + NSSPKIXAttribute *rv; + PRUint32 count; + + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } + + if( PR_SUCCESS != nssOID_verifyPointer(typeOid) ) { + return (NSSPKIXAttribute *)NULL; + } + + if( (NSSPKIXAttributeValue *)NULL == value1 ) { + nss_SetError(NSS_ERROR_INSUFFICIENT_VALUES); + return (NSSPKIXAttribute *)NULL; + } + + { + va_start(ap, typeOid); + + while( 1 ) { + NSSPKIXAttributeValue *v; + v = (NSSPKIXAttributeValue *)va_arg(ap, NSSPKIXAttributeValue *); + if( (NSSPKIXAttributeValue *)NULL == v ) { + break; + } + + if( PR_SUCCESS != nssItem_verifyPointer(v) ) { + va_end(ap); + return (NSSPKIXAttribute *)NULL; + } + } + + va_end(ap); + } +#endif /* DEBUG */ + + va_start(ap, typeOid); + + for( count = 0; ; count++ ) { + NSSPKIXAttributeValue *v; + v = (NSSPKIXAttributeValue *)va_arg(ap, NSSPKIXAttributeValue *); + if( (NSSPKIXAttributeValue *)NULL == v ) { + break; + } + +#ifdef PEDANTIC + if( count == 0xFFFFFFFF ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + va_end(ap); + return (NSSPKIXAttribute *)NULL; + } +#endif /* PEDANTIC */ + } + + va_end(ap); + + va_start(ap, typeOid); + rv = nss_pkix_Attribute_V_Create(arenaOpt, typeOid, count, ap); + va_end(ap); + + return rv; +} diff --git a/security/nss/lib/pkix/src/Attribute/CreateFromArray.c b/security/nss/lib/pkix/src/Attribute/CreateFromArray.c new file mode 100644 index 000000000..2928c3bcc --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/CreateFromArray.c @@ -0,0 +1,97 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_CreateFromArray + * + * This routine creates an NSSPKIXAttribute from specified components. + * This routine may return NULL upon error, in which case it will have + * created an error stack. If the optional arena argument is non-NULL, + * that arena will be used for the required memory. There must be at + * least one attribute value specified. The final argument must be + * NULL, to indicate the end of the set of attribute values. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXAttribute * +NSSPKIXAttribute_CreateFromArray +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + PRUint32 count, + NSSPKIXAttributeValue values[] +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } + + if( PR_SUCCESS != nssOID_verifyPointer(typeOid) ) { + return (NSSPKIXAttribute *)NULL; + } + + { + PRUint32 i; + + for( i = 0; i < count; i++ ) { + if( PR_SUCCESS != nssItem_verifyPointer(&values[i]) ) { + return (NSSPKIXAttribute *)NULL; + } + } + } +#endif /* DEBUG */ + + return nssPKIXAttribute_CreateFromArray(arenaOpt, typeOid, count, values); +} diff --git a/security/nss/lib/pkix/src/Attribute/Decode.c b/security/nss/lib/pkix/src/Attribute/Decode.c new file mode 100644 index 000000000..a16f195cd --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/Decode.c @@ -0,0 +1,84 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_Decode + * + * This routine creates an NSSPKIXAttribute by decoding a BER- + * or DER-encoded Attribute as defined in RFC 2459. This + * routine may return NULL upon error, in which case it will + * have created an error stack. If the optional arena argument + * is non-NULL, that arena will be used for the required memory. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXAttribute * +NSSPKIXAttribute_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXAttribute *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXAttribute_Decode(arenaOpt, ber); +} diff --git a/security/nss/lib/pkix/src/Attribute/Destroy.c b/security/nss/lib/pkix/src/Attribute/Destroy.c new file mode 100644 index 000000000..bd9454fca --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/Destroy.c @@ -0,0 +1,74 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_Destroy + * + * This routine destroys an NSSPKIXAttribute. It should be called on + * all such objects created without an arena. It does not need to be + * called for objects created with an arena, but it may be. This + * routine returns a PRStatus value. Upon error, it will create an + * error stack and return PR_FAILURE. + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +NSSPKIXAttribute_Destroy +( + NSSPKIXAttribute *attribute +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXAttribute_Destroy(attribute); +} diff --git a/security/nss/lib/pkix/src/Attribute/Duplicate.c b/security/nss/lib/pkix/src/Attribute/Duplicate.c new file mode 100644 index 000000000..146a49610 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/Duplicate.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_Duplicate + * + * This routine duplicates an NSSPKIXAttribute. {arenaOpt} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXAttribute * +NSSPKIXAttribute_Duplicate +( + NSSPKIXAttribute *attribute, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return (NSSPKIXAttribute *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXAttribute_Duplicate(attribute, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/Attribute/Encode.c b/security/nss/lib/pkix/src/Attribute/Encode.c new file mode 100644 index 000000000..179bd3d68 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/Encode.c @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_Encode + * + * This routine returns an ASN.1 encoding of the specified + * NSSPKIXAttribute. {usual rules about itemOpt and arenaOpt} + * This routine indicates an error (NSS_ERROR_INVALID_DATA) + * if there are no attribute values (i.e., the last one was removed). + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_DATA + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSBER * +NSSPKIXAttribute_Encode +( + NSSPKIXAttribute *attribute, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXAttribute_Encode(attribute, encoding, rvOpt, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/Attribute/Equal.c b/security/nss/lib/pkix/src/Attribute/Equal.c new file mode 100644 index 000000000..d91782aea --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/Equal.c @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_Equal + * + * This routine compares two NSSPKIXAttribute's for equality. + * It returns PR_TRUE if they are equal, PR_FALSE otherwise. + * This routine also returns PR_FALSE upon error; if you're + * that worried about it, check for an error stack. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_IMPLEMENT PRBool +NSSPKIXAttribute_Equal +( + NSSPKIXAttribute *one, + NSSPKIXAttribute *two, + PRStatus *statusOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(one) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + + return PR_FALSE; + } + + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(two) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + + return PR_FALSE; + } +#endif /* DEBUG */ + + return nssPKIXAttribute_Equal(one, two); +} diff --git a/security/nss/lib/pkix/src/Attribute/FindValue.c b/security/nss/lib/pkix/src/Attribute/FindValue.c new file mode 100644 index 000000000..ba725051f --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/FindValue.c @@ -0,0 +1,84 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_FindValue + * + * This routine searches the set of attribute values in the specified + * NSSPKIXAttribute for the provided data. If an exact match is found, + * then that value's index is returned. If an exact match is not + * found, -1 is returned. If there is more than one exact match, one + * index will be returned. {notes about unorderdness of SET, etc} + * If the index may not be represented as an integer, an error is + * indicated. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value + * The index of the specified attribute value upon success + * -1 upon failure. + */ + +NSS_IMPLEMENT PRInt32 +NSSPKIXAttribute_FindValue +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeValue *value +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssItem_verifyPointer(value) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXAttribute_FindValue(attribute, value); +} diff --git a/security/nss/lib/pkix/src/Attribute/GetType.c b/security/nss/lib/pkix/src/Attribute/GetType.c new file mode 100644 index 000000000..0bae2b988 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/GetType.c @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_GetType + * + * This routine returns the attribute type oid of the specified + * NSSPKIXAttribute. + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSPKIXAttributeType pointer upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXAttributeType * +NSSPKIXAttribute_GetType +( + NSSPKIXAttribute *attribute +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return (NSSPKIXAttributeType *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXAttribute_GetType(attribute); +} diff --git a/security/nss/lib/pkix/src/Attribute/GetValue.c b/security/nss/lib/pkix/src/Attribute/GetValue.c new file mode 100644 index 000000000..afce8d135 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/GetValue.c @@ -0,0 +1,86 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_GetValue + * + * This routine returns the i'th attribute value of the set of + * values in the specified NSSPKIXAttribute. Although the set + * is unordered, an arbitrary ordering will be maintained until + * the data in the attribute is changed. {usual comments about + * itemOpt and arenaOpt} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttributeValue upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeValue * +NSSPKIXAttribute_GetValue +( + NSSPKIXAttribute *attribute, + PRInt32 i, + NSSPKIXAttributeValue *itemOpt, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return (NSSPKIXAttributeValue *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttributeValue *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXAttribute_GetValue(attribute, i, itemOpt, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/Attribute/GetValueCount.c b/security/nss/lib/pkix/src/Attribute/GetValueCount.c new file mode 100644 index 000000000..0cdc36b60 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/GetValueCount.c @@ -0,0 +1,75 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_GetValueCount + * + * This routine returns the number of attribute values present in + * the specified NSSPKIXAttribute. This routine returns a PRInt32. + * Upon error, this routine returns -1. This routine indicates an + * error if the number of values cannot be expressed as a PRInt32. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_IMPLEMENT PRInt32 +NSSPKIXAttribute_GetValueCount +( + NSSPKIXAttribute *attribute +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return -1; + } +#endif /* DEBUG */ + + return nssPKIXAttribute_GetValueCount(attribute); +} + diff --git a/security/nss/lib/pkix/src/Attribute/GetValues.c b/security/nss/lib/pkix/src/Attribute/GetValues.c new file mode 100644 index 000000000..986af03d1 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/GetValues.c @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_GetValues + * + * This routine returns all of the attribute values in the specified + * NSSPKIXAttribute. If the optional pointer to an array of NSSItems + * is non-null, then that array will be used and returned; otherwise, + * an array will be allocated and returned. If the limit is nonzero + * (which is must be if the specified array is nonnull), then an + * error is indicated if it is smaller than the value count. + * {arenaOpt} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSItem's upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXAttributeValue * +NSSPKIXAttribute_GetValues +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeValue rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return (NSSPKIXAttributeValue *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyOpt(attribute) ) { + return (NSSPKIXAttributeValue *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXAttribute_GetValues(attribute, rvOpt, limit, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/Attribute/MClear.c b/security/nss/lib/pkix/src/Attribute/MClear.c new file mode 100644 index 000000000..6fb77ba7d --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/MClear.c @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nss_pkix_Attribute_Clear + * + * Wipes out cached data. + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_Attribute_Clear +( + NSSPKIXAttribute *a +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(a) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( (NSSBER *)NULL != a->ber ) { + nss_ZFreeIf(a->ber->data); + nss_ZFreeIf(a->ber); + } + + if( (NSSDER *)NULL != a->der ) { + nss_ZFreeIf(a->der->data); + nss_ZFreeIf(a->der); + } + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/Attribute/MCount.c b/security/nss/lib/pkix/src/Attribute/MCount.c new file mode 100644 index 000000000..abb0831cb --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/MCount.c @@ -0,0 +1,87 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +/* + * nss_pkix_Attribute_Count + * + * This module-private routine sets the valuesCount part of the + * NSSPKIXAttribute argument. It does no checking, and is intended + * only for use inside the NSSPKIXAttribute implementation itself. + * There is no error return. There is no return value. + */ + +NSS_IMPLEMENT void +nss_pkix_Attribute_Count +( + NSSPKIXAttribute *a +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(a) ) { + return; + } +#endif /* NSSDEBUG */ + + PR_ASSERT((nssASN1Item **)NULL != a->asn1values); + if( (nssASN1Item *)NULL == a->asn1values ) { + nss_SetError(NSS_ERROR_ASSERTION_FAILED); + return; + } + + if( 0 == a->valuesCount ) { + PRUint32 i; + for( i = 0; i < 0xFFFFFFFF; i++ ) { + if( (nssASN1Item *)NULL == a->asn1values[i] ) { + break; + } + } + +#ifdef PEDANTIC + if( 0xFFFFFFFF == i ) { + return; + } +#endif /* PEDANTIC */ + + a->valuesCount = i; + } + + return; +} diff --git a/security/nss/lib/pkix/src/Attribute/MVCreate.c b/security/nss/lib/pkix/src/Attribute/MVCreate.c new file mode 100644 index 000000000..1a54026d4 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/MVCreate.c @@ -0,0 +1,165 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +/* + * nss_pkix_Attribute_V_Create + * + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_INTERNAL_ERROR; + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXAttribute * +nss_pkix_Attribute_V_Create +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + PRUint32 count, + va_list ap +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXAttribute *rv = (NSSPKIXAttribute *)NULL; + PRStatus status; + PRUint32 i; + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXAttribute); + if( (NSSPKIXAttribute *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + + rv->type = typeOid; + { + NSSItem typeder; + NSSItem *x = nssOID_GetDEREncoding(rv->type, &typeder, arena); + if( (NSSItem *)NULL == x ) { + goto loser; + } + + rv->asn1type.size = typeder.size; + rv->asn1type.data = typeder.data; + } + + rv->valuesCount = count; + + rv->asn1values = nss_ZNEWARRAY(arena, nssASN1Item *, count); + if( (nssASN1Item **)NULL == rv->asn1values ) { + goto loser; + } + + for( i = 0; i < count; i++ ) { + NSSItem tmp; + NSSPKIXAttributeValue *v = (NSSPKIXAttributeValue *) + va_arg(ap, NSSPKIXAttributeValue *); + + rv->asn1values[i] = nss_ZNEW(arena, nssASN1Item); + if( (nssASN1Item *)NULL == rv->asn1values[i] ) { + goto loser; + } + + if( (NSSItem *)NULL == nssItem_Duplicate(v, arena, &tmp) ) { + goto loser; + } + + rv->asn1values[i].size = tmp.size; + rv->asn1values[i].data = tmp.data; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_Attribute_add_pointer(rv) ) { + goto loser; + } + + if( PR_SUCCESS != + nssArena_registerDestructor(arena, + nss_pkix_Attribute_remove_pointer, + rv) ) { + (void)nss_pkix_Attribute_remove_pointer(rv); + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXAttribute *)NULL; +} diff --git a/security/nss/lib/pkix/src/Attribute/PAddValue.c b/security/nss/lib/pkix/src/Attribute/PAddValue.c new file mode 100644 index 000000000..732845490 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PAddValue.c @@ -0,0 +1,140 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_AddValue + * + * This routine adds the specified attribute value to the set in + * the specified NSSPKIXAttribute. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXAttribute_AddValue +( + NSSPKIXAttribute *a, + NSSPKIXAttributeValue *value +) +{ + PRUint32 newcount; + nssASN1Item **new_asn1_items = (nssASN1Item **)NULL; + NSSItem tmp; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(a) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssItem_verifyPointer(value) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + PR_ASSERT((nssASN1Item **)NULL != a->asn1values); + if( (nssASN1Item **)NULL == a->asn1values ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + return PR_FAILURE; + } + + if( 0 == a->valuesCount ) { + PRUint32 i; + + for( i = 0; i < 0xFFFFFFFF; i++ ) { + if( (nssASN1Item *)NULL == a->asn1values[i] ) { + break; + } + } + +#ifdef PEDANTIC + if( 0xFFFFFFFF == i ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + /* Internal error is that we don't handle them this big */ + return PR_FAILURE; + } +#endif /* PEDANTIC */ + + a->valuesCount = i; + } + + newcount = a->valuesCount + 1; + /* Check newcount for a rollover. */ + + /* Remember that our asn1values array is NULL-terminated */ + new_asn1_items = (nssASN1Item **)nss_ZRealloc(a->asn1values, + ((newcount+1) * sizeof(nssASN1Item *))); + if( (nssASN1Item **)NULL == new_asn1_items ) { + goto loser; + } + + new_asn1_items[ a->valuesCount ] = nss_ZNEW(a->arena, nssASN1Item); + if( (nssASN1Item *)NULL == new_asn1_items[ a->valuesCount ] ) { + goto loser; + } + + if( (NSSItem *)NULL == nssItem_Duplicate(value, a->arena, &tmp) ) { + goto loser; + } + + new_asn1_items[ a->valuesCount ]->size = tmp.size; + new_asn1_items[ a->valuesCount ]->data = tmp.data; + + a->valuesCount++; + a->asn1values = new_asn1_items; + + return nss_pkix_Attribute_Clear(a); + + loser: + if( (nssASN1Item **)NULL != new_asn1_items ) { + nss_ZFreeIf(new_asn1_items[ newcount-1 ]); + /* We could realloc back down, but we actually know it's a no-op */ + a->asn1values = new_asn1_items; + } + + return PR_FAILURE; +} diff --git a/security/nss/lib/pkix/src/Attribute/PCreate.c b/security/nss/lib/pkix/src/Attribute/PCreate.c new file mode 100644 index 000000000..40dc5c07c --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PCreate.c @@ -0,0 +1,139 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_Create + * + * This routine creates an NSSPKIXAttribute from specified components. + * This routine may return NULL upon error, in which case it will have + * created an error stack. If the optional arena argument is non-NULL, + * that arena will be used for the required memory. There must be at + * least one attribute value specified. The final argument must be + * NULL, to indicate the end of the set of attribute values. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_INSUFFICIENT_VALUES + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXAttribute * +nssPKIXAttribute_Create +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + NSSPKIXAttributeValue *value1, + ... +) +{ + va_list ap; + NSSPKIXAttribute *rv; + PRUint32 count; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } + + if( PR_SUCCESS != nssOID_verifyPointer(typeOid) ) { + return (NSSPKIXAttribute *)NULL; + } + + if( (NSSPKIXAttributeValue *)NULL == value1 ) { + nss_SetError(NSS_ERROR_INSUFFICIENT_VALUES); + return (NSSPKIXAttribute *)NULL; + } + + { + va_start(ap, typeOid); + + while( 1 ) { + NSSPKIXAttributeValue *v; + v = (NSSPKIXAttributeValue *)va_arg(ap, NSSPKIXAttributeValue *); + if( (NSSPKIXAttributeValue *)NULL == v ) { + break; + } + + if( PR_SUCCESS != nssItem_verifyPointer(v) ) { + va_end(ap); + return (NSSPKIXAttribute *)NULL; + } + } + + va_end(ap); + } +#endif /* NSSDEBUG */ + + va_start(ap, typeOid); + + for( count = 0; ; count++ ) { + NSSPKIXAttributeValue *v; + v = (NSSPKIXAttributeValue *)va_arg(ap, NSSPKIXAttributeValue *); + if( (NSSPKIXAttributeValue *)NULL == v ) { + break; + } + +#ifdef PEDANTIC + if( count == 0xFFFFFFFF ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + va_end(ap); + return (NSSPKIXAttribute *)NULL; + } +#endif /* PEDANTIC */ + } + + va_end(ap); + + va_start(ap, typeOid); + rv = nss_pkix_Attribute_V_Create(arenaOpt, typeOid, count, ap); + va_end(ap); + + return rv; +} diff --git a/security/nss/lib/pkix/src/Attribute/PCreateFromArray.c b/security/nss/lib/pkix/src/Attribute/PCreateFromArray.c new file mode 100644 index 000000000..c2d301d12 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PCreateFromArray.c @@ -0,0 +1,191 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifndef ASN1_H +#include "asn1.h" +#endif /* ASN1_H */ + +/* + * nssPKIXAttribute_CreateFromArray + * + * This routine creates an NSSPKIXAttribute from specified components. + * This routine may return NULL upon error, in which case it will have + * created an error stack. If the optional arena argument is non-NULL, + * that arena will be used for the required memory. There must be at + * least one attribute value specified. The final argument must be + * NULL, to indicate the end of the set of attribute values. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXAttribute * +nssPKIXAttribute_CreateFromArray +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + PRUint32 count, + NSSPKIXAttributeValue values[] +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXAttribute *rv = (NSSPKIXAttribute *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } + + if( PR_SUCCESS != nssOID_verifyPointer(typeOid) ) { + return (NSSPKIXAttribute *)NULL; + } + + for( i = 0; i < count; i++ ) { + if( PR_SUCCESS != nssItem_verifyPointer(&values[i]) ) { + return (NSSPKIXAttribute *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXAttribute); + if( (NSSPKIXAttribute *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + + rv->type = typeOid; + { + NSSItem typeder; + NSSItem *x = nssOID_GetDEREncoding(rv->type, &typeder, arena); + if( (NSSItem *)NULL == x ) { + goto loser; + } + + rv->asn1type.size = typeder.size; + rv->asn1type.data = typeder.data; + } + + rv->valuesCount = count; + + rv->asn1values = nss_ZNEWARRAY(arena, nssASN1Item *, count); + if( (nssASN1Item **)NULL == rv->asn1values ) { + goto loser; + } + + for( i = 0; i < count; i++ ) { + NSSItem tmp; + NSSPKIXAttributeValue *v = &values[i]; + + rv->asn1values[i] = nss_ZNEW(arena, nssASN1Item); + if( (nssASN1Item *)NULL == rv->asn1values[i] ) { + goto loser; + } + + if( (NSSItem *)NULL == nssItem_Duplicate(v, arena, &tmp) ) { + goto loser; + } + + rv->asn1values[i].size = tmp.size; + rv->asn1values[i].data = tmp.data; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_Attribute_add_pointer(rv) ) { + goto loser; + } + + if( PR_SUCCESS != + nssArena_registerDestructor(arena, + nss_pkix_Attribute_remove_pointer, + rv) ) { + (void)nss_pkix_Attribute_remove_pointer(rv); + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXAttribute *)NULL; +} diff --git a/security/nss/lib/pkix/src/Attribute/PDecode.c b/security/nss/lib/pkix/src/Attribute/PDecode.c new file mode 100644 index 000000000..49a059404 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PDecode.c @@ -0,0 +1,153 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifndef ASN1_H +#include "asn1.h" +#endif /* ASN1_H */ + +/* + * nssPKIXAttribute_Decode + * + * This routine creates an NSSPKIXAttribute by decoding a BER- + * or DER-encoded Attribute as defined in RFC 2459. This + * routine may return NULL upon error, in which case it will + * have created an error stack. If the optional arena argument + * is non-NULL, that arena will be used for the required memory. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXAttribute * +nssPKIXAttribute_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXAttribute *rv = (NSSPKIXAttribute *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXAttribute *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXAttribute); + if( (NSSPKIXAttribute *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->ber = nssItem_Duplicate(ber, arena, (NSSItem *)NULL); + if( (NSSItem *)NULL == rv->ber ) { + goto loser; + } + + status = nssASN1_DecodeBER(arena, rv, nssPKIXAttribute_template, ber); + if( PR_SUCCESS != status ) { + goto loser; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_Attribute_add_pointer(rv) ) { + goto loser; + } + + if( PR_SUCCESS != nssArena_registerDestructor(arena, + nss_pkix_Attribute_remove_pointer, rv) ) { + (void)nss_pkix_Attribute_remove_pointer(rv); + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXAttribute *)NULL; +} diff --git a/security/nss/lib/pkix/src/Attribute/PDestroy.c b/security/nss/lib/pkix/src/Attribute/PDestroy.c new file mode 100644 index 000000000..5f2b5a135 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PDestroy.c @@ -0,0 +1,82 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_Destroy + * + * This routine destroys an NSSPKIXAttribute. It should be called on + * all such objects created without an arena. It does not need to be + * called for objects created with an arena, but it may be. This + * routine returns a PRStatus value. Upon error, it place an error on + * the error stack and return PR_FAILURE. + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXAttribute_Destroy +( + NSSPKIXAttribute *attribute +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + +#ifdef DEBUG + (void)nss_pkix_Attribute_remove_pointer(attribute); + (void)nssArena_RemoveDestructor(arena, nss_pkix_Attribute_remove_pointer, + attribute); +#endif /* DEBUG */ + + if( PR_TRUE == attribute->i_allocated_arena ) { + return nssArena_Destroy(attribute->arena); + } + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/Attribute/PDuplicate.c b/security/nss/lib/pkix/src/Attribute/PDuplicate.c new file mode 100644 index 000000000..765510e59 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PDuplicate.c @@ -0,0 +1,189 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_Duplicate + * + * This routine duplicates an NSSPKIXAttribute. {arenaOpt} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAttribute upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXAttribute * +nssPKIXAttribute_Duplicate +( + NSSPKIXAttribute *attribute, + NSSArena *arenaOpt +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXAttribute *rv = (NSSPKIXAttribute *)NULL; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return PR_FAILURE; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return PR_FAILURE; + } + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXAttribute); + if( (NSSPKIXAttribute *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + + if( (NSSBER *)NULL != attribute->ber ) { + rv->ber = nssItem_Duplicate(arena, attribute->ber, (NSSItem *)NULL); + if( (NSSBER *)NULL == rv->ber ) { + goto loser; + } + } + + if( (NSSDER *)NULL != attribute->der ) { + rv->der = nssItem_Duplicate(arena, attribute->der, (NSSItem *)NULL); + if( (NSSDER *)NULL == rv->der ) { + goto loser; + } + } + + if( (void *)NULL != attribute->asn1type.data ) { + rv->asn1type.size = attribute->asn1type.size; + rv->asn1type.data = nss_ZAlloc(arena, attribute->asn1type.size); + if( (void *)NULL == rv->asn1type.data ) { + goto loser; + } + (void)nsslibc_memcpy(rv->asn1type.data, attribute->asn1type.data, + rv->asn1type.size); + } + + if( (nssASN1Item **)NULL != attribute->asn1values ) { + rv->asn1values = nss_ZNEWARRAY(arena, nssASN1Item *, attribute->valuesCount); + if( (nssASN1Item **)NULL == rv->asn1values ) { + goto loser; + } + + for( i = 0; i < attribute->valuesCount; i++ ) { + nssASN1Item *src; + nssASN1Item *dst; + + src = attribute->asn1values[i]; + dst = nss_ZNEW(arena, nssASN1Item); + if( (nssASN1Item *)NULL == dst ) { + goto loser; + } + + rv->asn1values[i] = dst; + + dst->size = src->size; + dst->data = nss_ZAlloc(arena, dst->size); + if( (void *)NULL == dst->data ) { + goto loser; + } + (void)nsslibc_memcpy(dst->data, src->data, src->size); + } + } + + rv->type = attribute->type; /* NULL or otherwise */ + rv->valuescount = attribute->valuesCount; + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_Attribute_add_pointer(rv) ) { + goto loser; + } + + if( PR_SUCCESS != + nssArena_registerDestructor(arena, + nss_pkix_Attribute_remove_pointer, + rv) ) { + (void)nss_pkix_Attribute_remove_pointer(rv); + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXAttribute *)NULL; +} diff --git a/security/nss/lib/pkix/src/Attribute/PEncode.c b/security/nss/lib/pkix/src/Attribute/PEncode.c new file mode 100644 index 000000000..7fc647ed2 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PEncode.c @@ -0,0 +1,126 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifndef ASN1_H +#include "asn1.h" +#endif /* ASN1_H */ + +/* + * nssPKIXAttribute_Encode + * + * This routine returns an ASN.1 encoding of the specified + * NSSPKIXAttribute. {usual rules about itemOpt and arenaOpt} + * This routine indicates an error (NSS_ERROR_INVALID_DATA) + * if there are no attribute values (i.e., the last one was removed). + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_DATA + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSBER * +nssPKIXAttribute_Encode +( + NSSPKIXAttribute *a, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + NSSBER *it; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(a) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* NSSDEBUG */ + + switch( encoding ) { + case NSSASN1BER: + if( (NSSBER *)NULL != a->ber ) { + it = a->ber; + goto done; + } + /*FALLTHROUGH*/ + case NSSASN1DER: + if( (NSSDER *)NULL != a->der ) { + it = a->der; + goto done; + } + break; + default: + nss_SetError(NSS_ERROR_UNSUPPORTED_ENCODING); + return (NSSBER *)NULL; + } + + it = nssASN1_EncodeItem(a->arena, (NSSItem *)NULL, a, + nssPKIXAttribute_template, encoding); + if( (NSSBER *)NULL == it ) { + return (NSSBER *)NULL; + } + + switch( encoding ) { + case NSSASN1BER: + a->ber = it; + break; + case NSSASN1DER: + a->der = it; + break; + default: + PR_ASSERT(0); + break; + } + + done: + return nssItem_Duplicate(it, arenaOpt, rvOpt); +} diff --git a/security/nss/lib/pkix/src/Attribute/PEqual.c b/security/nss/lib/pkix/src/Attribute/PEqual.c new file mode 100644 index 000000000..247bfd575 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PEqual.c @@ -0,0 +1,164 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_Equal + * + * This routine compares two NSSPKIXAttribute's for equality. + * It returns PR_TRUE if they are equal, PR_FALSE otherwise. + * This routine also returns PR_FALSE upon error; if you're + * that worried about it, check for an error stack. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_IMPLEMENT PRBool +nssPKIXAttribute_Equal +( + NSSPKIXAttribute *one, + NSSPKIXAttribute *two, + PRStatus *statusOpt +) +{ + PRStatus dummyStatus = PR_SUCCESS; /* quiet warnings */ + PRStatus *status; + PRUint32 i; + + if( (PRStatus *)NULL != statusOpt ) { + status = statusOpt; + *status = PR_SUCCESS; + } else { + status = &dummyStatus; + } + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(one) ) { + *status = PR_FAILURE; + return PR_FALSE; + } + + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(two) ) { + *status = PR_FAILURE; + return PR_FALSE; + } +#endif /* NSSDEBUG */ + + if( ((NSSDER *)NULL != one->der) && ((NSSDER *)NULL != two->der) ) { + return nssItem_Equal(one->der, two->der, statusOpt); + } + + if( (NSSPKIXAttributeType *)NULL == one->type ) { + NSSItem berOid; + berOid.size = one->asn1type.size; + berOid.data = one->asn1type.data; + one->type = (NSSPKIXAttributeType *)NSSOID_CreateFromBER(&berOid); + } + + if( (NSSPKIXAttributeType *)NULL == two->type ) { + NSSItem berOid; + berOid.size = two->asn1type.size; + berOid.data = two->asn1type.data; + two->type = (NSSPKIXAttributeType *)NSSOID_CreateFromBER(&berOid); + } + + if( one->type != two->type ) { + return PR_FALSE; + } + + if( 0 == one->valuesCount ) { + nss_pkix_Attribute_Count(one); + } + +#ifdef PEDANTIC + if( 0 == one->valuesCount ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + *statusOpt = PR_FAILURE; + return PR_FALSE; + } +#endif /* PEDANTIC */ + + if( 0 == two->valuesCount ) { + nss_pkix_Attribute_Count(two); + } + +#ifdef PEDANTIC + if( 0 == two->valuesCount ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + *statusOpt = PR_FAILURE; + return PR_FALSE; + } +#endif /* PEDANTIC */ + + if( one->valuesCount != two->valuesCount ) { + return PR_FALSE; + } + + *status = nss_pkix_Attribute_Distinguish(one); + if( PR_FAILURE == *status ) { + return PR_FALSE; + } + + *status = nss_pkix_Attribute_Distinguish(two); + if( PR_FAILURE == *status ) { + return PR_FALSE; + } + + for( i == 0; i < one->valuesCount; i++ ) { + NSSItem onetmp, twotmp; + + onetmp.size = one->asn1values[i]->size; + onetmp.data = one->asn1values[i]->data; + twotmp.size = two->asn1values[i]->size; + twotmp.data = two->asn1values[i]->data; + + if( PR_FALSE == nssItem_Equal(&one, &two, statusOpt) ) { + return PR_FALSE; + } + } + + return PR_TRUE; +} diff --git a/security/nss/lib/pkix/src/Attribute/PFindValue.c b/security/nss/lib/pkix/src/Attribute/PFindValue.c new file mode 100644 index 000000000..0f1095f0c --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PFindValue.c @@ -0,0 +1,107 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_FindValue + * + * This routine searches the set of attribute values in the specified + * NSSPKIXAttribute for the provided data. If an exact match is found, + * then that value's index is returned. If an exact match is not + * found, -1 is returned. If there is more than one exact match, one + * index will be returned. {notes about unorderdness of SET, etc} + * If the index may not be represented as an integer, an error is + * indicated. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value + * The index of the specified attribute value upon success + * -1 upon failure. + */ + +NSS_IMPLEMENT PRInt32 +nssPKIXAttribute_FindValue +( + NSSPKIXAttribute *a, + NSSPKIXAttributeValue *attributeValue +) +{ + PRUint32 i; + nssASN1Item **a; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(a) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssItem_verifyPointer(value) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + PR_ASSERT((nssASN1Item **)NULL != a->asn1values); + if( (nssASN1Item **)NULL == a->asn1values ) { + nss_SetError(NSS_ERROR_ASSERTION_FAILED); + return -1; + } + + for( i = 0, a = &a->asn1values[0]; *a; a++, (i > 0x7fffffff) || i++ ) { + NSSItem tmp; + + tmp.size = (*a)->size; + tmp.data = (*a)->data; + + if( PR_TRUE == nssItem_Equal(attributeValue, &tmp, (PRStatus *)NULL) ) { + if( i > 0x7fffffff ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return -1; + } + return (PRInt32)i; + } + } + + nss_SetError(NSS_ERROR_NOT_FOUND); + return -1; +} diff --git a/security/nss/lib/pkix/src/Attribute/PGetType.c b/security/nss/lib/pkix/src/Attribute/PGetType.c new file mode 100644 index 000000000..4b61431b8 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PGetType.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_GetType + * + * This routine returns the attribute type oid of the specified + * NSSPKIXAttribute. + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSPKIXAttributeType pointer upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXAttributeType * +nssPKIXAttribute_GetType +( + NSSPKIXAttribute *a +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(a) ) { + return (NSSPKIXAttributeType *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSPKIXAttributeType *)NULL == a->type ) { + NSSItem ber; + + ber.size = a->asn1type.size; + ber.data = a->asn1type.data; + + a->type = (NSSPKIXAttributeType *)NSSOID_CreateFromBER(&ber); + } + + return a->type; +} diff --git a/security/nss/lib/pkix/src/Attribute/PGetValue.c b/security/nss/lib/pkix/src/Attribute/PGetValue.c new file mode 100644 index 000000000..bbf12ca67 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PGetValue.c @@ -0,0 +1,98 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_GetValue + * + * This routine returns the i'th attribute value of the set of + * values in the specified NSSPKIXAttribute. Although the set + * is unordered, an arbitrary ordering will be maintained until + * the data in the attribute is changed. {usual comments about + * itemOpt and arenaOpt} [0,valueCount) + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttributeValue upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeValue * +nssPKIXAttribute_GetValue +( + NSSPKIXAttribute *attribute, + PRInt32 i, + NSSPKIXAttributeValue *itemOpt, + NSSArena *arenaOpt +) +{ + NSSItem tmp; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return (NSSPKIXAttributeValue *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttributeValue *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( 0 == attribute->valuesCount ) { + nss_pkix_Attribute_Count(attribute); + } + + if( (i < 0) || (i >= attribute->valuesCount) ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXAttributeValue *)NULL; + } + + tmp.size = attribute->asn1values[i]->size; + tmp.data = attribute->asn1values[i]->data; + + return nssItem_Duplicate(&tmp, arenaOpt, itemOpt); +} diff --git a/security/nss/lib/pkix/src/Attribute/PGetValueCount.c b/security/nss/lib/pkix/src/Attribute/PGetValueCount.c new file mode 100644 index 000000000..ada1d403d --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PGetValueCount.c @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_GetValueCount + * + * This routine returns the number of attribute values present in + * the specified NSSPKIXAttribute. This routine returns a PRInt32. + * Upon error, this routine returns -1. This routine indicates an + * error if the number of values cannot be expressed as a PRInt32. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_IMPLEMENT PRInt32 +nssPKIXAttribute_GetValueCount +( + NSSPKIXAttribute *attribute +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return -1; + } +#endif /* NSSDEBUG */ + + if( 0 == attribute->valuesCount ) { + nss_pkix_Attribute_Count(attribute); + } + +#ifdef PEDANTIC + if( 0 == attribute->valuesCount ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return -1; + } +#endif /* PEDANTIC */ + + if( attribute->valuesCount > 0x7fffffff ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return -1; + } + + return (PRInt32)(attribute->valuesCount); +} diff --git a/security/nss/lib/pkix/src/Attribute/PGetValues.c b/security/nss/lib/pkix/src/Attribute/PGetValues.c new file mode 100644 index 000000000..ccc11dbe0 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PGetValues.c @@ -0,0 +1,145 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_GetValues + * + * This routine returns all of the attribute values in the specified + * NSSPKIXAttribute. If the optional pointer to an array of NSSItems + * is non-null, then that array will be used and returned; otherwise, + * an array will be allocated and returned. If the limit is nonzero + * (which is must be if the specified array is nonnull), then an + * error is indicated if it is smaller than the value count. + * {arenaOpt} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSItem's upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXAttributeValue * +nssPKIXAttribute_GetValues +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeValue rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +) +{ + NSSPKIXAttributeValue *rv = (NSSPKIXAttributeValue *)NULL; + PRUint32 i; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return (NSSPKIXAttributeValue *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyOpt(attribute) ) { + return (NSSPKIXAttributeValue *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( 0 == attribute->valuesCount ) { + nss_pkix_Attribute_Count(attribute); + } + +#ifdef PEDANTIC + if( 0 == attribute->valuesCount ) { + if( 0 == limit ) { + nss_SetError(NSS_ERROR_NO_MEMORY); + } else { + nss_SetError(NSS_ERROR_ARRAY_TOO_SMALL); + } + return (NSSPKIXAttributeValue *)NULL; + } +#endif /* PEDANTIC */ + + if( (limit < attribute->valuesCount) && + !((0 == limit) && ((NSSPKIXAttributeValue *)NULL == rvOpt)) ) { + nss_SetError(NSS_ERROR_ARRAY_TOO_SMALL); + return (NSSPKIXAttributeValue *)NULL; + } + + limit = attribute->valuesCount; + if( (NSSPKIXAttributeValue *)NULL == rvOpt ) { + rv = nss_ZNEWARRAY(arenaOpt, NSSPKIXAttributeValue, limit); + if( (NSSPKIXAttributeValue *)NULL == rv ) { + return (NSSPKIXAttributeValue *)NULL; + } + } else { + rv = rvOpt; + } + + for( i = 0; i < limit; i++ ) { + NSSAttributeValue tmp; + nssASN1Item *p = attribute->asn1values[i]; + NSSAttributeValue *r = &rv[i]; + + tmp.size = p->size; + tmp.data = p->data; + + if( (NSSItem *)NULL == nssItem_Duplicate(&tmp, arenaOpt, r) ) { + goto loser; + } + } + + return rv; + + loser: + for( i = 0; i < limit; i++ ) { + NSSAttributeValue *r = &rv[i]; + nss_ZFreeIf(r->data); + } + + if( rv != rvOpt ) { + nss_ZFreeIf(rv); + } + + return (NSSAttributeValue *)NULL; +} diff --git a/security/nss/lib/pkix/src/Attribute/PRemoveValue.c b/security/nss/lib/pkix/src/Attribute/PRemoveValue.c new file mode 100644 index 000000000..6da2ebc07 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PRemoveValue.c @@ -0,0 +1,121 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_RemoveValue + * + * This routine removes the i'th attribute value of the set in the + * specified NSSPKIXAttribute. An attempt to remove the last value + * will fail. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_AT_MINIMUM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +PR_IMPLEMENET(PRStatus) +nssPKIXAttribute_RemoveValue +( + NSSPKIXAttribute *a, + PRInt32 i +) +{ + nssASN1Item **ip; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(a) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( 0 == a->valuesCount ) { + nss_pkix_Attribute_Count(a); + } + + if( i < 0 ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } + + if( 1 == a->valuesCount ) { + nss_SetError(NSS_ERROR_AT_MINIMUM); + return PR_FAILURE; + } + +#ifdef PEDANTIC + if( 0 == a->valuesCount ) { + /* Too big.. but we can still remove one */ + nss_ZFreeIf(a->asn1values[i].data); + for( ip = &a->asn1values[i]; *ip; ip++ ) { + ip[0] = ip[1]; + } + } else +#endif /* PEDANTIC */ + + { + nssASN1Item *si; + PRUint32 end; + + if( i >= a->valueCount ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } + + end = a->valuesCount - 1; + + si = a->asn1values[i]; + a->asn1values[i] = a->asn1values[ end ]; + a->asn1values[ end ] = (nssASN1Item *)NULL; + + nss_ZFreeIf(si->data); + nss_ZFreeIf(si); + + /* We could realloc down, but we know it's a no-op */ + a->valuesCount = end; + } + + return nss_pkix_Attribute_Clear(a); +} diff --git a/security/nss/lib/pkix/src/Attribute/PSetType.c b/security/nss/lib/pkix/src/Attribute/PSetType.c new file mode 100644 index 000000000..8f430aab3 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PSetType.c @@ -0,0 +1,90 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_SetType + * + * This routine sets the attribute type oid of the indicated + * NSSPKIXAttribute to the specified value. Since attributes + * may be application-defined, no checking can be done on + * either the correctness of the attribute type oid value nor + * the suitability of the set of attribute values. + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_OID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXAttribute_SetType +( + NSSPKIXAttribute *a, + NSSPKIXAttributeType *attributeType +) +{ + NSSDER tmp; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(a) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssOID_verifyPointer(attributeType) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + a->type = attributeType; + + nss_ZFreeIf(a->asn1type.data); + if( (NSSDER *)NULL == nssOID_GetDEREncoding(a->type, &tmp, a->arena) ) { + return PR_FAILURE; + } + + a->asn1type.size = tmp.size; + a->asn1type.data = tmp.data; + + return nss_pkix_Attribute_Clear(a); +} diff --git a/security/nss/lib/pkix/src/Attribute/PSetValue.c b/security/nss/lib/pkix/src/Attribute/PSetValue.c new file mode 100644 index 000000000..4fd490a6a --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PSetValue.c @@ -0,0 +1,102 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_SetValue + * + * This routine sets the i'th attribute value {blah blah; copies + * memory contents over..} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXAttribute_SetValue +( + NSSPKIXAttribute *a, + PRInt32 i, + NSSPKIXAttributeValue *value +) +{ + NSSItem tmp; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(a) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssItem_verifyPointer(value) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( i < 0 ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } + + if( 0 == a->valuesCount ) { + nss_pkix_Attribute_Count(a); + } + + if( (0 != a->valuesCount) && (i > a->valuesCount) ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } + + if( (NSSItem *)NULL == nssItem_Duplicate(value, a->arena, &tmp) ) { + return PR_FAILURE; + } + + nss_ZFreeIf(a->asn1values[i]->data); + a->asn1values[i]->size = tmp.size; + a->asn1values[i]->data = tmp.data; + + return nss_pkix_Attribute_Clear(a); +} diff --git a/security/nss/lib/pkix/src/Attribute/PSetValues.c b/security/nss/lib/pkix/src/Attribute/PSetValues.c new file mode 100644 index 000000000..64df8eb55 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/PSetValues.c @@ -0,0 +1,135 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttribute_SetValues + * + * This routine sets all of the values of the specified + * NSSPKIXAttribute to the values in the specified NSSItem array. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_POINTER + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXAttribute_SetValues +( + NSSPKIXAttribute *a, + NSSPKIXAttributeValue values[], + PRInt32 count +) +{ + nssASN1Item **ip; + nssASN1Item *newarray; + PRUint32 i; + nssArenaMark *mark; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(a) ) { + return PR_FAILURE; + } + + if( (NSSPKIXAttributeValue *)NULL == values ) { + nss_SetError(NSS_ERROR_INVALID_POINTER); + return PR_FAILURE; + } + + if( count < 1 ) { + nss_SetError(NSS_ERROR_ARRAY_TOO_SMALL); + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + PR_ASSERT((nssASN1Item **)NULL != a->asn1values); + if( (nssASN1Item **)NULL == a->asn1values ) { + nss_SetError(NSS_ERROR_ASSERTION_FAILED); + return PR_FAILURE; + } + + mark = nssArena_Mark(a->arena); + if( (nssArenaMark *)NULL == mark ) { + return PR_FAILURE; + } + + newarray = nss_ZNEWARRAY(a->arena, nssASN1Item *, count); + if( (nssASN1Item *)NULL == newarray ) { + return PR_FAILURE; + } + + for( i = 0; i < count; i++ ) { + NSSItem tmp; + + newarray[i] = nss_ZNEW(a->arena, nssASN1Item); + if( (nssASN1Item *)NULL == newarray[i] ) { + goto loser; + } + + if( (NSSItem *)NULL == nssItem_Duplicate(&values[i], a->arena, &tmp) ) { + goto loser; + } + + newarray[i]->size = tmp.size; + newarray[i]->data = tmp.data; + } + + for( ip = &a->asn1values[0]; *ip; ip++ ) { + nss_ZFreeIf((*ip)->data); + nss_ZFreeIf(*ip); + } + + nss_ZFreeIf(a->asn1values); + + a->asn1values = newarray; + a->valuesCount = count; + + (void)nss_pkix_Attribute_Clear(a); + return nssArena_Unmark(a->arena, mark); + + loser: + (void)nssArena_Release(a->arena, mark); + return PR_FAILURE; +} diff --git a/security/nss/lib/pkix/src/Attribute/RemoveValue.c b/security/nss/lib/pkix/src/Attribute/RemoveValue.c new file mode 100644 index 000000000..e869fd96a --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/RemoveValue.c @@ -0,0 +1,76 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_RemoveValue + * + * This routine removes the i'th attribute value of the set in the + * specified NSSPKIXAttribute. An attempt to remove the last value + * will fail. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_AT_MINIMUM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXAttribute_RemoveValue +( + NSSPKIXAttribute *attribute, + PRInt32 i +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXAttribute_RemoveValue(attribute, i); +} + diff --git a/security/nss/lib/pkix/src/Attribute/SetType.c b/security/nss/lib/pkix/src/Attribute/SetType.c new file mode 100644 index 000000000..4975c8f8a --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/SetType.c @@ -0,0 +1,80 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_SetType + * + * This routine sets the attribute type oid of the indicated + * NSSPKIXAttribute to the specified value. Since attributes + * may be application-defined, no checking can be done on + * either the correctness of the attribute type oid value nor + * the suitability of the set of attribute values. + * + * The error value may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_OID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXAttribute_SetType +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeType *attributeType +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssOID_verifyPointer(attributeType) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXAttribute_SetType(attribute, attributeType); +} diff --git a/security/nss/lib/pkix/src/Attribute/SetValue.c b/security/nss/lib/pkix/src/Attribute/SetValue.c new file mode 100644 index 000000000..43f74ad26 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/SetValue.c @@ -0,0 +1,80 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_SetValue + * + * This routine sets the i'th attribute value {blah blah; copies + * memory contents over..} + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXAttribute_SetValue +( + NSSPKIXAttribute *attribute, + PRInt32 i, + NSSPKIXAttributeValue *value +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssItem_verifyPointer(value) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXAttribute_SetValue(attribute, i, value); +} diff --git a/security/nss/lib/pkix/src/Attribute/SetValues.c b/security/nss/lib/pkix/src/Attribute/SetValues.c new file mode 100644 index 000000000..7c3645cf7 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/SetValues.c @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttribute_SetValues + * + * This routine sets all of the values of the specified + * NSSPKIXAttribute to the values in the specified NSSItem array. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATTRIBUTE + * NSS_ERROR_INVALID_POINTER + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXAttribute_SetValues +( + NSSPKIXAttribute *attribute, + NSSPKIXAttributeValue values[], + PRInt32 count +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttribute_verifyPointer(attribute) ) { + return PR_FAILURE; + } + + if( (NSSPKIXAttributeValue *)NULL == values ) { + nss_SetError(NSS_ERROR_INVALID_POINTER); + return PR_FAILURE; + } + + if( count < 1 ) { + nss_SetError(NSS_ERROR_ARRAY_TOO_SMALL); + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKXIAttribute_SetValues(attribute, values, count); +} diff --git a/security/nss/lib/pkix/src/Attribute/template.c b/security/nss/lib/pkix/src/Attribute/template.c new file mode 100644 index 000000000..850b6a9b0 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/template.c @@ -0,0 +1,58 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifndef ASN1_H +#include "asn1.h" +#endif /* ASN1_H */ + +/* + * nssPKIXAttribute_template + * + * + */ + +const nssASN1Template nssPKIXAttribute_template[] = { + { nssASN1_SEQUENCE, 0, NULL, sizeof(NSSPKIXAttribute) }, + { nssASN1_OBJECT_ID, offsetof(NSSPKIXAttribute, asn1type) }, + { nssASN1_SET_OF, offsetof(NSSPKIXAttribute, asn1values), + nssASN1Template_Any }, + { 0 } +}; diff --git a/security/nss/lib/pkix/src/Attribute/verifyPointer.c b/security/nss/lib/pkix/src/Attribute/verifyPointer.c new file mode 100644 index 000000000..c0ae3ed84 --- /dev/null +++ b/security/nss/lib/pkix/src/Attribute/verifyPointer.c @@ -0,0 +1,170 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +#ifdef DEBUG + +extern const NSSError NSS_ERROR_INTERNAL_ERROR; + +static nssPointerTracker pkix_attribute_pointer_tracker; + +/* + * nss_pkix_Attribute_add_pointer + * + * This method is only present in debug builds. + * + * This module-private routine adds an NSSPKIXAttribute pointer to + * the internal pointer-tracker. This routine should only be used + * by the NSSPKIX module. This routine returns a PRStatus value; + * upon error it will place an error on the error stack and return + * PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_Attribute_add_pointer +( + const NSSPKIXAttribute *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_attribute_pointer_tracker); + if( PR_SUCCESS != rv ) { + return rv; + } + + rv = nssPointerTracker_add(&pkix_attribute_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + NSSError e = NSS_GetError(); + if( NSS_ERROR_NO_MEMORY != e ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + + return rv; + } + + return PR_SUCCESS; +} + +/* + * nss_pkix_Attribute_remove_pointer + * + * This method is only present in debug builds. + * + * This module-private routine removes a valid NSSPKIXAttribute + * pointer from the internal pointer-tracker. This routine should + * only be used by the NSSPKIX module. This routine returns a + * PRStatus value; upon error it will place an error on the error + * stack and return PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_Attribute_remove_pointer +( + const NSSPKIXAttribute *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_remove(&pkix_attribute_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + + return rv; +} + +/* + * nssPKIXAttribute_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXAttribute + * 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_PKIX_ATTRIBUTE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_IMPLEMENT PRStatus +nssPKIXAttribute_verifyPointer +( + NSSPKIXAttribute *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_attribute_pointer_tracker); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_ATTRIBUTE); + return PR_FAILURE; + } + + rv = nssPointerTracker_verify(&pkix_attribute_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_ATTRIBUTE); + return PR_FAILURE; + } + + return PR_SUCCESS; +} + +#endif /* DEBUG */ + diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/Create.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/Create.c new file mode 100644 index 000000000..84e721f80 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/Create.c @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttributeTypeAndValue_Create + * + * + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeTypeAndValue * +NSSPKIXAttributeTypeAndValue_Create +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + NSSPKIXAttributeValue *value +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + } + + if( PR_SUCCESS != nssOID_verifyPointer(typeOid) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + + if( PR_SUCCESS != nssItem_verifyPointer(value) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXAttributeTypeAndValue(arenaOpt, typeOid, value); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/CreateFromUTF8.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/CreateFromUTF8.c new file mode 100644 index 000000000..72e0a3114 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/CreateFromUTF8.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttributeTypeAndValue_CreateFromUTF8 + * + * + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeTypeAndValue * +NSSPKIXAttributeTypeAndValue_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + } + + if( (NSSUTF8 *)NULL == string ) { + nss_SetError(NSS_ERROR_INVALID_STRING); + return (NSSPKIXAttributeTypeAndValue *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXAttributeTypeAndValue_CreateFromUTF8(arenaOpt, string); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/Decode.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/Decode.c new file mode 100644 index 000000000..33b657303 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/Decode.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttributeTypeAndValue_Decode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeTypeAndValue * +NSSPKIXAttributeTypeAndValue_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXAttributeTypeAndValue_Decode(arenaOpt, ber); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/Destroy.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/Destroy.c new file mode 100644 index 000000000..b3c28a03f --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/Destroy.c @@ -0,0 +1,70 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttributeTypeAndValue_Destroy + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXAttributeTypeAndValue_Destroy +( + NSSPKIXAttributeTypeAndValue *atav +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXAttributeTypeAndValue_Destroy(atav); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/Duplicate.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/Duplicate.c new file mode 100644 index 000000000..09d1f27c3 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/Duplicate.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttributeTypeAndValue_Duplicate + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeTypeAndValue * +NSSPKIXAttributeTypeAndValue_Duplicate +( + NSSPKIXAttributeTypeAndValue *atav, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXAttributeTypeAndValue_Duplicate(atav, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/Encode.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/Encode.c new file mode 100644 index 000000000..1b67be84d --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/Encode.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttributeTypeAndValue_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSBER * +NSSPKIXAttributeTypeAndValue_Encode +( + NSSPKIXAttributeTypeAndValue *atav, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXAttributeTypeAndValue_Encode(atav, encoding, rvOpt, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/Equal.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/Equal.c new file mode 100644 index 000000000..0cbf06eca --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/Equal.c @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttributeTypeAndValue_Equal + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_IMPLEMENT PRBool +NSSPKIXAttributeTypeAndValue_Equal +( + NSSPKIXAttributeTypeAndValue *atav1, + NSSPKIXAttributeTypeAndValue *atav2, + PRStatus *statusOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav1) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + + return PR_FALSE; + } + + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav2) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + + return PR_FALSE; + } +#endif /* DEBUG */ + + return nssPKIXAttributeTypeAndValue_Equal(atav1, atav2, statusOpt); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/GetType.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/GetType.c new file mode 100644 index 000000000..68e2f48f6 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/GetType.c @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttributeTypeAndValue_GetType + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSPKIXAttributeType pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeType * +NSSPKIXAttributeTypeAndValue_GetType +( + NSSPKIXAttributeTypeAndValue *atav +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return (NSSPKIXAttributeType *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXAttributeTypeAndValue_GetType(atav); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/GetUTF8Encoding.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/GetUTF8Encoding.c new file mode 100644 index 000000000..611e4bcb9 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/GetUTF8Encoding.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttributeTypeAndValue_GetUTF8Encoding + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSUTF8 * +NSSPKIXAttributeTypeAndValue_GetUTF8Encoding +( + NSSPKIXAttributeTypeAndValue *atav, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return (NSSUTF8 *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSUTF8 *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXAttributeTypeAndValue_GetUTF8Encoding(atav, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/GetValue.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/GetValue.c new file mode 100644 index 000000000..5516c63ea --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/GetValue.c @@ -0,0 +1,80 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttributeTypeAndValue_GetValue + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSAttributeValue upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeValue * +NSSPKIXAttributeTypeAndValue_GetValue +( + NSSPKIXAttributeTypeAndValue *atav, + NSSPKIXAttributeValue *itemOpt, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return (NSSPKIXAttributeValue *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttributeValue *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXAttributeTypeAndValue_GetValue(atav, itemOpt, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/MClear.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/MClear.c new file mode 100644 index 000000000..eeae7db86 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/MClear.c @@ -0,0 +1,73 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nss_pkix_AttributeTypeAndValue_Clear + * + * Wipes out cached data. + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_AttributeTypeAndValue_Clear +( + NSSPKIXAttributeTypeAndValue *atav +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( (NSSBER *)NULL != atav->ber ) { + nss_ZFreeIf(atav->ber->data); + nss_ZFreeIf(atav->ber); + } + + if( (NSSDER *)NULL != atav->der ) { + nss_ZFreeIf(atav->der->data); + nss_ZFreeIf(atav->der); + } + + nss_ZFreeIf(atav->utf8); + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/PCreate.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/PCreate.c new file mode 100644 index 000000000..2dc6d8ac5 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/PCreate.c @@ -0,0 +1,154 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttributeTypeAndValue_Create + * + * + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeTypeAndValue * +nssPKIXAttributeTypeAndValue_Create +( + NSSArena *arenaOpt, + NSSPKIXAttributeType *typeOid, + NSSPKIXAttributeValue *value +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXAttributeTypeAndValue *rv = (NSSPKIXAttributeTypeAndValue *)NULL; + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + } + + if( PR_SUCCESS != nssOID_verifyPointer(typeOid) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + + if( PR_SUCCESS != nssItem_verifyPointer(value) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } +#endif /* DEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXAttributeTypeAndValue); + if( (NSSPKIXAttributeTypeAndValue *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->type = typeOid; + + { + NSSItem tmp; + if( (NSSItem *)NULL == nssOID_GetDEREncoding(typeOid, arena, &tmp) ) { + goto loser; + } + + rv->asn1type.size = tmp.size; + rv->asn1type.data = tmp.data; + } + + { + NSSItem tmp; + if( (NSSItem *)NULL == nssItem_Duplicate(value, arena, &tmp) ) { + goto loser; + } + + rv->asn1value.size = tmp.size; + rv->asn1value.data = tmp.data; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_AttributeTypeAndValue_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXAttributeTypeAndValue *)NULL; +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/PCreateFromUTF8.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/PCreateFromUTF8.c new file mode 100644 index 000000000..a2fa289ea --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/PCreateFromUTF8.c @@ -0,0 +1,137 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttributeTypeAndValue_CreateFromUTF8 + * + * + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeTypeAndValue * +nssPKIXAttributeTypeAndValue_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXAttributeTypeAndValue *rv = (NSSPKIXAttributeTypeAndValue *)NULL; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + } + + if( (NSSUTF8 *)NULL == string ) { + nss_SetError(NSS_ERROR_INVALID_STRING); + return (NSSPKIXAttributeTypeAndValue *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXAttributeTypeAndValue); + if( (NSSPKIXAttributeTypeAndValue *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->utf8 = nssUTF8_Duplicate(string, arena); + if( (NSSUTF8 *)NULL == rv->utf8 ) { + goto loser; + } + + /* Fill this in later from ../pki1/atav.c implementation */ + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + goto loser; + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_AttributeTypeAndValue_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXAttributeTypeAndValue *)NULL; +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/PDecode.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/PDecode.c new file mode 100644 index 000000000..9e017526c --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/PDecode.c @@ -0,0 +1,144 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifndef ASN1_H +#include "asn1.h" +#endif /* ASN1_H */ + +/* + * nssPKIXAttributeTypeAndValue_Decode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeTypeAndValue * +nssPKIXAttributeTypeAndValue_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXAttributeTypeAndValue *rv = (NSSPKIXAttributeTypeAndValue *)NULL; + PRStatus status; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXAttributeTypeAndValue); + if( (NSSPKIXAttributeTypeAndValue *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + /* For this object, BER is DER */ + rv->der = nssItem_Duplicate(ber, arena, (NSSItem *)NULL); + if( (NSSItem *)NULL == rv->ber ) { + goto loser; + } + + status = nssASN1_DecodeBER(arena, rv, + nssPKIXAttributeTypeAndValue_template, + ber); + if( PR_SUCCESS != status ) { + goto loser; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_AttributeTypeAndValue_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXAttributeTypeAndValue *)NULL; +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/PDestroy.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/PDestroy.c new file mode 100644 index 000000000..47242f545 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/PDestroy.c @@ -0,0 +1,78 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttributeTypeAndValue_Destroy + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXAttributeTypeAndValue_Destroy +( + NSSPKIXAttributeTypeAndValue *atav +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + +#ifdef DEBUG + (void)nss_pkix_AttributeTypeAndValue_remove_pointer(atav); + (void)nssArena_RemoveDestructor(arena, + nss_pkix_AttributeTypeAndValue_remove_pointer, atav); +#endif /* DEBUG */ + + if( PR_TRUE == atav->i_allocated_arena ) { + return nssArena_Destroy(atav->arena); + } + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/PDuplicate.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/PDuplicate.c new file mode 100644 index 000000000..53fc85171 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/PDuplicate.c @@ -0,0 +1,165 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttributeTypeAndValue_Duplicate + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeTypeAndValue * +nssPKIXAttributeTypeAndValue_Duplicate +( + NSSPKIXAttributeTypeAndValue *atav, + NSSArena *arenaOpt +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXAttributeTypeAndValue *rv = (NSSPKIXAttributeTypeAndValue *)NULL; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXAttributeTypeAndValue); + if( (NSSPKIXAttributeTypeAndValue *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + + if( (NSSDER *)NULL != atav->der ) { + rv->der = nssItem_Duplicate(atav->der, arena, (NSSItem *)NULL); + if( (NSSDER *)NULL == rv->der ) { + goto loser; /* actually, this isn't fatal */ + } + } + + { + NSSItem src, dst; + src.size = atav->asn1type.size; + src.data = atav->asn1type.data; + if( (NSSItem *)NULL == nssItem_Duplicate(&src, arena, &dst) ) { + goto loser; + } + rv->asn1type.size = dst.size; + rv->asn1type.data = dst.data; + } + + { + NSSItem src, dst; + src.size = atav->asn1value.size; + src.data = atav->asn1value.data; + if( (NSSItem *)NULL == nssItem_Duplicate(&src, arena, &dst) ) { + goto loser; + } + rv->asn1value.size = dst.size; + rv->asn1value.data = dst.data; + } + + rv->type = atav->type; + + if( (NSSUTF8 *)NULL != atav->utf8 ) { + rv->utf8 = nssUTF8_Duplicate(atav->utf8, arena); + if( (NSSUTF8 *)NULL == rv->utf8 ) { + goto loser; /* actually, this isn't fatal */ + } + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_AttributeTypeAndValue_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXAttributeTypeAndValue *)NULL; +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/PEncode.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/PEncode.c new file mode 100644 index 000000000..64a77e590 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/PEncode.c @@ -0,0 +1,101 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttributeTypeAndValue_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_EXTERN NSSBER * +nssPKIXAttributeTypeAndValue_Encode +( + NSSPKIXAttributeTypeAndValue *atav, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* NSSDEBUG */ + + switch( encoding ) { + case NSSASN1BER: + case NSSASN1DER: + break; + case NSSASN1CER: + case NSSASN1LWER: + case NSSASN1PER: + default: + nss_SetError(NSS_ERROR_UNSUPPORTED_ENCODING); + return (NSSBER *)NULL; + } + + /* For this item its DER is BER */ + + if( (NSSDER *)NULL == atav->der ) { + atav->der = nssASN1_EncodeDER(atav->arena, (NSSItem *)NULL, a, + nssPKIXAtributeTypeAndValue_template, NSSASN1DER); + if( (NSSDER *)NULL == atav->der ) { + return (NSSBER *)NULL; + } + } + + return nssItem_Duplicate(a->der, arenaOpt, rvOpt); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/PEqual.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/PEqual.c new file mode 100644 index 000000000..67dc970f1 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/PEqual.c @@ -0,0 +1,95 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttributeTypeAndValue_Equal + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_IMPLEMENT PRBool +nssPKIXAttributeTypeAndValue_Equal +( + NSSPKIXAttributeTypeAndValue *atav1, + NSSPKIXAttributeTypeAndValue *atav2, + PRStatus *statusOpt +) +{ + NSSItem one, two; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav1) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav2) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_SUCCESS; + } + + one.size = atav1->asn1type.size; + one.data = atav1->asn1type.data; + two.size = atav2->asn1type.size; + two.data = atav2->asn1type.data; + + if( PR_FALSE == nssItem_Equal(&one, &two, statusOpt) ) { + return PR_FALSE; + } + + one.size = atav1->asn1value.size; + one.data = atav1->asn1value.data; + two.size = atav2->asn1value.size; + two.data = atav2->asn1value.data; + + return nssItem_Equal(&one, &two, statusOpt); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/PGetType.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/PGetType.c new file mode 100644 index 000000000..20411e8ee --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/PGetType.c @@ -0,0 +1,78 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttributeTypeAndValue_GetType + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSPKIXAttributeType pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeType * +nssPKIXAttributeTypeAndValue_GetType +( + NSSPKIXAttributeTypeAndValue *atav +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( (NSSPKIXAttributeType *)NULL == atav->type ) { + NSSItem ber; + + ber.size = atav->asn1type.size; + ber.data = atav->asn1type.data; + + atav->type = (NSSPKIXAttributeType *)NSSOID_CreateFromBER(&ber); + } + + return atav->type; +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/PGetUTF8Encoding.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/PGetUTF8Encoding.c new file mode 100644 index 000000000..41145b3cf --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/PGetUTF8Encoding.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttributeTypeAndValue_GetUTF8Encoding + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSUTF8 * +nssPKIXAttributeTypeAndValue_GetUTF8Encoding +( + NSSPKIXAttributeTypeAndValue *atav, + NSSArena *arenaOpt +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return (NSSUTF8 *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSUTF8 *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSUTF8 *)NULL == atav->utf8 ) { + /* xxx fgmr fill this in from the ../pki1/atav.c implementation */ + } + + return nssUTF8_Duplicate(atav->utf8, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/PGetValue.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/PGetValue.c new file mode 100644 index 000000000..33f9e5b2b --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/PGetValue.c @@ -0,0 +1,83 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttributeTypeAndValue_GetValue + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSAttributeValue upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXAttributeValue * +nssPKIXAttributeTypeAndValue_GetValue +( + NSSPKIXAttributeTypeAndValue *atav, + NSSPKIXAttributeValue *rvOpt, + NSSArena *arenaOpt +) +{ + NSSItem tmp; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSDER *)NULL; + } + } +#endif /* NSSDEBUG */ + + tmp.size = atav->asn1value.size; + tmp.data = atav->asn1value.data; + + return nssItem_Duplicate(&tmp, arenaOpt, rvOpt); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/PSetType.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/PSetType.c new file mode 100644 index 000000000..4e25b88cc --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/PSetType.c @@ -0,0 +1,86 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttributeTypeAndValue_SetType + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_OID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN PRStatus +nssPKIXAttributeTypeAndValue_SetType +( + NSSPKIXAttributeTypeAndValue *atav, + NSSPKIXAttributeType *attributeType +) +{ + NSSDER tmp; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssOID_verifyPointer(attributeType) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + atav->type = attributeType; + + nss_ZFreeIf(atav->asn1type.data); + if( (NSSDER *)NULL == nssOID_GetDEREncoding(atav->type, &tmp, atav->arena) ) { + return PR_FAILURE; + } + + atav->asn1type.size = tmp.size; + atav->asn1type.data = tmp.data; + + return nss_pkix_AttributeTypeAndValue_Clear(atav); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/PSetValue.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/PSetValue.c new file mode 100644 index 000000000..82de4db00 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/PSetValue.c @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXAttributeTypeAndValue_SetValue + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXAttributeTypeAndValue_SetValue +( + NSSPKIXAttributeTypeAndValue *atav, + NSSPKIXAttributeValue *value +) +{ + NSSItem tmp; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssItem_verifyPointer(value) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( (NSSItem *)NULL == nssItem_Duplicate(value, atav->arena, &tmp) ) { + return PR_FAILURE; + } + + nss_ZFreeIf(atav->asn1value.data); + atav->asn1value.size = tmp.size; + atav->asn1value.data = tmp.data; + + return nss_pkix_AttributeTypeAndValue_Clear(atav); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/SetType.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/SetType.c new file mode 100644 index 000000000..672b7b738 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/SetType.c @@ -0,0 +1,76 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttributeTypeAndValue_SetType + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_OID + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXAttributeTypeAndValue_SetType +( + NSSPKIXAttributeTypeAndValue *atav, + NSSPKIXAttributeType *attributeType +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssOID_verifyPointer(attributeType) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXAttributeTypeAndValue_SetType(atav, attributeType); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/SetValue.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/SetValue.c new file mode 100644 index 000000000..fafc54d6c --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/SetValue.c @@ -0,0 +1,77 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXAttributeTypeAndValue_SetValue + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXAttributeTypeAndValue_SetValue +( + NSSPKIXAttributeTypeAndValue *atav, + NSSPKIXAttributeValue *value +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssItem_verifyPointer(value) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXAttributeTypeAndValue_SetValue(atav, value); +} diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/template.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/template.c new file mode 100644 index 000000000..548a4fac9 --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/template.c @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifndef ASN1_H +#include "asn1.h" +#endif /* ASN1_H */ + +/* + * nssPKIXAttributeTypeAndValue_template + * + */ + +const nssASN1Template nssPKIXAttributeTypeAndValue_template[] = { + { nssASN1_SEQUENCE, 0, NULL, sizeof(NSSPKIXAttributeTypeAndValue) }, + { nssASN1_OBJECT_ID, offsetof(NSSPKIXAttributeTypeAndValue, asn1type) }, + { nssASN1_ANY, offsetof(NSSPKIXAttributeTypeAndValue, asn1value) }, + { 0 } +}; diff --git a/security/nss/lib/pkix/src/AttributeTypeAndValue/verifyPointer.c b/security/nss/lib/pkix/src/AttributeTypeAndValue/verifyPointer.c new file mode 100644 index 000000000..340e19c1b --- /dev/null +++ b/security/nss/lib/pkix/src/AttributeTypeAndValue/verifyPointer.c @@ -0,0 +1,184 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +#ifdef DEBUG + +extern const NSSError NSS_ERROR_INTERNAL_ERROR; + +static nssPointerTracker pkix_atav_pointer_tracker; + +/* + * nss_pkix_AttributeTypeAndValue_add_pointer + * + * This method is only present in debug builds. + * + * This module-private routine adds an NSSPKIXAttributeTypeAndValue + * pointer to the internal pointer-tracker. This routine should only + * be used by the NSSPKIX module. This routine returns a PRStatus + * value; upon error it will place an error on the error stack and + * return PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_AttributeTypeAndValue_add_pointer +( + const NSSPKIXAttributeTypeAndValue *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_atav_pointer_tracker); + if( PR_SUCCESS != rv ) { + return rv; + } + + rv = nssPointerTracker_add(&pkix_atav_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + NSSError e = NSS_GetError(); + if( NSS_ERROR_NO_MEMORY != e ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + + return rv; + } + + rv = nssArena_registerDestructor(arena, + nss_pkix_AttributeTypeAndValue_remove_pointer, p); + if( PR_SUCCESS != rv ) { + (void)nss_pkix_AttributeTypeAndValue_remove_pointer(p); + return rv; + } + + return PR_SUCCESS; +} + +/* + * nss_pkix_AttributeTypeAndValue_remove_pointer + * + * This method is only present in debug builds. + * + * This module-private routine removes a valid + * NSSPKIXAttributeTypeAndValue pointer from the internal + * pointer-tracker. This routine should only be used by the + * NSSPKIX module. This routine returns a PRStatus value; + * upon error it will place an error on the error stack and + * return PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_AttributeTypeAndValue_remove_pointer +( + const NSSPKIXAttributeTypeAndValue *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_remove(&pkix_atav_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + + /* + * nssArena_deregisterDestructor(p->arena, + * nss_pkix_AttributeTypeAndValue_remove_pointer, p); + */ + + return rv; +} + +/* + * nssPKIXAttributeTypeAndValue_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an + * NSSPKIXAttributeTypeAndValue 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_PKIX_ATTRIBUTE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_IMPLEMENT PRStatus +nssPKIXAttributeTypeAndValue_verifyPointer +( + NSSPKIXAttributeTypeAndValue *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_atav_pointer_tracker); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_ATTRIBUTE); + return PR_FAILURE; + } + + rv = nssPointerTracker_verify(&pkix_atav_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_ATTRIBUTE); + return PR_FAILURE; + } + + return PR_SUCCESS; +} + +#endif /* DEBUG */ + diff --git a/security/nss/lib/pkix/src/Name/Create.c b/security/nss/lib/pkix/src/Name/Create.c new file mode 100644 index 000000000..dc9059f0b --- /dev/null +++ b/security/nss/lib/pkix/src/Name/Create.c @@ -0,0 +1,93 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_CHOICE + * NSS_ERROR_INVALID_ARGUMENT + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXName * +NSSPKIXName_Create +( + NSSArena *arenaOpt, + NSSPKIXNameChoice choice, + void *arg +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXName *)NULL; + } + } + + switch( choice ) { + case NSSPKIXNameChoice_rdnSequence: + { + NSSPKIXRDNSequence *r = (NSSPKIXRDNSequence *)arg; + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(r) ) { + return (NSSPKIXName *)NULL; + } + } + + break; + case NSSPKIXNameChoice_NSSinvalid: + default: + nss_SetError(NSS_ERROR_INVALID_CHOICE); + return (NSSPKIXName *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXName_Create(arenaOpt, choice, arg); +} diff --git a/security/nss/lib/pkix/src/Name/CreateFromRDNSequence.c b/security/nss/lib/pkix/src/Name/CreateFromRDNSequence.c new file mode 100644 index 000000000..da07742cc --- /dev/null +++ b/security/nss/lib/pkix/src/Name/CreateFromRDNSequence.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXName_CreateFromRDNSequence + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXName * +NSSPKIXName_CreateFromRDNSequence +( + NSSArena *arenaOpt, + NSSPKIXRDNSequence *rdnSequence +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXName *)NULL; + } + } + + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnSequence) ) { + return (NSSPKIXName *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXName_CreateFromRDNSequence(arenaOpt, rdnSequence); +} diff --git a/security/nss/lib/pkix/src/Name/CreateFromUTF8.c b/security/nss/lib/pkix/src/Name/CreateFromUTF8.c new file mode 100644 index 000000000..f2111ea75 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/CreateFromUTF8.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXName_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXName * +NSSPKIXName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXName *)NULL; + } + } + + if( (NSSUTF8 *)NULL == string ) { + nss_SetError(NSS_ERROR_INVALID_STRING); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXName_CreateFromUTF8(arenaOpt, string); +} diff --git a/security/nss/lib/pkix/src/Name/Decode.c b/security/nss/lib/pkix/src/Name/Decode.c new file mode 100644 index 000000000..b30fac01e --- /dev/null +++ b/security/nss/lib/pkix/src/Name/Decode.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXName_CreateFromBER + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXName * +NSSPKIXName_CreateFromBER +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXName *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXName *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXName_CreateFromBER(arenaOpt, ber); +} diff --git a/security/nss/lib/pkix/src/Name/Destroy.c b/security/nss/lib/pkix/src/Name/Destroy.c new file mode 100644 index 000000000..c8c2bc9f2 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/Destroy.c @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXName_Destroy +( + NSSPKIXName *name +) +{ +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXName_verifyPointer(name) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXName_Destroy(name); +} diff --git a/security/nss/lib/pkix/src/Name/Duplicate.c b/security/nss/lib/pkix/src/Name/Duplicate.c new file mode 100644 index 000000000..6c8831729 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/Duplicate.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXName * +NSSPKIXName_Duplicate +( + NSSPKIXName *name, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXName_verifyPointer(name) ) { + return (NSSDER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSDER *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXName_Duplicate(name, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/Name/Encode.c b/security/nss/lib/pkix/src/Name/Encode.c new file mode 100644 index 000000000..344a53724 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/Encode.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSBER * +NSSPKIXName_Encode +( + NSSPKIXName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXName_verifyPointer(name) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXName_Encode(name, rvOpt, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/Name/Equal.c b/security/nss/lib/pkix/src/Name/Equal.c new file mode 100644 index 000000000..9a74eef94 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/Equal.c @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_IMPLEMENT PRBool +NSSPKIXName_Equal +( + NSSPKIXName *name1, + NSSPKIXName *name2, + PRStatus *statusOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(name1) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + + return PR_FALSE; + } + + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(name2) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + + return PR_FALSE; + } +#endif /* DEBUG */ + + return nssPKIX_Equal(name1, name2, statusOpt); +} diff --git a/security/nss/lib/pkix/src/Name/GetChoice.c b/security/nss/lib/pkix/src/Name/GetChoice.c new file mode 100644 index 000000000..8a36ada00 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/GetChoice.c @@ -0,0 +1,70 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXName_GetChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * A valid element of the NSSPKIXNameChoice enumeration upon success + * The value NSSPKIXNameChoice_NSSinvalid (-1) upon error + */ + +NSS_IMPLEMENT NSSPKIXNameChoice +NSSPKIXName_GetChoice +( + NSSPKIXName *name +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXName_verifyPointer(name) ) { + return NSSPKIXNameChoice_NSSinvalid; + } +#endif /* DEBUG */ + + return nssPKIXName_GetChoice(name); +} diff --git a/security/nss/lib/pkix/src/Name/GetRDNSequence.c b/security/nss/lib/pkix/src/Name/GetRDNSequence.c new file mode 100644 index 000000000..94562ae3c --- /dev/null +++ b/security/nss/lib/pkix/src/Name/GetRDNSequence.c @@ -0,0 +1,80 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXName_GetRDNSequence + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A pointer to a valid NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRDNSequence * +NSSPKIXName_GetRDNSequence +( + NSSPKIXName *name, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return (NSSPKIXRDNSequence *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRDNSequence *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXName_GetRDNSequence(name, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/Name/GetSpecifiedChoice.c b/security/nss/lib/pkix/src/Name/GetSpecifiedChoice.c new file mode 100644 index 000000000..3de2d5b84 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/GetSpecifiedChoice.c @@ -0,0 +1,90 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXName_GetSpecifiedChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A valid pointer ... + * NULL upon failure + */ + +NSS_IMPLEMENT void * +NSSPKIXName_GetSpecifiedChoice +( + NSSPKIXName *name, + NSSPKIXNameChoice choice, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(name) ) { + return (void *)NULL; + } + + switch( choice ) { + case NSSPKIXNameChoice_rdnSequence: + break; + case NSSPKIXNameChoice_NSSinvalid: + default: + nss_SetError(NSS_ERROR_INVALID_CHOICE); + return (void *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (void *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXName_GetSpecifiedChoice(name, choice, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/Name/GetUTF8Encoding.c b/security/nss/lib/pkix/src/Name/GetUTF8Encoding.c new file mode 100644 index 000000000..c86dd94b2 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/GetUTF8Encoding.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXName_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSUTF8 * +NSSPKIXName_GetUTF8Encoding +( + NSSPKIXName *name, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXName_verifyPointer(name) ) { + return (NSSUTF8 *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSUTF8 *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXName_GetUTF8Encoding(name, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/Name/MClear.c b/security/nss/lib/pkix/src/Name/MClear.c new file mode 100644 index 000000000..e8d6b1961 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/MClear.c @@ -0,0 +1,73 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nss_pkix_Name_Clear + * + * Wipes out cached data. + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_Name_Clear +( + NSSPKIXName *name +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXName_verifyPointer(name) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( (NSSBER *)NULL != name->ber ) { + nss_ZFreeIf(name->ber->data); + nss_ZFreeIf(name->ber); + } + + if( (NSSDER *)NULL != name->der ) { + nss_ZFreeIf(name->der->data); + nss_ZFreeIf(name->der); + } + + nss_ZFreeIf(name->utf8); + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/Name/Mregister.c b/security/nss/lib/pkix/src/Name/Mregister.c new file mode 100644 index 000000000..09ddb9d99 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/Mregister.c @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifdef NSSDEBUG +/* + * nss_pkix_Name_register + * + * Registers whatever sub-component exists within this Name. + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_Name_register +( + NSSPKIXName *name +) +{ + if( PR_SUCCESS != nssPKIXName_verifyPointer(name) ) { + return PR_FAILURE; + } + + switch( name->choice ) { + case NSSPKIXNameChoice_rdnSequence: + /* add pointer */ + /* (sub-)register pointer */ + /* add destructor to arena */ + break; + case NSSPKIXNameChoice_NSSinvalid: + default: + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + return PR_FAILURE; + } + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/Name/PCreate.c b/security/nss/lib/pkix/src/Name/PCreate.c new file mode 100644 index 000000000..e93737599 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/PCreate.c @@ -0,0 +1,173 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_CHOICE + * NSS_ERROR_INVALID_ARGUMENT + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXName * +nssPKIXName_Create +( + NSSArena *arenaOpt, + NSSPKIXNameChoice choice, + void *arg +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXName *rv = (NSSPKIXName *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXName *)NULL; + } + } + + switch( choice ) { + case NSSPKIXNameChoice_rdnSequence: + if( (PR_SUCCESS != nssPKIXRDNSequence_verifyPointer((NSSPKIXRDNSequence *)arg) ) ) { + nss_SetError(NSS_ERROR_INVALID_ARGUMENT); + return (NSSPKIXName *)NULL; + } + break; + case NSSPKIXNameChoice_NSSinvalid: + default: + nss_SetError(NSS_ERROR_INVALID_CHOICE); + return (NSSPKIXName *)NULL; + } +#endif /* NSSDEBUG */ + + switch( choice ) { + case NSSPKIXNameChoice_rdnSequence: + break; + case NSSPKIXNameChoice_NSSinvalid: + default: + nss_SetError(NSS_ERROR_INVALID_CHOICE); + goto loser; + } + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXName); + if( (NSSPKIXName *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->utf8 = nssUTF8_Duplicate(string, arena); + if( (NSSUTF8 *)NULL == rv->utf8 ) { + goto loser; + } + + rv->choice = choice; + switch( choice ) { + case NSSPKIXNameChoice_rdnSequence: + rv->u.rdnSequence = nssPKIXRDNSequence_Duplicate((NSSPKIXRDNSequence *)arg, arena); + if( (NSSPKIXRDNSequence *)NULL == rv->u.rdnSequence ) { + goto loser; + } + break; + case NSSPKIXNameChoice_NSSinvalid: + default: + nss_SetError(NSS_ERROR_INVALID_CHOICE); + goto loser; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_Name_add_pointer(rv) ) { + goto loser; + } + + if( PR_SUCCESS != nssArena_registerDestructor(arena, + nss_pkix_Name_remove_pointer, rv) ) { + (void)nss_pkix_Name_remove_pointer(rv); + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXName *)NULL; +} diff --git a/security/nss/lib/pkix/src/Name/PCreateFromRDNSequence.c b/security/nss/lib/pkix/src/Name/PCreateFromRDNSequence.c new file mode 100644 index 000000000..169e409a3 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/PCreateFromRDNSequence.c @@ -0,0 +1,145 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXName_CreateFromRDNSequence + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXName * +nssPKIXName_CreateFromRDNSequence +( + NSSArena *arenaOpt, + NSSPKIXRDNSequence *rdnSequence +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXName *rv = (NSSPKIXName *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXName *)NULL; + } + } + + if( (PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnSequence) ) ) { + return (NSSPKIXName *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXName); + if( (NSSPKIXName *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->utf8 = nssUTF8_Duplicate(string, arena); + if( (NSSUTF8 *)NULL == rv->utf8 ) { + goto loser; + } + + rv->choice = NSSPKIXNameChoice_rdnSequence; + rv->u.rdnSequence = nssPKIXRDNSequence_Duplicate(rdnSequence, arena); + if( (NSSPKIXRDNSequence *)NULL == rv->u.rdnSequence ) { + goto loser; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_Name_add_pointer(rv) ) { + goto loser; + } + + if( PR_SUCCESS != nssArena_registerDestructor(arena, + nss_pkix_Name_remove_pointer, rv) ) { + (void)nss_pkix_Name_remove_pointer(rv); + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXName *)NULL; +} diff --git a/security/nss/lib/pkix/src/Name/PCreateFromUTF8.c b/security/nss/lib/pkix/src/Name/PCreateFromUTF8.c new file mode 100644 index 000000000..0939a19e3 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/PCreateFromUTF8.c @@ -0,0 +1,145 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXName_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXName * +nssPKIXName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXName *rv = (NSSPKIXName *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXName *)NULL; + } + } + + if( (NSSUTF8 *)NULL == string ) { + nss_SetError(NSS_ERROR_INVALID_STRING); + return (NSSPKIXName *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXName); + if( (NSSPKIXName *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->utf8 = nssUTF8_Duplicate(string, arena); + if( (NSSUTF8 *)NULL == rv->utf8 ) { + goto loser; + } + + /* Insert intelligence here -- fgmr */ + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + goto loser; + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_Name_add_pointer(rv) ) { + goto loser; + } + + if( PR_SUCCESS != nssArena_registerDestructor(arena, + nss_pkix_Name_remove_pointer, rv) ) { + (void)nss_pkix_Name_remove_pointer(rv); + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXName *)NULL; +} diff --git a/security/nss/lib/pkix/src/Name/PDecode.c b/security/nss/lib/pkix/src/Name/PDecode.c new file mode 100644 index 000000000..d3f20d473 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/PDecode.c @@ -0,0 +1,138 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXName_CreateFromBER + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXName * +nssPKIXName_CreateFromBER +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXName *rv = (NSSPKIXName *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXName *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXName *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXName); + if( (NSSPKIXName *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->ber = nssItem_Duplicate(ber, arena, (NSSItem *)NULL); + if( (NSSItem *)NULL == rv->ber ) { + goto loser; + } + + status = nssASN1_DecodeBER(arena, rv, nssPKIXName_template, ber); + if( PR_SUCCESS != status ) { + goto loser; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_Name_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXName *)NULL; +} diff --git a/security/nss/lib/pkix/src/Name/PDestroy.c b/security/nss/lib/pkix/src/Name/PDestroy.c new file mode 100644 index 000000000..f1fd41721 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/PDestroy.c @@ -0,0 +1,76 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXName_Destroy +( + NSSPKIXName *name +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXName_verifyPointer(name) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + +#ifdef DEBUG + (void)nss_pkix_Name_remove_pointer(name); +#endif /* DEBUG */ + + if( PR_TRUE == name->i_allocated_arena ) { + return nssArena_Destroy(name->arena); + } + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/Name/PDuplicate.c b/security/nss/lib/pkix/src/Name/PDuplicate.c new file mode 100644 index 000000000..c5788a0f1 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/PDuplicate.c @@ -0,0 +1,172 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXName * +nssPKIXName_Duplicate +( + NSSPKIXName *name, + NSSArena *arenaOpt +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXName *rv = (NSSPKIXName *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXName *)NULL; + } + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSUTF8 *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXName); + if( (NSSPKIXName *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + + if( (NSSBER *)NULL != name->ber ) { + rv->ber = nssItem_Duplicate(name->ber, arena, (NSSItem *)NULL); + if( (NSSBER *)NULL == rv->ber ) { + goto loser; + } + } + + if( (NSSDER *)NULL != name->der ) { + rv->der = nssItem_Duplicate(name->der, arena, (NSSItem *)NULL); + if( (NSSDER *)NULL == rv->der ) { + goto loser; + } + } + + if( (NSSUTF8 *)NULL != name->utf8 ) { + rv->utf8 = nssUTF8_duplicate(name->utf8, arena); + if( (NSSUTF8 *)NULL == rv->utf8 ) { + goto loser; + } + } + + rv->choice = name->choice; + switch( name->choice ) { + case NSSPKIXNameChoice_rdnSequence: + rv->u.rdnSequence = nssPKIXRDNSequence_Duplicate(name->u.rdnSequence, arena); + if( (NSSPKIXRDNSequence *)NULL == rv->u.rdnSequence ) { + goto loser; + } + break; + case NSSPKIXNameChoice_NSSinvalid: + default: + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + goto loser; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_Name_add_pointer(rv) ) { + goto loser; + } + + if( PR_SUCCESS != nssArena_registerDestructor(arena, + nss_pkix_Name_remove_pointer, rv) ) { + (void)nss_pkix_Name_remove_pointer(rv); + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXName *)NULL; +} diff --git a/security/nss/lib/pkix/src/Name/PEncode.c b/security/nss/lib/pkix/src/Name/PEncode.c new file mode 100644 index 000000000..469b528fb --- /dev/null +++ b/security/nss/lib/pkix/src/Name/PEncode.c @@ -0,0 +1,118 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSBER * +nssPKIXName_Encode +( + NSSPKIXName *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + NSSBER *it; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXName_verifyPointer(name) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* NSSDEBUG */ + + switch( encoding ) { + case NSSASN1BER: + if( (NSSBER *)NULL != name->ber ) { + it = name->ber; + goto done; + } + /*FALLTHROUGH*/ + case NSSASN1DER: + if( (NSSDER *)NULL != name->der ) { + it = name->der; + goto done; + } + break; + default: + nss_SetError(NSS_ERROR_UNSUPPORTED_ENCODING); + return (NSSBER *)NULL; + } + + it = nssASN1_EncodeItem(name->arena, (NSSItem *)NULL, name, + nssPKIXName_template, encoding); + if( (NSSBER *)NULL == it ) { + return (NSSBER *)NULL; + } + + switch( encoding ) { + case NSSASN1BER: + name->ber = it; + break; + case NSSASN1DER: + name->der = it; + break; + default: + PR_ASSERT(0); + break; + } + + done: + return nssItem_Duplicate(it, arenaOpt, rvOpt); +} diff --git a/security/nss/lib/pkix/src/Name/PEqual.c b/security/nss/lib/pkix/src/Name/PEqual.c new file mode 100644 index 000000000..5ad91dd2a --- /dev/null +++ b/security/nss/lib/pkix/src/Name/PEqual.c @@ -0,0 +1,104 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_IMPLEMENT PRBool +nssPKIXName_Equal +( + NSSPKIXName *one, + NSSPKIXName *two, + PRStatus *statusOpt +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXName_verifyPointer(one) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; + } + + if( PR_SUCCESS != nssPKIXName_verifyPointer(two) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; + } +#endif /* NSSDEBUG */ + + if( ((NSSDER *)NULL != one->der) && ((NSSDER *)NULL != two->der) ) { + return nssItem_Equal(one->der, two->der, statusOpt); + } + + if( one->choice != two->choice ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_SUCCESS; + } + return PR_FALSE; + } + + switch( one->choice ) { + case NSSPKIXNameChoice_rdnSequence: + return nssPKIXRDNSequence_Equal(one->u.rdnSequence, two->u.rdnSequence, statusOpt); + case NSSPKIXNameChoice_NSSinvalid: + default: + break; + } + + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; +} diff --git a/security/nss/lib/pkix/src/Name/PGetChoice.c b/security/nss/lib/pkix/src/Name/PGetChoice.c new file mode 100644 index 000000000..f34a93908 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/PGetChoice.c @@ -0,0 +1,68 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXName_GetChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * + * Return value: + * A valid element of the NSSPKIXNameChoice enumeration upon success + * The value NSSPKIXNameChoice_NSSinvalid (-1) upon error + */ + +NSS_IMPLEMENT NSSPKIXNameChoice +nssPKIXName_GetChoice +( + NSSPKIXName *name +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXName_verifyPointer(name) ) { + return NSSPKIXNameChoice_NSSinvalid; + } +#endif /* NSSDEBUG */ + + return name->choice; +} diff --git a/security/nss/lib/pkix/src/Name/PGetRDNSequence.c b/security/nss/lib/pkix/src/Name/PGetRDNSequence.c new file mode 100644 index 000000000..0899e550d --- /dev/null +++ b/security/nss/lib/pkix/src/Name/PGetRDNSequence.c @@ -0,0 +1,87 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXName_GetRDNSequence + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A pointer to a valid NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRDNSequence * +nssPKIXName_GetRDNSequence +( + NSSPKIXName *name, + NSSArena *arenaOpt +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXName_verifyPointer(name) ) { + return (NSSPKIXRDNSequence *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRDNSequence *)NULL; + } + } +#endif /* NSSDEBUG */ + + switch( name->choice ) { + case NSSPKIXNameChoice_rdnSequence: + return nssPKIXRDNSequence_Duplicate(name->u.rdnSequence, arenaOpt); + case NSSPKIXNameChoice_NSSinvalid: + default: + break; + } + + nss_SetError(NSS_ERROR_WRONG_CHOICE); + return (NSSPKIXRDNSequence *)NULL; +} diff --git a/security/nss/lib/pkix/src/Name/PGetSpecifiedChoice.c b/security/nss/lib/pkix/src/Name/PGetSpecifiedChoice.c new file mode 100644 index 000000000..a24c8ea86 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/PGetSpecifiedChoice.c @@ -0,0 +1,93 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXName_GetSpecifiedChoice + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_WRONG_CHOICE + * + * Return value: + * A valid pointer ... + * NULL upon failure + */ + +NSS_IMPLEMENT void * +nssPKIXName_GetSpecifiedChoice +( + NSSPKIXName *name, + NSSPKIXNameChoice choice, + NSSArena *arenaOpt +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXName_verifyPointer(name) ) { + return (void *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (void *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( choice != name->choice ) { + nss_SetError(NSS_ERROR_WRONG_CHOICE); + return (void *)NULL; + } + + switch( name->choice ) { + case NSSPKIXNameChoice_rdnSequence: + return (void *)nssPKIXRDNSequence_Duplicate(name->u.rdnSequence, arenaOpt); + case NSSPKIXNameChoice_NSSinvalid: + default: + break; + } + + nss_SetError(NSS_ERROR_WRONG_CHOICE); + return (NSSPKIXRDNSequence *)NULL; +} diff --git a/security/nss/lib/pkix/src/Name/PGetUTF8Encoding.c b/security/nss/lib/pkix/src/Name/PGetUTF8Encoding.c new file mode 100644 index 000000000..164229277 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/PGetUTF8Encoding.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXName_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_NAME + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSUTF8 * +nssPKIXName_GetUTF8Encoding +( + NSSPKIXName *name, + NSSArena *arenaOpt +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXName_verifyPointer(name) ) { + return (NSSUTF8 *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSUTF8 *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSUTF8 *)NULL == name->utf8 ) { + /* xxx fgmr fill this in from pki1 implementation */ + } + + return nssUTF8_Duplicate(name->utf8, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/Name/template.c b/security/nss/lib/pkix/src/Name/template.c new file mode 100644 index 000000000..72ac85466 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/template.c @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifndef ASN1_H +#include "asn1.h" +#endif /* ASN1_H */ + +/* + * nssPKIXName_template + * + */ + +const nssASN1Template nssPKIXName_template[] = { + { nssASN1_CHOICE, offsetof(NSSPKIXName, choice), 0, sizeof(NSSPKIXName) }, + { nssASN1_POINTER, offsetof(NSSPKIXName, u.rdnSequence), + nssPKIXRDNSequence_template, NSSPKIXNameChoice_rdnSequence }, + { 0 } +}; diff --git a/security/nss/lib/pkix/src/Name/verifyPointer.c b/security/nss/lib/pkix/src/Name/verifyPointer.c new file mode 100644 index 000000000..6c27e5910 --- /dev/null +++ b/security/nss/lib/pkix/src/Name/verifyPointer.c @@ -0,0 +1,210 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +#ifdef DEBUG + +extern const NSSError NSS_ERROR_INTERNAL_ERROR; + +static nssPointerTracker pkix_name_pointer_tracker; + +/* + * nss_pkix_Name_add_pointer + * + * This method is only present in debug builds. + * + * This module-private routine adds an NSSPKIXName pointer to + * the internal pointer-tracker. This routine should only be used + * by the NSSPKIX module. This routine returns a PRStatus value; + * upon error it will place an error on the error stack and return + * PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_Name_add_pointer +( + const NSSPKIXName *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_name_pointer_tracker); + if( PR_SUCCESS != rv ) { + return rv; + } + + rv = nssPointerTracker_add(&pkix_name_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + NSSError e = NSS_GetError(); + if( NSS_ERROR_NO_MEMORY != e ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + + return rv; + } + + rv = nssArena_registerDestructor(p->arena, + nss_pkix_Name_remove_pointer, p); + if( PR_SUCCESS != rv ) { + (void)nss_pkix_Name_remove_pointer(p); + return rv; + } + +#ifdef NSSDEBUG + switch( p->choice ) { + case NSSPKIXNameChoice_rdnSequence: + rv = nss_pkix_RDNSequence_register(p->u.rdnSequence); + break; + case NSSPKIXNameChoice_NSSinvalid: + default: + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + rv = PR_FAILURE; + break; + } + + if( PR_SUCCESS != rv ) { + (void)nss_pkix_Name_remove_pointer(p); + } +#endif /* NSSDEBUG */ + + return rv; +} + +/* + * nss_pkix_Name_remove_pointer + * + * This method is only present in debug builds. + * + * This module-private routine removes a valid NSSPKIXName + * pointer from the internal pointer-tracker. This routine should + * only be used by the NSSPKIX module. This routine returns a + * PRStatus value; upon error it will place an error on the error + * stack and return PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_Name_remove_pointer +( + const NSSPKIXName *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_remove(&pkix_name_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + +#ifdef NSSDEBUG + switch( p->choice ) { + case NSSPKIXNameChoice_rdnSequence: + (void)nss_pkix_RDNSequence_register(p->u.rdnSequence); + break; + case NSSPKIXNameChoice_NSSinvalid: + default: + break; + } +#endif /* NSSDEBUG */ + + /* + * nssArena_deregisterDestructor(p->arena, + * nss_pkix_Name_remove_pointer, p); + */ + + return rv; +} + +/* + * nssPKIXName_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXName + * 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_PKIX_ATTRIBUTE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_IMPLEMENT PRStatus +nssPKIXName_verifyPointer +( + NSSPKIXName *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_name_pointer_tracker); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_ATTRIBUTE); + return PR_FAILURE; + } + + rv = nssPointerTracker_verify(&pkix_name_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_ATTRIBUTE); + return PR_FAILURE; + } + + return PR_SUCCESS; +} + +#endif /* DEBUG */ + diff --git a/security/nss/lib/pkix/src/RDNSequence/AppendRelativeDistinguishedName.c b/security/nss/lib/pkix/src/RDNSequence/AppendRelativeDistinguishedName.c new file mode 100644 index 000000000..4e0d0d018 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/AppendRelativeDistinguishedName.c @@ -0,0 +1,77 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_AppendRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXRDNSequence_AppendRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rdn +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_AppendRelativeDistinguishedName(rdnseq, rdn); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/Create.c b/security/nss/lib/pkix/src/RDNSequence/Create.c new file mode 100644 index 000000000..52b8a851c --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/Create.c @@ -0,0 +1,125 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRDNSequence * +NSSPKIXRDNSequence_Create +( + NSSArena *arenaOpt, + NSSPKIXRelativeDistinguishedName *rdn1, + ... +) +{ + va_list ap; + NSSPKIXRDNSequence *rv; + PRUint32 count; + + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRDNSequence *)NULL; + } + } + + /* Is there a nonzero minimum number of RDNs required? */ + + { + va_start(ap, arenaOpt); + + while( 1 ) { + NSSPKIXRelativeDistinguishedName *rdn; + rdn = (NSSPKIXRelativeDistinguishedName *)va_arg(ap, NSSPKIXRelativeDistinguishedName *); + if( (NSSPKIXRelativeDistinguishedName *)NULL == rdn ) { + break; + } + + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + va_end(ap); + return (NSSPKIXRDNSequence *)NULL; + } + } + + va_end(ap); + } +#endif /* DEBUG */ + + va_start(ap, arenaOpt); + + for( count = 0; ; count++ ) { + NSSPKIXRelativeDistinguishedName *rdn; + rdn = (NSSPKIXRelativeDistinguishedName *)va_arg(ap, NSSPKIXRelativeDistinguishedName *); + if( (NSSPKIXRelativeDistinguishedName *)NULL == rdn ) { + break; + } + +#ifdef PEDANTIC + if( count == 0xFFFFFFFF ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + va_end(ap); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } +#endif /* PEDANTIC */ + } + + va_end(ap); + + va_start(ap, arenaOpt); + rv = nss_pkix_RDNSequence_V_Create(arenaOpt, count, ap); + va_end(ap); + + return rv; +} diff --git a/security/nss/lib/pkix/src/RDNSequence/CreateFromArray.c b/security/nss/lib/pkix/src/RDNSequence/CreateFromArray.c new file mode 100644 index 000000000..b6412187c --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/CreateFromArray.c @@ -0,0 +1,86 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_CreateFromArray + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRDNSequence * +NSSPKIXRDNSequence_Create +( + NSSArena *arenaOpt, + PRUint32 count, + NSSPKIXRelativeDistinguishedName *rdns[] +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } + + { + PRUint32 i; + + for( i = 0; i < count; i++ ) { + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(&rdns[i]) ) { + return (NSSPKIXAttribute *)NULL; + } + } + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_CreateFromArray(arenaOpt, count, rnds); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/CreateFromUTF8.c b/security/nss/lib/pkix/src/RDNSequence/CreateFromUTF8.c new file mode 100644 index 000000000..dcdbc54a2 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/CreateFromUTF8.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRDNSequence * +NSSPKIXRDNSequence_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRDNSequence *)NULL; + } + } + + if( (NSSUTF8 *)NULL == string ) { + nss_SetError(NSS_ERROR_INVALID_STRING); + return (NSSPKIXRDNSequence *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_CreateFromUTF8(arenaOpt, string); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/Decode.c b/security/nss/lib/pkix/src/RDNSequence/Decode.c new file mode 100644 index 000000000..ebbad116a --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/Decode.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRDNSequence * +NSSPKIXRDNSequence_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRDNSequence *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXRDNSequence *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_Decode(arenaOpt, ber); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/Destroy.c b/security/nss/lib/pkix/src/RDNSequence/Destroy.c new file mode 100644 index 000000000..5962364e5 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/Destroy.c @@ -0,0 +1,70 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXRDNSequence_Destroy +( + NSSPKIXRDNSequence *rdnseq +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_Destroy(rdnseq); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/Duplicate.c b/security/nss/lib/pkix/src/RDNSequence/Duplicate.c new file mode 100644 index 000000000..2bf53ba59 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/Duplicate.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRDNSequence * +NSSPKIXRDNSequence_Duplicate +( + NSSPKIXRDNSequence *rdnseq, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return (NSSPKIXRDNSequence *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRDNSequence *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_Duplicate(rdnseq, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/Encode.c b/security/nss/lib/pkix/src/RDNSequence/Encode.c new file mode 100644 index 000000000..84ab4db67 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/Encode.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSBER * +NSSPKIXRDNSequence_Encode +( + NSSPKIXRDNSequence *rdnseq, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_Encode(rdnseq, encoding, rvOpt, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/Equal.c b/security/nss/lib/pkix/src/RDNSequence/Equal.c new file mode 100644 index 000000000..fe0fa0f07 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/Equal.c @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_IMPLEMENT PRBool +NSSPKIXRDNSequence_Equal +( + NSSPKIXRDNSequence *one, + NSSPKIXRDNSequence *two, + PRStatus *statusOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(one) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + + return PR_FALSE; + } + + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(two) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + + return PR_FALSE; + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_Equal(one, two, statusOpt); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/FindRelativeDistinguishedName.c b/security/nss/lib/pkix/src/RDNSequence/FindRelativeDistinguishedName.c new file mode 100644 index 000000000..cb04286d3 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/FindRelativeDistinguishedName.c @@ -0,0 +1,78 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_FindRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified attribute value upon success + * -1 upon failure. + */ + +NSS_IMPLEMENT PRInt32 +NSSPKIXRDNSequence_FindRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rdn +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_FindRelativeDistinguishedName(rdnseq, rdn); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/GetRelativeDistinguishedName.c b/security/nss/lib/pkix/src/RDNSequence/GetRelativeDistinguishedName.c new file mode 100644 index 000000000..9b152f4da --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/GetRelativeDistinguishedName.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_GetRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRelativeDistinguishedName * +NSSPKIXRDNSequence_GetRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_GetRelativeDistinguishedName(rdnseq, i, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/GetRelativeDistinguishedNameCount.c b/security/nss/lib/pkix/src/RDNSequence/GetRelativeDistinguishedNameCount.c new file mode 100644 index 000000000..05b5e89b4 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/GetRelativeDistinguishedNameCount.c @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_GetRelativeDistinguishedNameCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_IMPLEMENT PRInt32 +NSSPKIXRDNSequence_GetRelativeDistinguishedNameCount +( + NSSPKIXRDNSequence *rdnseq +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return -1; + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_GetRelativeDistinguishedNameCount(rdnseq); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/GetRelativeDistinguishedNames.c b/security/nss/lib/pkix/src/RDNSequence/GetRelativeDistinguishedNames.c new file mode 100644 index 000000000..06d419bed --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/GetRelativeDistinguishedNames.c @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_GetRelativeDistinguishedNames + * + * This routine returns all of the relative distinguished names in the + * specified RDN Sequence. {...} If the array is allocated, or if the + * specified one has extra space, the array will be null-terminated. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXRelativeDistinguishedName + * pointers upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXRelativeDistinguishedName ** +NSSPKIXRDNSequence_GetRelativeDistinguishedNames +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return (NSSPKIXRelativeDistinguishedName **)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyOpt(attribute) ) { + return (NSSPKIXRelativeDistinguishedName **)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_GetRelativeDistinguishedNames(rdnseq, rvOpt, limit, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/GetUTF8Encoding.c b/security/nss/lib/pkix/src/RDNSequence/GetUTF8Encoding.c new file mode 100644 index 000000000..4519a5ba4 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/GetUTF8Encoding.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSUTF8 * +NSSPKIXRDNSequence_GetUTF8Encoding +( + NSSPKIXRDNSequence *rdnseq, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return (NSSUTF8 *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSUTF8 *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_GetUTF8Encoding(rdnseq, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/InsertRelativeDistinguishedName.c b/security/nss/lib/pkix/src/RDNSequence/InsertRelativeDistinguishedName.c new file mode 100644 index 000000000..433c2a315 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/InsertRelativeDistinguishedName.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_InsertRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXRDNSequence_InsertRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i, + NSSPKIXRelativeDistinguishedName *rdn +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_InsertRelativeDistinguishedName(rdnseq, i, rdn); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/MClear.c b/security/nss/lib/pkix/src/RDNSequence/MClear.c new file mode 100644 index 000000000..7df7eb099 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/MClear.c @@ -0,0 +1,73 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nss_pkix_RDNSequence_Clear + * + * Wipes out cached data. + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_RDNSequence_Clear +( + NSSPKIXRDNSequence *rdnseq +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( (NSSBER *)NULL != rdnseq->ber ) { + nss_ZFreeIf(rdnseq->ber->data); + nss_ZFreeIf(rdnseq->ber); + } + + if( (NSSDER *)NULL != rdnseq->der ) { + nss_ZFreeIf(rdnseq->der->data); + nss_ZFreeIf(rdnseq->der); + } + + nss_ZFreeIf(rdnseq->utf8); + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/RDNSequence/MCount.c b/security/nss/lib/pkix/src/RDNSequence/MCount.c new file mode 100644 index 000000000..649721c9f --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/MCount.c @@ -0,0 +1,82 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +/* + * nss_pkix_RDNSequence_Count + */ + +NSS_IMPLEMENT void +nss_pkix_RDNSequence_Count +( + NSSPKIXRDNSequence *rdnseq +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return; + } +#endif /* NSSDEBUG */ + + PR_ASSERT((NSSPKIXRelativeDistinguishedName **)NULL != rdnseq->rdns); + if( (NSSPKIXRelativeDistinguishedName **)NULL == rdnseq->rdns ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + return PR_FAILURE; + } + + if( 0 == rdnseq->count ) { + PRUint32 i; + for( i = 0; i < 0xFFFFFFFF; i++ ) { + if( (NSSPKIXRelativeDistinguishedName *)NULL == rdnseq->rdns[i] ) { + break; + } + } + +#ifdef PEDANTIC + if( 0xFFFFFFFF == i ) { + return; + } +#endif /* PEDANTIC */ + + rdnseq->count = i; + } + + return; +} diff --git a/security/nss/lib/pkix/src/RDNSequence/MVCreate.c b/security/nss/lib/pkix/src/RDNSequence/MVCreate.c new file mode 100644 index 000000000..caeb1995f --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/MVCreate.c @@ -0,0 +1,141 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nss_pkix_RDNSequence_v_create + */ + +NSS_IMPLEMENT NSSPKIXRDNSequence * +nss_pkix_RDNSequence_v_create +( + NSSArena *arenaOpt, + PRUint32 count, + va_list ap +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXRDNSequence *rv = (NSSPKIXRDNSequence *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRDNSequence *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXRDNSequence); + if( (NSSPKIXRDNSequence *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->count = count; + + rv->rdns = nss_ZNEWARRAY(arena, NSSPKIXRelativeDistinguishedName *, count); + if( (NSSPKIXRelativeDistinguishedName **)NULL == rv->rdns ) { + goto loser; + } + + for( i = 0; i < count; i++ ) { + NSSPKIXRelativeDistinguishedName *v = (NSSPKIXRelativeDistinguishedName *) + va_arg(ap, NSSPKIXRelativeDistinguishedName *); + +#ifdef NSSDEBUG + /* + * It's okay to test this down here, since + * supposedly these have already been checked. + */ + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(v) ) { + goto loser; + } +#endif /* NSSDEBUG */ + + rv->rdns[i] = nssPKIXRelativeDistinguishedName_Duplicate(v, arena); + if( (NSSPKIXRelativeDistinguishedName *)NULL == rv->rdns[i] ) { + goto loser; + } + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_RDNSequence_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXRDNSequence *)NULL; +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PAppendRelativeDistinguishedName.c b/security/nss/lib/pkix/src/RDNSequence/PAppendRelativeDistinguishedName.c new file mode 100644 index 000000000..9d1ea4875 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PAppendRelativeDistinguishedName.c @@ -0,0 +1,105 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_AppendRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXRDNSequence_AppendRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rdn +) +{ + NSSPKIXRelativeDistinguishedName **na; + NSSPKIXRelativeDistinguishedName *dup; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( 0 == rdnseq->count ) { + nss_pkix_RDNSequence_Count(rdnseq); + } + +#ifdef PEDANTIC + if( 0 == rdnseq->count ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } +#endif /* PEDANTIC */ + + na = (NSSPKIXRelativeDistinguishedName **) + nss_ZRealloc(rdnseq->rdns, ((rdnseq->count+2) * + sizeof(NSSPKIXRelativeDistinguishedName *))); + if( (NSSPKIXRelativeDistinguishedName **)NULL == na ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + rdnseq->rdns = na; + + dup = nssPKIXRelativeDistinguishedName_Duplicate(rdn, rdnseq->arena); + if( (NSSPKIXRelativeDistinguishedName *)NULL == dup ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + na[ rdnseq->count++ ] = dup; + + return nss_pkix_RDNSequence_Clear(rdnseq); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PCreate.c b/security/nss/lib/pkix/src/RDNSequence/PCreate.c new file mode 100644 index 000000000..0fdc6848f --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PCreate.c @@ -0,0 +1,123 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRDNSequence * +nssPKIXRDNSequence_Create +( + NSSArena *arenaOpt, + NSSPKIXRelativeDistinguishedName *rdn1, + ... +) +{ + va_list ap; + NSSPKIXRDNSequence *rv; + PRUint32 count; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRDNSequence *)NULL; + } + } + + /* Is there a nonzero minimum number of RDNs required? */ + + { + va_start(ap, arenaOpt); + + while( 1 ) { + NSSPKIXRelativeDistinguishedName *rdn; + rdn = (NSSPKIXRelativeDistinguishedName *)va_arg(ap, NSSPKIXRelativeDistinguishedName *); + if( (NSSPKIXRelativeDistinguishedName *)NULL == rdn ) { + break; + } + + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + va_end(ap); + return (NSSPKIXRDNSequence *)NULL; + } + } + + va_end(ap); + } +#endif /* NSSDEBUG */ + + va_start(ap, arenaOpt); + + for( count = 0; ; count++ ) { + NSSPKIXRelativeDistinguishedName *rdn; + rdn = (NSSPKIXRelativeDistinguishedName *)va_arg(ap, NSSPKIXRelativeDistinguishedName *); + if( (NSSPKIXRelativeDistinguishedName *)NULL == rdn ) { + break; + } + +#ifdef PEDANTIC + if( count == 0xFFFFFFFF ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + va_end(ap); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } +#endif /* PEDANTIC */ + } + + va_end(ap); + + va_start(ap, arenaOpt); + rv = nss_pkix_RDNSequence_V_Create(arenaOpt, count, ap); + va_end(ap); + + return rv; +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PCreateFromArray.c b/security/nss/lib/pkix/src/RDNSequence/PCreateFromArray.c new file mode 100644 index 000000000..0e244cb73 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PCreateFromArray.c @@ -0,0 +1,151 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_CreateFromArray + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRDNSequence * +nssPKIXRDNSequence_CreateFromArray +( + NSSArena *arenaOpt, + PRUint32 count, + NSSPKIXRelativeDistinguishedName *rdns[] +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXRDNSequence *rv = (NSSPKIXRDNSequence *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } + + { + PRUint32 i; + + for( i = 0; i < count; i++ ) { + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(&rdns[i]) ) { + return (NSSPKIXAttribute *)NULL; + } + } + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXRDNSequence); + if( (NSSPKIXRDNSequence *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->count = count; + + rv->rdns = nss_ZNEWARRAY(arena, NSSPKIXRelativeDistinguishedName *, (count+1)); + if( (NSSPKIXRelativeDistinguishedName **)NULL == rv->rdns ) { + goto loser; + } + + for( i = 0; i < count; i++ ) { + NSSPKIXRelativeDistinguishedName *v = rdns[i]; + + rv->rdns[i] = nssPKIXRelativeDistinguishedName_Duplicate(v, arena); + if( (NSSPKIXRelativeDistinguishedName *)NULL == rv->rdns[i] ) { + goto loser; + } + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_RDNSequence_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXRDNSequence *)NULL; +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PCreateFromUTF8.c b/security/nss/lib/pkix/src/RDNSequence/PCreateFromUTF8.c new file mode 100644 index 000000000..196332665 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PCreateFromUTF8.c @@ -0,0 +1,139 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRDNSequence * +nssPKIXRDNSequence_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXRDNSequence *rv = (NSSPKIXRDNSequence *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRDNSequence *)NULL; + } + } + + if( (NSSUTF8 *)NULL == string ) { + nss_SetError(NSS_ERROR_INVALID_STRING); + return (NSSPKIXRDNSequence *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXRDNSequence); + if( (NSSPKIXRDNSequence *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->utf8 = nssUTF8_Duplicate(string, arena); + if( (NSSUTF8 *)NULL == rv->utf8 ) { + goto loser; + } + + /* Insert intelligence here -- fgmr */ + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + goto loser; + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_RDNSequence_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXRDNSequence *)NULL; +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PDecode.c b/security/nss/lib/pkix/src/RDNSequence/PDecode.c new file mode 100644 index 000000000..557f5bc32 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PDecode.c @@ -0,0 +1,138 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRDNSequence * +nssPKIXRDNSequence_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXRDNSequence *rv = (NSSPKIXRDNSequence *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRDNSequence *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXRDNSequence *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXRDNSequence); + if( (NSSPKIXRDNSequence *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->ber = nssItem_Duplicate(ber, arena, (NSSItem *)NULL); + if( (NSSItem *)NULL == rv->ber ) { + goto loser; + } + + status = nssASN1_DecodeBER(arena, rv, nssPKIXRDNSequence_template, ber); + if( PR_SUCCESS != status ) { + goto loser; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_RDNSequence_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXRDNSequence *)NULL; +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PDestroy.c b/security/nss/lib/pkix/src/RDNSequence/PDestroy.c new file mode 100644 index 000000000..17cc846cf --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PDestroy.c @@ -0,0 +1,76 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXRDNSequence_Destroy +( + NSSPKIXRDNSequence *rdnseq +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + +#ifdef DEBUG + (void)nss_pkix_RDNSequence_remove_pointer(rdnseq); +#endif /* DEBUG */ + + if( PR_TRUE == rdnseq->i_allocated_arena ) { + return nssArena_Destroy(rdnseq->arena); + } + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PDuplicate.c b/security/nss/lib/pkix/src/RDNSequence/PDuplicate.c new file mode 100644 index 000000000..a57828692 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PDuplicate.c @@ -0,0 +1,177 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXRDNSequence upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRDNSequence * +nssPKIXRDNSequence_Duplicate +( + NSSPKIXRDNSequence *rdnseq, + NSSArena *arenaOpt +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXRDNSequence *rv = (NSSPKIXRDNSequence *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyOpt(attribute) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXRDNSequence); + if( (NSSPKIXRDNSequence *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + + if( (NSSBER *)NULL != rdnseq->ber ) { + rv->ber = nssItem_Duplicate(rdnseq->ber, arena, (NSSItem *)NULL); + if( (NSSBER *)NULL == rv->ber ) { + goto loser; + } + } + + if( (NSSDER *)NULL != rdnseq->der ) { + rv->der = nssItem_Duplicate(rdnseq->der, arena, (NSSItem *)NULL); + if( (NSSDER *)NULL == rv->der ) { + goto loser; + } + } + + if( (NSSUTF8 *)NULL != rdnseq->utf8 ) { + rv->utf8 = nssUTF8_duplicate(rdnseq->utf8, arena); + if( (NSSUTF8 *)NULL == rv->utf8 ) { + goto loser; + } + } + + if( 0 == rdnseq->count ) { + nss_pkix_RDNSequence_Count(rdnseq); + } + +#ifdef PEDANTIC + if( 0 == rdnseq->count ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } +#endif /* PEDANTIC */ + + rv->count = rdnseq->count; + + rv->rdns = nss_ZNEWARRAY(arena, NSSPKIXRelativeDistinguishedName *, (rv->count+1)); + if( (NSSPKIXRelativeDistinguishedName **)NULL == rv->rdns ) { + goto loser; + } + + for( i = 0; i < count; i++ ) { + NSSPKIXRelativeDistinguishedName *v = rdnseq->rdns[i]; + + rv->rdns[i] = nssPKIXRelativeDistinguishedName_Duplicate(v, arena); + if( (NSSPKIXRelativeDistinguishedName *)NULL == rv->rdns[i] ) { + goto loser; + } + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_RDNSequence_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXRDNSequence *)NULL; +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PEncode.c b/security/nss/lib/pkix/src/RDNSequence/PEncode.c new file mode 100644 index 000000000..5700fa099 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PEncode.c @@ -0,0 +1,118 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSBER * +nssPKIXRDNSequence_Encode +( + NSSPKIXRDNSequence *rdnseq, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + NSSBER *it; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* NSSDEBUG */ + + switch( encoding ) { + case NSSASN1BER: + if( (NSSBER *)NULL != rdnseq->ber ) { + it = rdnseq->ber; + goto done; + } + /*FALLTHROUGH*/ + case NSSASN1DER: + if( (NSSDER *)NULL != rdnseq->der ) { + it = rdnseq->der; + goto done; + } + break; + default: + nss_SetError(NSS_ERROR_UNSUPPORTED_ENCODING); + return (NSSBER *)NULL; + } + + it = nssASN1_EncodeItem(rdnseq->arena, (NSSItem *)NULL, rdnseq, + nssPKIXRDNSequence_template, encoding); + if( (NSSBER *)NULL == it ) { + return (NSSBER *)NULL; + } + + switch( encoding ) { + case NSSASN1BER: + rdnseq->ber = it; + break; + case NSSASN1DER: + rdnseq->der = it; + break; + default: + PR_ASSERT(0); + break; + } + + done: + return nssItem_Duplicate(it, arenaOpt, rvOpt); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PEqual.c b/security/nss/lib/pkix/src/RDNSequence/PEqual.c new file mode 100644 index 000000000..a1dd5af53 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PEqual.c @@ -0,0 +1,107 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_IMPLEMENT PRBool +nssPKIXRDNSequence_Equal +( + NSSPKIXRDNSequence *one, + NSSPKIXRDNSequence *two, + PRStatus *statusOpt +) +{ + NSSPKIXRelativeDistinguishedName **a; + NSSPKIXRelativeDistinguishedName **b; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(one) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; + } + + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(two) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; + } +#endif /* NSSDEBUG */ + + if( ((NSSDER *)NULL != one->der) && ((NSSDER *)NULL != two->der) ) { + return nssItem_Equal(one->der, two->der, statusOpt); + } + + /* + * Since this is a sequence, the order is significant. + * So we just walk down both lists, comparing. + */ + + for( a = one->rdns, b = two->rdns; *a && *b; a++, b++ ) { + if( PR_FALSE == nssPKIXRelativeDistinguishedName_Equal(*a, *b, statusOpt) ) { + return PR_FALSE; + } + } + + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_SUCCESS; + } + + if( *a || *b ) { + return PR_FALSE; + } + + return PR_TRUE; +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PFindRelativeDistinguishedName.c b/security/nss/lib/pkix/src/RDNSequence/PFindRelativeDistinguishedName.c new file mode 100644 index 000000000..8064b9636 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PFindRelativeDistinguishedName.c @@ -0,0 +1,90 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_FindRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified attribute value upon success + * -1 upon failure. + */ + +NSS_IMPLEMENT PRInt32 +nssPKIXRDNSequence_FindRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rdn +) +{ + PRUint32 i; + NSSPKIXRelativeDistinguishedName **a; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + for( i = 0, a = rdnseq->rdns; *a; a++, (i > 0x7fffffff) || i++ ) { + if( PR_TRUE == nssPKIXRelativeDistinguishedName_Equal(*a, rdn) ) { + if( i > 0x7fffffff ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return -1; + } + return (PRInt32)i; + } + } + + nss_SetError(NSS_ERROR_NOT_FOUND); + return -1; +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PGetRelativeDistinguishedName.c b/security/nss/lib/pkix/src/RDNSequence/PGetRelativeDistinguishedName.c new file mode 100644 index 000000000..7ea20d259 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PGetRelativeDistinguishedName.c @@ -0,0 +1,96 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_GetRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRelativeDistinguishedName * +nssPKIXRDNSequence_GetRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i, + NSSArena *arenaOpt +) +{ + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyOpt(attribute) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( 0 == rdnseq->count ) { + nss_pkix_RDNSequence_Count(rdnseq); + } + +#ifdef PEDANTIC + if( 0 == rdnseq->count ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } +#endif /* PEDANTIC */ + + if( (i < 0) || (i >= rdnseq->count) ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + return nssPKIXRelativeDistinguishedName_Duplicate(rdnseq->rdns[i], arenaOpt); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PGetRelativeDistinguishedNameCount.c b/security/nss/lib/pkix/src/RDNSequence/PGetRelativeDistinguishedNameCount.c new file mode 100644 index 000000000..a01077db1 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PGetRelativeDistinguishedNameCount.c @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_GetRelativeDistinguishedNameCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_IMPLEMENT PRInt32 +nssPKIXRDNSequence_GetRelativeDistinguishedNameCount +( + NSSPKIXRDNSequence *rdnseq +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return -1; + } +#endif /* NSSDEBUG */ + + if( 0 == rdnseq->count ) { + nss_pkix_RDNSequence_Count(rdnseq); + } + +#ifdef PEDANTIC + if( 0 == rdnseq->count ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return -1; + } +#endif /* PEDANTIC */ + + if( rdnseq->count > 0x7fffffff ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return -1; + } + + return (PRInt32)(rdnseq->count); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PGetRelativeDistinguishedNames.c b/security/nss/lib/pkix/src/RDNSequence/PGetRelativeDistinguishedNames.c new file mode 100644 index 000000000..115480dfd --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PGetRelativeDistinguishedNames.c @@ -0,0 +1,135 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_GetRelativeDistinguishedNames + * + * This routine returns all of the relative distinguished names in the + * specified RDN Sequence. {...} If the array is allocated, or if the + * specified one has extra space, the array will be null-terminated. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXRelativeDistinguishedName + * pointers upon success + * NULL upon failure. + */ + +NSS_IMPLEMENT NSSPKIXRelativeDistinguishedName ** +nssPKIXRDNSequence_GetRelativeDistinguishedNames +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +) +{ + NSSPKIXRelativeDistinguishedName **rv = (NSSPKIXRelativeDistinguishedName **)NULL; + PRUint32 i; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return (NSSPKIXRelativeDistinguishedName **)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyOpt(attribute) ) { + return (NSSPKIXRelativeDistinguishedName **)NULL; + } + } +#endif /* NSSDEBUG */ + + if( 0 == rdnseq->count ) { + nss_pkix_RDNSequence_Count(rdnseq); + } + +#ifdef PEDANTIC + if( 0 == rdnseq->count ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXRelativeDistinguishedName **)NULL; + } +#endif /* PEDANTIC */ + + if( (limit < rdnseq->count) && + !((0 == limit) && ((NSSPKIXRelativeDistinguishedName **)NULL == rvOpt)) ) { + nss_SetError(NSS_ERROR_ARRAY_TOO_SMALL); + return (NSSPKIXRelativeDistinguishedName **)NULL; + } + + limit = rdnseq->count; + if( (NSSPKIXRelativeDistinguishedName **)NULL == rvOpt ) { + rv = nss_ZNEWARRAY(arenaOpt, NSSPKIXRelativeDistinguishedName *, limit); + if( (NSSPKIXRelativeDistinguishedName **)NULL == rv ) { + return (NSSPKIXRelativeDistinguishedName **)NULL; + } + } else { + rv = rvOpt; + } + + for( i = 0; i < limit; i++ ) { + rv[i] = nssPKIXRelativedistinguishedName_Duplicate(rdnseq->rdns[i], arenaOpt); + if( (NSSPKIXRelativeDistinguishedName *)NULL == rv[i] ) { + goto loser; + } + } + + return rv; + + loser: + for( i = 0; i < limit; i++ ) { + NSSPKIXRelativeDistinguishedName *x = rv[i]; + if( (NSSPKIXRelativeDistinguishedName *)NULL == x ) { + break; + } + (void)nssPKIXRelativeDistinguishedName_Destroy(x); + } + + if( rv != rvOpt ) { + nss_ZFreeIf(rv); + } + + return (NSSPKIXRelativeDistinguishedName **)NULL; +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PGetUTF8Encoding.c b/security/nss/lib/pkix/src/RDNSequence/PGetUTF8Encoding.c new file mode 100644 index 000000000..2250bf960 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PGetUTF8Encoding.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSUTF8 * +nssPKIXRDNSequence_GetUTF8Encoding +( + NSSPKIXRDNSequence *rdnseq, + NSSArena *arenaOpt +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return (NSSUTF8 *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSUTF8 *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSUTF8 *)NULL == rdnseq->utf8 ) { + /* xxx fgmr fill this in from pki1 implementation */ + } + + return nssUTF8_Duplicate(rdnseq->utf8, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PInsertRelativeDistinguishedName.c b/security/nss/lib/pkix/src/RDNSequence/PInsertRelativeDistinguishedName.c new file mode 100644 index 000000000..213866694 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PInsertRelativeDistinguishedName.c @@ -0,0 +1,117 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_InsertRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXRDNSequence_InsertRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i, + NSSPKIXRelativeDistinguishedName *rdn +) +{ + NSSPKIXRelativeDistinguishedName **na; + NSSPKIXRelativeDistinguishedName *dup; + PRInt32 c; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( 0 == rdnseq->count ) { + nss_pkix_RDNSequence_Count(rdnseq); + } + +#ifdef PEDANTIC + if( 0 == rdnseq->count ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } +#endif /* PEDANTIC */ + + if( (i < 0) || (i >= rdnseq->count) ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + na = (NSSPKIXRelativeDistinguishedName **) + nss_ZRealloc(rdnseq->rdns, ((rdnseq->count+2) * + sizeof(NSSPKIXRelativeDistinguishedName *))); + if( (NSSPKIXRelativeDistinguishedName **)NULL == na ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + rdnseq->rdns = na; + + dup = nssPKIXRelativeDistinguishedName_Duplicate(rdn, rdnseq->arena); + if( (NSSPKIXRelativeDistinguishedName *)NULL == dup ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + for( c = rdnseq->count; c > i; c-- ) { + na[ c ] = na[ c-1 ]; + } + + na[ i ] = dup; + rdnseq->count++; + + return nss_pkix_RDNSequence_Clear(rdnseq); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PRemoveRelativeDistinguishedName.c b/security/nss/lib/pkix/src/RDNSequence/PRemoveRelativeDistinguishedName.c new file mode 100644 index 000000000..447620c77 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PRemoveRelativeDistinguishedName.c @@ -0,0 +1,104 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_RemoveRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXRDNSequence_RemoveRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i +) +{ + NSSPKIXRelativeDistinguishedName **na; + PRInt32 c; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( 0 == rdnseq->count ) { + nss_pkix_RDNSequence_Count(rdnseq); + } + +#ifdef PEDANTIC + if( 0 == rdnseq->count ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } +#endif /* PEDANTIC */ + + if( (i < 0) || (i >= rdnseq->count) ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + nssPKIXRelativeDistinguishedName_Destroy(rdnseq->rdns[i]); + + rdnseq->rdns[i] = rdnseq->rdns[ rdnseq->count ]; + rdnseq->rdns[ rdnseq->count ] = (NSSPKIXRelativeDistinguishedName *)NULL; + rdnseq->count--; + + na = (NSSPKIXRelativeDistinguishedName **) + nss_ZRealloc(rdnseq->rdns, ((rdnseq->count) * + sizeof(NSSPKIXRelativeDistinguishedName *))); + if( (NSSPKIXRelativeDistinguishedName **)NULL == na ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + rdnseq->rdns = na; + + return nss_pkix_RDNSequence_Clear(rdnseq); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PSetRelativeDistinguishedName.c b/security/nss/lib/pkix/src/RDNSequence/PSetRelativeDistinguishedName.c new file mode 100644 index 000000000..5c8123266 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PSetRelativeDistinguishedName.c @@ -0,0 +1,103 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_SetRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXRDNSequence_SetRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i, + NSSPKIXRelativeDistinguishedName *rdn +) +{ + NSSPKIXRelativeDistinguishedName *dup; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( 0 == rdnseq->count ) { + nss_pkix_RDNSequence_Count(rdnseq); + } + +#ifdef PEDANTIC + if( 0 == rdnseq->count ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } +#endif /* PEDANTIC */ + + if( (i < 0) || (i >= rdnseq->count) ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + dup = nssPKIXRelativeDistinguishedName_Duplicate(rdn, rdnseq->arena); + if( (NSSPKIXRelativeDistinguishedName *)NULL == dup ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + nssPKIXRelativeDistinguishedName_Destroy(rdnseq->rdns[i]); + rdnseq->rdns[i] = dup; + + return nss_pkix_RDNSequence_Clear(rdnseq); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/PSetRelativeDistinguishedNames.c b/security/nss/lib/pkix/src/RDNSequence/PSetRelativeDistinguishedNames.c new file mode 100644 index 000000000..b0320a4b7 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/PSetRelativeDistinguishedNames.c @@ -0,0 +1,153 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRDNSequence_SetRelativeDistinguishedNames + * + * -- fgmr comments -- + * If the array pointer itself is null, the set is considered empty. + * If the count is zero but the pointer nonnull, the array will be + * assumed to be null-terminated. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXRDNSequence_SetRelativeDistinguishedNames +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rdns[], + PRInt32 countOpt +) +{ + NSSPKIXRelativeDistinguishedName **ip; + NSSPKIXRelativeDistinguishedName **newarray; + PRUint32 i; + nssArenaMark *mark; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } + + if( (NSSPKIXRelativeDistinguishedName **)NULL == rdns ) { + nss_SetError(NSS_ERROR_INVALID_POINTER); + return PR_FAILURE; + } + + { + PRUint32 i, count; + + if( 0 == countOpt ) { + for( i = 0; i < 0x80000000; i++ ) { + if( (NSSPKIXRelativeDistinguishedName *)NULL == rdns[i] ) { + break; + } + } + +#ifdef PEDANTIC + if( 0x80000000 == i ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } +#endif /* PEDANTIC */ + + count = (PRUint32)i; + } else { + if( countOpt < 0 ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } + + count = (PRUint32)countOpt; + } + + for( i = 0; i < count; i++ ) { + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdns[i]) ) { + return PR_FAILURE; + } + } + } +#endif /* NSSDEBUG */ + + mark = nssArena_Mark(rdnseq->mark); + if( (nssArenaMark *)NULL == mark ) { + return PR_FAILURE; + } + + newarray = nss_ZNEWARRAY(rdnseq->arena, NSSPKIXRelativeDistinguishedName *, countOpt); + if( (NSSPKIXRelativeDistinguishedName **)NULL == newarray ) { + goto loser; + } + + for( i = 0; i < countOpt; i++ ) { + newarray[i] = nssPKIXRelativeDistinguishedName_Duplicate(rdns[i], rdnseq->arena); + if( (NSSPKIXRelativeDistinguishedName *)NULL == newarray[i] ) { + goto loser; + } + } + + for( i = 0; i < rdnseq->count; i++ ) { + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_Destroy(rdnseq->rdns[i]) ) { + goto loser; + } + } + + nss_ZFreeIf(rdnseq->rdns); + + rdnseq->count = countOpt; + rdnseq->rdns = newarray; + + (void)nss_pkix_RDNSequence_Clear(rdnseq); + + return nssArena_Unmark(rdnseq->arena, mark); + + loser: + (void)nssArena_Release(a->arena, mark); + return PR_FAILURE; +} + diff --git a/security/nss/lib/pkix/src/RDNSequence/RemoveRelativeDistinguishedName.c b/security/nss/lib/pkix/src/RDNSequence/RemoveRelativeDistinguishedName.c new file mode 100644 index 000000000..141ab7f37 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/RemoveRelativeDistinguishedName.c @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_RemoveRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXRDNSequence_RemoveRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_RemoveRelativeDistinguishedName(rdnseq, i); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/SetRelativeDistinguishedName.c b/security/nss/lib/pkix/src/RDNSequence/SetRelativeDistinguishedName.c new file mode 100644 index 000000000..7484eb55d --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/SetRelativeDistinguishedName.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_SetRelativeDistinguishedName + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXRDNSequence_SetRelativeDistinguishedName +( + NSSPKIXRDNSequence *rdnseq, + PRInt32 i, + NSSPKIXRelativeDistinguishedName *rdn +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_SetRelativeDistinguishedName(rdnseq, i, rdn); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/SetRelativeDistinguishedNames.c b/security/nss/lib/pkix/src/RDNSequence/SetRelativeDistinguishedNames.c new file mode 100644 index 000000000..40e7c8247 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/SetRelativeDistinguishedNames.c @@ -0,0 +1,115 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRDNSequence_SetRelativeDistinguishedNames + * + * -- fgmr comments -- + * If the array pointer itself is null, the set is considered empty. + * If the count is zero but the pointer nonnull, the array will be + * assumed to be null-terminated. + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN_SEQUENCE + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXRDNSequence_SetRelativeDistinguishedNames +( + NSSPKIXRDNSequence *rdnseq, + NSSPKIXRelativeDistinguishedName *rdns[], + PRInt32 countOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRDNSequence_verifyPointer(rdnseq) ) { + return PR_FAILURE; + } + + if( (NSSPKIXRelativeDistinguishedName **)NULL == rdns ) { + nss_SetError(NSS_ERROR_INVALID_POINTER); + return PR_FAILURE; + } + + { + PRUint32 i, count; + + if( 0 == countOpt ) { + for( i = 0; i < 0x80000000; i++ ) { + if( (NSSPKIXRelativeDistinguishedName *)NULL == rdns[i] ) { + break; + } + } + +#ifdef PEDANTIC + if( 0x80000000 == i ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } +#endif /* PEDANTIC */ + + count = (PRUint32)i; + } else { + if( countOpt < 0 ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } + + count = (PRUint32)countOpt; + } + + for( i = 0; i < count; i++ ) { + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdns[i]) ) { + return PR_FAILURE; + } + } + } +#endif /* DEBUG */ + + return nssPKIXRDNSequence_SetRelativeDistinguishedNames(rdnseq, rdns, countOpt); +} diff --git a/security/nss/lib/pkix/src/RDNSequence/template.c b/security/nss/lib/pkix/src/RDNSequence/template.c new file mode 100644 index 000000000..ff5bbc0ba --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/template.c @@ -0,0 +1,55 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifndef ASN1_H +#include "asn1.h" +#endif /* ASN1_H */ + +/* + * nssPKIXRDNSequence_template + * + */ + +const nssASN1Template nssPKIXRDNSequence_template[] = { + { nssASN1_SEQUENCE_OF, offsetof(NSSPKIXRDNSequence, rdns), + nssPKIXRelativeDistinguishedName_template }, + { 0 } +}; diff --git a/security/nss/lib/pkix/src/RDNSequence/verifyPointer.c b/security/nss/lib/pkix/src/RDNSequence/verifyPointer.c new file mode 100644 index 000000000..47a53a5c4 --- /dev/null +++ b/security/nss/lib/pkix/src/RDNSequence/verifyPointer.c @@ -0,0 +1,205 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +#ifdef DEBUG + +extern const NSSError NSS_ERROR_INTERNAL_ERROR; + +static nssPointerTracker pkix_rdnseq_pointer_tracker; + +/* + * nss_pkix_RDNSequence_add_pointer + * + * This method is only present in debug builds. + * + * This module-private routine adds an NSSPKIXRDNSequence pointer to + * the internal pointer-tracker. This routine should only be used + * by the NSSPKIX module. This routine returns a PRStatus value; + * upon error it will place an error on the error stack and return + * PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_RDNSequence_add_pointer +( + const NSSPKIXRDNSequence *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_rdnseq_pointer_tracker); + if( PR_SUCCESS != rv ) { + return rv; + } + + rv = nssPointerTracker_add(&pkix_rdnseq_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + NSSError e = NSS_GetError(); + if( NSS_ERROR_NO_MEMORY != e ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + + return rv; + } + + rv = nssArena_registerDestructor(arena, + nss_pkix_RDNSequence_remove_pointer, p); + if( PR_SUCCESS != rv ) { + (void)nss_pkix_RDNSequence_remove_pointer(p); + return rv; + } + +#ifdef NSSDEBUG + { + NSSPKIXRelativeDistinguishedName *r; + + for( r = p->rdns; *r; r++ ) { + if( PR_SUCCESS != nss_pkix_RelativeDistinguishedName_add_pointer(*r) ) { + (void)nss_pkix_RDNSequence_remove_pointer(p); + return PR_FAILURE; + } + } + } +#endif /* NSSDEBUG */ + + return PR_SUCCESS; +} + +/* + * nss_pkix_RDNSequence_remove_pointer + * + * This method is only present in debug builds. + * + * This module-private routine removes a valid NSSPKIXRDNSequence + * pointer from the internal pointer-tracker. This routine should + * only be used by the NSSPKIX module. This routine returns a + * PRStatus value; upon error it will place an error on the error + * stack and return PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_RDNSequence_remove_pointer +( + const NSSPKIXRDNSequence *p +) +{ + PRStatus rv; + +#ifdef NSSDEBUG + { + NSSPKIXRelativeDistinguishedName *r; + + for( r = p->rdns; *r; r++ ) { + (void)nss_pkix_RelativeDistinguishedName_remove_pointer(*r); + } + } +#endif /* NSSDEBUG */ + + rv = nssPointerTracker_remove(&pkix_rdnseq_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + + /* + * nssArena_deregisterDestructor(p->arena, + * nss_pkix_RDNSequence_remove_pointer, p); + */ + + return rv; +} + +/* + * nssPKIXRDNSequence_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXRDNSequence + * 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_PKIX_ATTRIBUTE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_IMPLEMENT PRStatus +nssPKIXRDNSequence_verifyPointer +( + NSSPKIXRDNSequence *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_rdnseq_pointer_tracker); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_ATTRIBUTE); + return PR_FAILURE; + } + + rv = nssPointerTracker_verify(&pkix_rdnseq_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_ATTRIBUTE); + return PR_FAILURE; + } + + return PR_SUCCESS; +} + +#endif /* DEBUG */ + diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/AddAttributeTypeAndValue.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/AddAttributeTypeAndValue.c new file mode 100644 index 000000000..efb142396 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/AddAttributeTypeAndValue.c @@ -0,0 +1,77 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_AddAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXRelativeDistinguishedName_AddAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *atav +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_AddAttributeTypeAndValue(rdn, atav); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/Create.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/Create.c new file mode 100644 index 000000000..52e139c69 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/Create.c @@ -0,0 +1,125 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ATAV + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +NSSPKIXRelativeDistinguishedName_Create +( + NSSArena *arenaOpt, + NSSPKIXAttributeTypeAndValue *atav1, + ... +) +{ + va_list ap; + NSSPKIXRelativeDistinguishedName *rv; + PRUint32 count; + + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } + + /* Is there a nonzero minimum number of ATAVs required? */ + + { + va_start(ap, arenaOpt); + + while( 1 ) { + NSSPKIXAttributeTypeAndValue *atav; + atav = (NSSPKIXAttributeTypeAndValue *)va_arg(ap, NSSPKIXAttributeTypeAndValue *); + if( (NSSPKIXAttributeTypeAndValue *)NULL == atav ) { + break; + } + + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + va_end(ap); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } + + va_end(ap); + } +#endif /* DEBUG */ + + va_start(ap, arenaOpt); + + for( count = 0; ; count++ ) { + NSSPKIXAttributeTypeAndValue *atav; + atav = (NSSPKIXAttributeTypeAndValue *)va_arg(ap, NSSPKIXAttributeTypeAndValue *); + if( (NSSPKIXAttributeTypeAndValue *)NULL == atav ) { + break; + } + +#ifdef PEDANTIC + if( count == 0xFFFFFFFF ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + va_end(ap); + return (NSSPKIXAttributeTypeAndValue *)NULL; + } +#endif /* PEDANTIC */ + } + + va_end(ap); + + va_start(ap, arenaOpt); + rv = nss_pkix_RelativeDistinguishedName_V_Create(arenaOpt, count, ap); + va_end(ap); + + return rv; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/CreateFromArray.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/CreateFromArray.c new file mode 100644 index 000000000..0c01be4da --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/CreateFromArray.c @@ -0,0 +1,86 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_CreateFromArray + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ATAV + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRelativeDistinguishedName * +NSSPKIXRelativeDistinguishedName_CreateFromArray +( + NSSArena *arenaOpt, + PRUint32 count, + NSSPKIXAttributeTypeAndValue *atavs[] +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } + + { + PRUint32 i; + + for( i = 0; i < count; i++ ) { + if( PR_SUCCESS != nssAttributeTypeAndValue_verifyPointer(&atavs[i]) ) { + return (NSSPKIXAttribute *)NULL; + } + } + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_CreateFromArray(arenaOpt, count, atavs); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/CreateFromUTF8.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/CreateFromUTF8.c new file mode 100644 index 000000000..990b7acd2 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/CreateFromUTF8.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRelativeDistinguishedName * +NSSPKIXRelativeDistinguishedName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } + + if( (NSSUTF8 *)NULL == string ) { + nss_SetError(NSS_ERROR_INVALID_STRING); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_CreateFromUTF8(arenaOpt, string); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/Decode.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/Decode.c new file mode 100644 index 000000000..b8d0b243a --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/Decode.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRelativeDistinguishedName * +NSSPKIXRelativeDistinguishedName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_Decode(arenaOpt, ber); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/Destroy.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/Destroy.c new file mode 100644 index 000000000..ca8b1e85f --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/Destroy.c @@ -0,0 +1,70 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXRelativeDistinguishedName_Destroy +( + NSSPKIXRelativeDistinguishedName *rdn +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_Destroy(rdn); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/Duplicate.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/Duplicate.c new file mode 100644 index 000000000..416b405e8 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/Duplicate.c @@ -0,0 +1,80 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRelativeDistinguishedName * +NSSPKIXRelativeDistinguishedName_Duplicate +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_Duplicate(rdn, arenaOpt); +} + diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/Encode.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/Encode.c new file mode 100644 index 000000000..ea6b82a55 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/Encode.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSBER * +NSSPKIXRelativeDistinguishedName_Encode +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_Encode(rdn, encoding, rvOpt, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/Equal.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/Equal.c new file mode 100644 index 000000000..3e4a3fc3e --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/Equal.c @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_EXTERN PRBool +NSSPKIXRelativeDistinguishedName_Equal +( + NSSPKIXRelativeDistinguishedName *one, + NSSPKIXRelativeDistinguishedName *two, + PRStatus *statusOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(one) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + + return PR_FALSE; + } + + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(two) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + + return PR_FALSE; + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_Equal(one, two, statusOpt); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/FindAttributeTypeAndValue.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/FindAttributeTypeAndValue.c new file mode 100644 index 000000000..65032b1c1 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/FindAttributeTypeAndValue.c @@ -0,0 +1,78 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_FindAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified attribute value upon success + * -1 upon failure. + */ + +NSS_EXTERN PRInt32 +NSSPKIXRelativeDistinguishedName_FindAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *atav +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_FindAttributeTypeAndValue(rdn, atav); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/GetAttributeTypeAndValue.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/GetAttributeTypeAndValue.c new file mode 100644 index 000000000..1a58bd132 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/GetAttributeTypeAndValue.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeTypeAndValue * +NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + PRInt32 i, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValue(rdn, i, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/GetAttributeTypeAndValueCount.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/GetAttributeTypeAndValueCount.c new file mode 100644 index 000000000..1209e726c --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/GetAttributeTypeAndValueCount.c @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValueCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_IMPLEMENT PRInt32 +NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValueCount +( + NSSPKIXRelativeDistinguishedName *rdn +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return -1; + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValueCount(rdn); +} + diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/GetAttributeTypeAndValues.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/GetAttributeTypeAndValues.c new file mode 100644 index 000000000..7efc30173 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/GetAttributeTypeAndValues.c @@ -0,0 +1,83 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValues + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXAttributeTypeAndValue + * pointers upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeTypeAndValue ** +NSSPKIXRelativeDistinguishedName_GetAttributeTypeAndValues +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return (NSSPKIXAttributeTypeAndValue **)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyOpt(attribute) ) { + return (NSSPKIXAttributeTypeAndValue **)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValues(rdn, rvOpt, limit, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/GetUTF8Encoding.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/GetUTF8Encoding.c new file mode 100644 index 000000000..9c428ae40 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/GetUTF8Encoding.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSUTF8 * +NSSPKIXRelativeDistinguishedName_GetUTF8Encoding +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return (NSSUTF8 *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSUTF8 *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_GetUTF8Encoding(rdn, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/MClear.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/MClear.c new file mode 100644 index 000000000..2b1a93820 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/MClear.c @@ -0,0 +1,73 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nss_pkix_RelativeDistinguishedName_Clear + * + * Wipes out cached data. + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_RelativeDistinguishedName_Clear +( + NSSPKIXRelativeDistinguishedName *rdn +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( (NSSBER *)NULL != rdn->ber ) { + nss_ZFreeIf(rdn->ber->data); + nss_ZFreeIf(rdn->ber); + } + + if( (NSSDER *)NULL != rdn->der ) { + nss_ZFreeIf(rdn->der->data); + nss_ZFreeIf(rdn->der); + } + + nss_ZFreeIf(rdn->utf8); + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/MCount.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/MCount.c new file mode 100644 index 000000000..23d976160 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/MCount.c @@ -0,0 +1,82 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +/* + * nss_pkix_RelativeDistinguishedName_Count + */ + +NSS_IMPLEMENT void +nss_pkix_RelativeDistinguishedName_Count +( + NSSPKIXRelativeDistinguishedName *rdn +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return; + } +#endif /* NSSDEBUG */ + + PR_ASSERT((NSSPKIXAttributeTypeAndValue **)NULL != rdn->atavs); + if( (NSSPKIXAttributeTypeAndValue **)NULL == rdn->atavs ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + return PR_FAILURE; + } + + if( 0 == rdn->count ) { + PRUint32 i; + for( i = 0; i < 0xFFFFFFFF; i++ ) { + if( (NSSPKIXAttributeTypeAndValue *)NULL == rdn->atavs[i] ) { + break; + } + } + +#ifdef PEDANTIC + if( 0xFFFFFFFF == i ) { + return; + } +#endif /* PEDANTIC */ + + rdn->count = i; + } + + return; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/MVCreate.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/MVCreate.c new file mode 100644 index 000000000..c40a4b6e7 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/MVCreate.c @@ -0,0 +1,158 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +/* + * nss_pkix_RelativeDistinguishedName_v_create + * + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_OID + * NSS_ERROR_INVALID_ITEM + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure. + */ + +NSS_EXTERN NSSPKIXRelativeDistinguishedName * +nss_pkix_RelativeDistinguishedName_V_Create +( + NSSArena *arenaOpt, + PRUint32 count, + va_list ap +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXRelativeDistinguishedName *rv = (NSSPKIXRelativeDistinguishedName *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXRelativeDistinguishedName); + if( (NSSPKIXRelativeDistinguishedName *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->count = count; + + rv->atav = nss_ZNEWARRAY(arena, NSSPKIXAttributeTypeAndValue *, count); + if( (NSSPKIXAttributeTypeAndValue **)NULL == rv->atav ) { + goto loser; + } + + for( i = 0; i < count; i++ ) { + NSSPKIXAttributeTypeAndValue *v = (NSSPKIXAttributeTypeAndValue *) + va_arg(ap, NSSPKIXAttributeTypeAndValue *); + +#ifdef NSSDEBUG + /* + * It's okay to test this down here, since + * supposedly these have already been checked. + */ + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(v) ) { + goto loser; + } +#endif /* NSSDEBUG */ + + rv->atav[i] = nssPKIXAttributeTypeAndValue_Duplicate(v, arena); + if( (NSSPKIXAttributeTypeAndValue *)NULL == rv->atav[i] ) { + goto loser; + } + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_RelativeDistinguishedName_add_pointer(rv) ) { + goto loser; + } + + if( PR_SUCCESS != nssArena_registerDestructor(arena, + nss_pkix_RelativeDistinguishedName_remove_pointer, rv) ) { + (void)nss_pkix_RelativeDistinguishedName_remove_pointer(rv); + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXRelativeDistinguishedName *)NULL; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PAddAttributeTypeAndValue.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PAddAttributeTypeAndValue.c new file mode 100644 index 000000000..68541d17e --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PAddAttributeTypeAndValue.c @@ -0,0 +1,107 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_AddAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXRelativeDistinguishedName_AddAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *atav +) +{ + PRUint32 newcount; + NSSPKIXAttributeTypeAndValue **newarray; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + PR_ASSERT((NSSPKIXAttributeTypeAndValue **)NULL != rdn->atavs); + if( (NSSPKIXAttributeTypeAndValue **)NULL == rdn->atavs ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + return PR_FAILURE; + } + + if( 0 == rdn->count ) { + nss_pkix_RelativeDistinguishedName_Count(rdn); + } + + newcount = rdn->count+1; + /* Check newcount for a rollover. */ + + /* Remember that our atavs array is NULL-terminated */ + newarray = (NSSPKIXAttributeTypeAndValue **)nss_ZRealloc(rdn->atavs, + ((newcount+1) * sizeof(NSSPKIXAttributeTypeAndValue *))); + if( (NSSPKIXAttributeTypeAndValue **)NULL == newarray ) { + return PR_FAILURE; + } + + rdn->atavs = newarray; + + rdn->atavs[ rdn->count ] = nssPKIXAttributeTypeAndValue_Duplicate(atav, rdn->arena); + if( (NSSPKIXAttributeTypeAndValue *)NULL == rdn->atavs[ rdn->count ] ) { + return PR_FAILURE; /* array is "too big" but whatever */ + } + + rdn->count = newcount; + + return nss_pkix_RelativeDistinguishedName_Clear(rdn); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PCreate.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PCreate.c new file mode 100644 index 000000000..a3a1f7315 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PCreate.c @@ -0,0 +1,123 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_Create + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ATAV + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRelativeDistinguishedName * +nssPKIXRelativeDistinguishedName_Create +( + NSSArena *arenaOpt, + NSSPKIXAttributeTypeAndValue *atav1, + ... +) +{ + va_list ap; + NSSPKIXRelativeDistinguishedName *rv; + PRUint32 count; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } + + /* Is there a nonzero minimum number of ATAVs required? */ + + { + va_start(ap, arenaOpt); + + while( 1 ) { + NSSPKIXAttributeTypeAndValue *atav; + atav = (NSSPKIXAttributeTypeAndValue *)va_arg(ap, NSSPKIXAttributeTypeAndValue *); + if( (NSSPKIXAttributeTypeAndValue *)NULL == atav ) { + break; + } + + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + va_end(ap); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } + + va_end(ap); + } +#endif /* NSSDEBUG */ + + va_start(ap, arenaOpt); + + for( count = 0; ; count++ ) { + NSSPKIXAttributeTypeAndValue *atav; + atav = (NSSPKIXAttributeTypeAndValue *)va_arg(ap, NSSPKIXAttributeTypeAndValue *); + if( (NSSPKIXAttributeTypeAndValue *)NULL == atav ) { + break; + } + +#ifdef PEDANTIC + if( count == 0xFFFFFFFF ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + va_end(ap); + return (NSSPKIXAttributeTypeAndValue *)NULL; + } +#endif /* PEDANTIC */ + } + + va_end(ap); + + va_start(ap, arenaOpt); + rv = nss_pkix_RelativeDistinguishedName_V_Create(arenaOpt, count, ap); + va_end(ap); + + return rv; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PCreateFromArray.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PCreateFromArray.c new file mode 100644 index 000000000..fa7e27eed --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PCreateFromArray.c @@ -0,0 +1,151 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +/* + * nssPKIXRelativeDistinguishedName_CreateFromArray + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_ATAV + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRelativeDistinguishedName * +nssPKIXRelativeDistinguishedName_CreateFromArray +( + NSSArena *arenaOpt, + PRUint32 count, + NSSPKIXAttributeTypeAndValue *atavs +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXRelativeDistinguishedName *rv = (NSSPKIXRelativeDistinguishedName *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } + + { + PRUint32 i; + + for( i = 0; i < count; i++ ) { + if( PR_SUCCESS != nssAttributeTypeAndValue_verifyPointer(&atavs[i]) ) { + return (NSSPKIXAttribute *)NULL; + } + } + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXRelativeDistinguishedName); + if( (NSSPKIXRelativeDistinguishedName *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->count = count; + + rv->atav = nss_ZNEWARRAY(arena, NSSPKIXAttributeTypeAndValue *, count); + if( (NSSPKIXAttributeTypeAndValue **)NULL == rv->atav ) { + goto loser; + } + + for( i = 0; i < count; i++ ) { + NSSPKIXAttributeTypeAndValue *v = atavs[i]; + + rv->atav[i] = nssPKIXAttributeTypeAndValue_Duplicate(v, arena); + if( (NSSPKIXAttributeTypeAndValue *)NULL == rv->atav[i] ) { + goto loser; + } + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_RelativeDistinguishedName_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXRelativeDistinguishedName *)NULL; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PCreateFromUTF8.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PCreateFromUTF8.c new file mode 100644 index 000000000..2f2f995be --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PCreateFromUTF8.c @@ -0,0 +1,139 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_CreateFromUTF8 + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_UNKNOWN_ATTRIBUTE + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRelativeDistinguishedName * +nssPKIXRelativeDistinguishedName_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *string +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXRelativeDistinguishedName *rv = (NSSPKIXRelativeDistinguishedName *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } + + if( (NSSUTF8 *)NULL == string ) { + nss_SetError(NSS_ERROR_INVALID_STRING); + return (NSSPKIXRelativeDistinguishedName *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXRelativeDistinguishedName); + if( (NSSPKIXRelativeDistinguishedName *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->utf8 = nssUTF8_Duplicate(string, arena); + if( (NSSUTF8 *)NULL == rv->utf8 ) { + goto loser; + } + + /* Insert intelligence here -- fgmr */ + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + goto loser; + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_RelativeDistinguishedName_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXRelativeDistinguishedName *)NULL; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PDecode.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PDecode.c new file mode 100644 index 000000000..ad1766280 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PDecode.c @@ -0,0 +1,142 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifndef ASN1_H +#include "asn1.h" +#endif /* ASN1_H */ + +/* + * nssPKIXRelativeDistinguishedName_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRelativeDistinguishedName * +nssPKIXRelativeDistinguishedName_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXRelativeDistinguishedName *rv = (NSSPKIXRelativeDistinguishedName *)NULL; + PRStatus status; + PRUint32 i; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXRelativeDistinguishedName); + if( (NSSPKIXRelativeDistinguishedName *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->ber = nssItem_Duplicate(ber, arena, (NSSItem *)NULL); + if( (NSSItem *)NULL == rv->ber ) { + goto loser; + } + + status = nssASN1_DecodeBER(arena, rv, nssPKIXRelativeDistinguishedName_template, ber); + if( PR_SUCCESS != status ) { + goto loser; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_RelativeDistinguishedName_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXRelativeDistinguishedName *)NULL; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PDestroy.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PDestroy.c new file mode 100644 index 000000000..94b8fcf00 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PDestroy.c @@ -0,0 +1,76 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_Destroy + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXRelativeDistinguishedName_Destroy +( + NSSPKIXRelativeDistinguishedName *rdn +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + +#ifdef DEBUG + (void)nss_pkix_RelativeDistinguishedName_remove_pointer(rdn); +#endif /* DEBUG */ + + if( PR_TRUE == rdn->i_allocated_arena ) { + return nssArena_Destroy(rdn->arena); + } + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PDuplicate.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PDuplicate.c new file mode 100644 index 000000000..0277b7b01 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PDuplicate.c @@ -0,0 +1,177 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_Duplicate + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXRelativeDistinguishedName upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXRelativeDistinguishedName * +nssPKIXRelativeDistinguishedName_Duplicate +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSArena *arenaOpt +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXRelativeDistinguishedName *rv = (NSSPKIXRelativeDistinguishedName *)NULL; + PRStatus status; + PRUint32 i; + NSSPKIXAttributeTypeAndValue **from, **to; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXRelativeDistinguishedName *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXRelativeDistinguishedName); + if( (NSSPKIXRelativeDistinguishedName *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + + if( (NSSDER *)NULL != rdn->der ) { + rv->der = nssItem_Duplicate(rdn->der, arena, (NSSItem *)NULL); + if( (NSSDER *)NULL == rv->der ) { + goto loser; + } + } + + if( (NSSBER *)NULL != rdn->ber ) { + rv->ber = nssItem_Duplicate(rdn->ber, arena, (NSSItem *)NULL); + if( (NSSBER *)NULL == rv->ber ) { + goto loser; + } + } + + if( (NSSUTF8 *)NULL != rdn->utf8 ) { + rv->utf8 = nssUTF8_Duplicate(rdn->utf8, arena); + if( (NSSUTF8 *)NULL == rv->utf8 ) { + goto loser; + } + } + + rv->count = rdn->count; + + { + if( 0 == rdn->count ) { + nss_pkix_RelativeDistinguishedName_Count(rdn); + if( 0 == rdn->count ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + goto loser; + } + + rv->count = rdn->count; /* might as well save it */ + } + + rv->atavs = nss_ZNEWARRAY(arena, NSSPKIXAttributeTypeAndValue *, rdn->count + 1); + if( (NSSPKIXAttributeTypeAndValue *)NULL == rv->atavs ) { + goto loser; + } + } + + for( from = &rdn->atavs[0], to = &rv->atavs[0]; *from; from++, to++ ) { + *to = nssPKIXAttributeTypeAndValue_Duplicate(*from, arena); + if( (NSSPKIXAttributeTypeAndValue *)NULL == *to ) { + goto loser; + } + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_RelativeDistinguishedName_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXRelativeDistinguishedName *)NULL; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PEncode.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PEncode.c new file mode 100644 index 000000000..d2af9470b --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PEncode.c @@ -0,0 +1,123 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifndef ASN1_H +#include "asn1.h" +#endif /* ASN1_H */ + +/* + * nssPKIXRelativeDistinguishedName_Encode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSBER * +nssPKIXRelativeDistinguishedName_Encode +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + NSSBER *it; + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* NSSDEBUG */ + + switch( encoding ) { + case NSSASN1BER: + if( (NSSBER *)NULL != rdn->ber ) { + it = rdn->ber; + goto done; + } + /*FALLTHROUGH*/ + case NSSASN1DER: + if( (NSSDER *)NULL != rdn->der ) { + it = rdn->der; + goto done; + } + break; + default: + nss_SetError(NSS_ERROR_UNSUPPORTED_ENCODING); + return (NSSBER *)NULL; + } + + it = nssASN1_EncodeItem(rdn->arena, (NSSItem *)NULL, rdn, + nssPKIXRelativeDistinguishedName_template, + encoding); + if( (NSSBER *)NULL == it ) { + return (NSSBER *)NULL; + } + + switch( encoding ) { + case NSSASN1BER: + rdn->ber = it; + break; + case NSSASN1DER: + rdn->der = it; + break; + default: + PR_ASSERT(0); + break; + } + + done: + return nssItem_Duplicate(it, arenaOpt, rvOpt); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PEqual.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PEqual.c new file mode 100644 index 000000000..2ac566a8b --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PEqual.c @@ -0,0 +1,101 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_Equal + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_IMPLEMENT PRBool +nssPKIXRelativeDistinguishedName_Equal +( + NSSPKIXRelativeDistinguishedName *one, + NSSPKIXRelativeDistinguishedName *two, + PRStatus *statusOpt +) +{ + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(one) ) { + goto loser; + } + + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(two) ) { + goto loser; + } +#endif /* NSSDEBUG */ + + if( (NSSDER *)NULL == one->der ) { + one->der = nssASN1_EncodeItem(one->arena, (NSSItem *)NULL, one, + nssPKIXRelativeDistinguishedName_template, + NSSASN1DER); + if( (NSSDER *)NULL == one->der ) { + goto loser; + } + } + + if( (NSSDER *)NULL == two->der ) { + two->der = nssASN1_EncodeItem(two->arena, (NSSItem *)NULL, two, + nssPKIXRelativeDistinguishedName_template, + NSSASN1DER); + if( (NSSDER *)NULL == two->der ) { + goto loser; + } + } + + return nssItem_Equal(one->der, two->der, statusOpt); + + loser: + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + + return PR_FALSE; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PFindAttributeTypeAndValue.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PFindAttributeTypeAndValue.c new file mode 100644 index 000000000..ee7c55e10 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PFindAttributeTypeAndValue.c @@ -0,0 +1,96 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_FindAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NOT_FOUND + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * The index of the specified attribute value upon success + * -1 upon failure. + */ + +NSS_IMPLEMENT PRInt32 +nssPKIXRelativeDistinguishedName_FindAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *atav +) +{ + PRUint32 i; + NSSPKIXAttributeTypeAndValue **a; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return -1; + } + + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return -1; + } +#endif /* NSSDEBUG */ + + PR_ASSERT((NSSPKIXAttributeTypeAndValue **)NULL != rdn->atavs); + if( (NSSPKIXAttributeTypeAndValue **)NULL == rdn->atavs ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + return -1; + } + + for( i = 0, a = rdn->atavs; *a; a++, (i > 0x7fffffff) || i++ ) { + if( PR_TRUE == nssPKIXAttributeTypeAndValue_Equal(*a, atav) ) { + if( i > 0x7fffffff ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return -1; + } + return (PRInt32)i; + } + } + + nss_SetError(NSS_ERROR_NOT_FOUND); + return -1; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PGetAttributeTypeAndValue.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PGetAttributeTypeAndValue.c new file mode 100644 index 000000000..22c3abac6 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PGetAttributeTypeAndValue.c @@ -0,0 +1,89 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXAttributeTypeAndValue upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeTypeAndValue * +nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + PRInt32 i, + NSSArena *arenaOpt +) +{ + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( 0 == rdn->count ) { + nss_pkix_RelativeDistinguishedName_Count(rdn); + } + + if( (i < 0) || (i >= rdn->count) ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXAttributeTypeAndValue *)NULL; + } + + return nssPKIXAttributeTypeAndValue_Duplicate(rdn->atavs[i], arenaOpt); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PGetAttributeTypeAndValueCount.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PGetAttributeTypeAndValueCount.c new file mode 100644 index 000000000..df8e1b48e --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PGetAttributeTypeAndValueCount.c @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValueCount + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * + * Return value: + * Nonnegative integer upon success + * -1 upon failure. + */ + +NSS_IMPLEMENT PRInt32 +nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValueCount +( + NSSPKIXRelativeDistinguishedName *rdn +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return -1; + } +#endif /* NSSDEBUG */ + + if( 0 == rdn->count ) { + nss_pkix_RelativeDistinguishedName_Count(rdn); + } + +#ifdef PEDANTIC + if( 0 == rdn->count ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return -1; + } +#endif /* PEDANTIC */ + + if( rdn->count > 0x7fffffff ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return -1; + } + + return (PRInt32)(rdn->count); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PGetAttributeTypeAndValues.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PGetAttributeTypeAndValues.c new file mode 100644 index 000000000..7675d5ad3 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PGetAttributeTypeAndValues.c @@ -0,0 +1,133 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValues + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_ARRAY_TOO_SMALL + * + * Return value: + * A valid pointer to an array of NSSPKIXAttributeTypeAndValue + * pointers upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXAttributeTypeAndValue ** +nssPKIXRelativeDistinguishedName_GetAttributeTypeAndValues +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *rvOpt[], + PRInt32 limit, + NSSArena *arenaOpt +) +{ + NSSPKIXAttributeTypeAndValue **rv = (NSSPKIXAttributeTypeAndValue **)NULL; + PRUint32 i; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return (NSSPKIXAttributeTypeAndValue **)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyOpt(attribute) ) { + return (NSSPKIXAttributeTypeAndValue **)NULL; + } + } +#endif /* NSSDEBUG */ + + if( 0 == rdn->count ) { + nss_pkix_RelativeDistinguishedName_Count(rdn); + } + +#ifdef PEDANTIC + if( 0 == rdn->count ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return (NSSPKIXAttributeTypeAndValue **)NULL; + } +#endif /* PEDANTIC */ + + if( (limit < rdn->count) && + !((0 == limit) && ((NSSPKIXAttributeTypeAndValue **)NULL == rvOpt)) ) { + nss_SetError(NSS_ERROR_ARRAY_TOO_SMALL); + return (NSSPKIXAttributeTypeAndValue **)NULL; + } + + limit = rdn->count; + if( (NSSPKIXAttributeTypeAndValue **)NULL == rvOpt ) { + rv = nss_ZNEWARRAY(arenaOpt, NSSPKIXAttributeTypeAndValue *, limit); + if( (NSSPKIXAttributeTypeAndValue **)NULL == rv ) { + return (NSSPKIXAttributeTypeAndValue **)NULL; + } + } else { + rv = rvOpt; + } + + for( i = 0; i < limit; i++ ) { + rv[i] = nssPKIXAttributeTypeAndValue_Duplicate(rdn->atav[i], arenaOpt); + if( (NSSPKIXAttributeTypeAndValue *)NULL == rv[i] ) { + goto loser; + } + } + + return rv; + + loser: + for( i = 0; i < limit; i++ ) { + NSSPKIXAttributeTypeAndValue *x = rv[i]; + if( (NSSPKIXAttributeTypeAndValue *)NULL == x ) { + break; + } + (void)nssPKIXAttributeTypeAndValue_Destroy(x); + } + + if( rv != rvOpt ) { + nss_ZFreeIf(rv); + } + + return (NSSPKIXAttributeTypeAndValue **)NULL; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PGetUTF8Encoding.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PGetUTF8Encoding.c new file mode 100644 index 000000000..01abf228c --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PGetUTF8Encoding.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_GetUTF8Encoding + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ARENA + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSUTF8 pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSUTF8 * +nssPKIXRelativeDistinguishedName_GetUTF8Encoding +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSArena *arenaOpt +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return (NSSUTF8 *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSUTF8 *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSUTF8 *)NULL == rdn->utf8 ) { + /* xxx fgmr fill this in from pki1 implementation */ + } + + return nssUTF8_Duplicate(rdn->utf8, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PRemoveAttributeTypeAndValue.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PRemoveAttributeTypeAndValue.c new file mode 100644 index 000000000..84b5cc819 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PRemoveAttributeTypeAndValue.c @@ -0,0 +1,121 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_RemoveAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_AT_MINIMUM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXRelativeDistinguishedName_RemoveAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + PRInt32 i +) +{ + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( 0 == rdn->count ) { + nss_pkix_RelativeDistinguishedName_Count(rdn); + } + + if( i < 0 ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } + + /* Is there a technical minimum? */ + /* + * if( 1 == rdn->count ) { + * nss_SetError(NSS_ERROR_AT_MINIMUM); + * return PR_FAILURE; + * } + */ + +#ifdef PEDANTIC + if( 0 == rdn->count ) { + NSSPKIXAttributeTypeAndValue **ip; + /* Too big.. but we can still remove one */ + nssPKIXAttributeTypeAndValue_Destroy(rdn->atavs[i]); + for( ip = &rdn->atavs[i]; *ip; ip++ ) { + ip[0] = ip[1]; + } + } else +#endif /* PEDANTIC */ + + { + NSSPKIXAttributeTypeAndValue *si; + PRUint32 end; + + if( i >= rdn->count ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } + + end = rdn->count - 1; + + si = rdn->atavs[i]; + rdn->atavs[i] = rdn->atavs[end]; + rdn->atavs[end] = (NSSPKIXAttributeTypeAndValue *)NULL; + + nssPKIXAttributeTypeAndValue_Destroy(si); + + /* We could realloc down, but we know it's a no-op */ + rdn->count = end; + } + + return nss_pkix_RelativeDistinguishedName_Clear(rdn); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PSetAttributeTypeAndValue.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PSetAttributeTypeAndValue.c new file mode 100644 index 000000000..01439e2e7 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PSetAttributeTypeAndValue.c @@ -0,0 +1,102 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_SetAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXRelativeDistinguishedName_SetAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + PRInt32 i, + NSSPKIXAttributeTypeAndValue *atav +) +{ + NSSPKIXAttributeTypeAndValue *dup; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + PR_ASSERT((NSSPKIXAttributeTypeAndValue **)NULL != rdn->atavs); + if( (NSSPKIXAttributeTypeAndValue **)NULL == rdn->atavs ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + return PR_FAILURE; + } + + if( 0 == rdn->count ) { + nss_pkix_RelativeDistinguishedName_Count(rdn); + } + + if( (i < 0) || (i >= rdn->count) ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } + + dup = nssPKIXAttributeTypeAndValue_Duplicate(atav, rdn->arena); + if( (NSSPKIXAttributeTypeAndValue *)NULL == dup ) { + return PR_FAILURE; + } + + nssPKIXAttributeTypeAndValue_Destroy(rdn->atavs[i]); + rdn->atavs[i] = dup; + + return nss_pkix_RelativeDistinguishedName_Clear(rdn); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/PSetAttributeTypeAndValues.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/PSetAttributeTypeAndValues.c new file mode 100644 index 000000000..839839ea2 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/PSetAttributeTypeAndValues.c @@ -0,0 +1,166 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXRelativeDistinguishedName_SetAttributeTypeAndValues + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_ATAV + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nssPKIXRelativeDistinguishedName_SetAttributeTypeAndValues +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *atavs[], + PRInt32 countOpt +) +{ + NSSPKIXAttributeTypeAndValue **ip; + NSSPKIXAttributeTypeAndValue **newarray; + PRUint32 i; + nssArenaMark *mark; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } + + if( (NSSPKIXAttributeTypeAndValues **)NULL == atavs ) { + nss_SetError(NSS_ERROR_INVALID_POINTER); + return PR_FAILURE; + } + + { + PRUint32 i, count; + + if( 0 == countOpt ) { + for( i = 0; i < 0x80000000; i++ ) { + if( (NSSPKIXAttributeTypeAndValue *)NULL == atav[i] ) { + break; + } + } + +#ifdef PEDANTIC + if( 0x80000000 == i ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } +#endif /* PEDANTIC */ + + count = (PRUint32)i; + } else { + if( countOpt < 0 ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } + + count = (PRUint32)countOpt; + } + + for( i = 0; i < count; i++ ) { + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav[i]) ) { + return PR_FAILURE; + } + } + } +#endif /* NSSDEBUG */ + + if( 0 == countOpt ) { + for( i = 0; i < 0xffffffff; i++ ) { + if( (NSSPKIXAttributeTypeAndValue *)NULL == atavs[i] ) { + break; + } + } + +#ifdef PEDANTIC + if( 0xffffffff == 0 ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + reutrn PR_FAILURE; + } +#endif /* PEDANTIC */ + + countOpt = i; + } + + mark = nssArena_Mark(rdn->mark); + if( (nssArenaMark *)NULL == mark ) { + return PR_FAILURE; + } + + newarray = nss_ZNEWARRAY(rdn->arena, NSSPKIXAttributeTypeAndValue *, countOpt); + if( (NSSPKIXAttributeTypeAndValue **)NULL == newarray ) { + goto loser; + } + + for( i = 0; i < countOpt; i++ ) { + newarray[i] = nssPKIXAttributeTypeAndValue_Duplicate(atavs[i], rdn->arena); + if( (NSSPKIXAttributeTypeAndValue *)NULL == newarray[i] ) { + goto loser; + } + } + + for( i = 0; i < rdn->count; i++ ) { + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_Destroy(rdn->atavs[i]) ) { + goto loser; + } + } + + nss_ZFreeIf(rdn->atavs); + + rdn->count = countOpt; + rdn->atavs = newarray; + + (void)nss_pkix_RelativeDistinguishedName_Clear(rdn); + + return nssArena_Unmark(rdn->arena, mark); + + loser: + (void)nssArena_Release(a->arena, mark); + return PR_FAILURE; +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/RemoveAttributeTypeAndValue.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/RemoveAttributeTypeAndValue.c new file mode 100644 index 000000000..b9f1deb66 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/RemoveAttributeTypeAndValue.c @@ -0,0 +1,73 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_RemoveAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_AT_MINIMUM + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXRelativeDistinguishedName_RemoveAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + PRInt32 i +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_RemoveAttributeTypeAndValue(rdn, i); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/SetAttributeTypeAndValue.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/SetAttributeTypeAndValue.c new file mode 100644 index 000000000..fa2224a6b --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/SetAttributeTypeAndValue.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_SetAttributeTypeAndValue + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_VALUE_OUT_OF_RANGE + * NSS_ERROR_INVALID_PKIX_ATAV + * NSS_ERROR_NO_MEMORY + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXRelativeDistinguishedName_SetAttributeTypeAndValue +( + NSSPKIXRelativeDistinguishedName *rdn, + PRInt32 i, + NSSPKIXAttributeTypeAndValue *atav +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } + + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atav) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_SetAttributeTypeAndValue(rdn, i, atav); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/SetAttributeTypeAndValues.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/SetAttributeTypeAndValues.c new file mode 100644 index 000000000..c6a8f0434 --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/SetAttributeTypeAndValues.c @@ -0,0 +1,113 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXRelativeDistinguishedName_SetAttributeTypeAndValues + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_PKIX_RDN + * NSS_ERROR_INVALID_POINTER + * NSS_ERROR_INVALID_ATAV + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +NSSPKIXRelativeDistinguishedName_SetAttributeTypeAndValues +( + NSSPKIXRelativeDistinguishedName *rdn, + NSSPKIXAttributeTypeAndValue *atavs[], + PRInt32 countOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXRelativeDistinguishedName_verifyPointer(rdn) ) { + return PR_FAILURE; + } + + if( (NSSPKIXAttributeTypeAndValue **)NULL == atavs ) { + nss_SetError(NSS_ERROR_INVALID_POINTER); + return PR_FAILURE; + } + + { + PRUint32 i, count; + + if( 0 == countOpt ) { + for( i = 0; i < 0x80000000; i++ ) { + if( (NSSPKIXAttributeTypeAndValue *)NULL == atavs[i] ) { + break; + } + } + +#ifdef PEDANTIC + if( 0x80000000 == i ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } +#endif /* PEDANTIC */ + + count = (PRUint32)i; + } else { + if( countOpt < 0 ) { + nss_SetError(NSS_ERROR_VALUE_OUT_OF_RANGE); + return PR_FAILURE; + } + + count = (PRUint32)countOpt; + } + + for( i = 0; i < count; i++ ) { + if( PR_SUCCESS != nssPKIXAttributeTypeAndValue_verifyPointer(atavs[i]) ) { + return PR_FAILURE; + } + } + } +#endif /* DEBUG */ + + return nssPKIXRelativeDistinguishedName_SetAttributeTypeAndValues(rdn, atavs, countOpt); +} diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/template.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/template.c new file mode 100644 index 000000000..fff01836a --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/template.c @@ -0,0 +1,55 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifndef ASN1_H +#include "asn1.h" +#endif /* ASN1_H */ + +/* + * nssPKIXRelativeDistinguishedName_template + * + */ + +const nssASN1Template nssPKIXRelativeDistinguishedName_template[] = { + { nssASN1_SET_OF, offsetof(NSSPKIXRelativeDistinguishedName, atavs), + nssPKIXAttributeTypeAndValue_template, + sizeof(NSSPKIXRelativeDistinguishedName) } +}; diff --git a/security/nss/lib/pkix/src/RelativeDistinguishedName/verifyPointer.c b/security/nss/lib/pkix/src/RelativeDistinguishedName/verifyPointer.c new file mode 100644 index 000000000..d7274abae --- /dev/null +++ b/security/nss/lib/pkix/src/RelativeDistinguishedName/verifyPointer.c @@ -0,0 +1,205 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +#ifdef DEBUG + +extern const NSSError NSS_ERROR_INTERNAL_ERROR; + +static nssPointerTracker pkix_rdn_pointer_tracker; + +/* + * nss_pkix_RelativeDistinguishedName_add_pointer + * + * This method is only present in debug builds. + * + * This module-private routine adds an NSSPKIXRelativeDistinguishedName pointer to + * the internal pointer-tracker. This routine should only be used + * by the NSSPKIX module. This routine returns a PRStatus value; + * upon error it will place an error on the error stack and return + * PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_RelativeDistinguishedName_add_pointer +( + const NSSPKIXRelativeDistinguishedName *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_rdn_pointer_tracker); + if( PR_SUCCESS != rv ) { + return rv; + } + + rv = nssPointerTracker_add(&pkix_rdn_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + NSSError e = NSS_GetError(); + if( NSS_ERROR_NO_MEMORY != e ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + + return rv; + } + + rv = nssArena_registerDestructor(p->arena, + nss_pkix_RelativeDistinguishedName_remove_pointer, p); + if( PR_SUCCESS != rv ) { + (void)nss_pkix_RelativeDistinguishedName_remove_pointer(p); + return rv; + } + +#ifdef NSSDEBUG + { + NSSPKIXAttributeTypeAndValue *a; + + for( a = p->atavs; *a; a++ ) { + if( PR_SUCCESS != nss_pkix_AttributeTypeAndValue_add_pointer(*a) ) { + nss_pkix_RelativeDistinguishedName_remove_pointer(p); + return PR_FAILURE; + } + } + } +#endif /* NSSDEBUG */ + + return PR_SUCCESS; +} + +/* + * nss_pkix_RelativeDistinguishedName_remove_pointer + * + * This method is only present in debug builds. + * + * This module-private routine removes a valid NSSPKIXRelativeDistinguishedName + * pointer from the internal pointer-tracker. This routine should + * only be used by the NSSPKIX module. This routine returns a + * PRStatus value; upon error it will place an error on the error + * stack and return PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_RelativeDistinguishedName_remove_pointer +( + const NSSPKIXRelativeDistinguishedName *p +) +{ + PRStatus rv; + +#ifdef NSSDEBUG + { + NSSPKIXAttributeTypeAndValue *a; + + for( a = p->atavs; *a; a++ ) { + (void)nss_pkix_AttributeTypeAndValue_remove_pointer(*a); + } + } +#endif /* NSSDEBUG */ + + rv = nssPointerTracker_remove(&pkix_rdn_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + + /* + * nssArena_deregisterDestructor(p->arena, + * nss_pkix_RelativeDistinguishedName_remove_pointer, p); + */ + + return rv; +} + +/* + * nssPKIXRelativeDistinguishedName_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXRelativeDistinguishedName + * 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_PKIX_ATTRIBUTE + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_IMPLEMENT PRStatus +nssPKIXRelativeDistinguishedName_verifyPointer +( + NSSPKIXRelativeDistinguishedName *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_rdn_pointer_tracker); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_ATTRIBUTE); + return PR_FAILURE; + } + + rv = nssPointerTracker_verify(&pkix_rdn_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_ATTRIBUTE); + return PR_FAILURE; + } + + return PR_SUCCESS; +} + +#endif /* DEBUG */ + diff --git a/security/nss/lib/pkix/src/Time/Compare.c b/security/nss/lib/pkix/src/Time/Compare.c new file mode 100644 index 000000000..6a125d6c6 --- /dev/null +++ b/security/nss/lib/pkix/src/Time/Compare.c @@ -0,0 +1,75 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXTime_Compare + * + * Usual result: -1, 0, 1 + * Returns 0 on error + */ + +NSS_IMPLEMENT PRInt32 +NSSPKIXTime_Compare +( + NSSPKIXTime *time1, + NSSPKIXTime *tiem2, + PRStatus *statusOpt +) + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXTime_verifyPointer(time1) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return 0; + } + + if( PR_SUCCESS != nssPKIXTime_verifyPointer(time2) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return 0; + } +#endif /* DEBUG */ + + return nssPKIXTime_Compare(time1, time2, statusOpt); +} diff --git a/security/nss/lib/pkix/src/Time/CreateFromPRTime.c b/security/nss/lib/pkix/src/Time/CreateFromPRTime.c new file mode 100644 index 000000000..909adb14e --- /dev/null +++ b/security/nss/lib/pkix/src/Time/CreateFromPRTime.c @@ -0,0 +1,65 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXTime_CreateFromPRTime + * + */ + +NSS_IMPLEMENT NSSPKIXTime * +NSSPKIXTime_CreateFromPRTime +( + NSSArena *arenaOpt, + PRTime prTime +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXTime *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXTime_CreateFromPRTime(arenaOpt, prTime); +} diff --git a/security/nss/lib/pkix/src/Time/CreateFromUTF8.c b/security/nss/lib/pkix/src/Time/CreateFromUTF8.c new file mode 100644 index 000000000..469741ac6 --- /dev/null +++ b/security/nss/lib/pkix/src/Time/CreateFromUTF8.c @@ -0,0 +1,70 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXTime_CreateFromUTF8 + * + */ + +NSS_EXTERN NSSPKIXTime * +NSSPKIXTime_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXTime *)NULL; + } + } + + if( (NSSUTF8 *)NULL == utf8 ) { + nss_SetError(NSS_ERROR_INVALID_STRING); + return (NSSPKIXTime *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXTime_CreateFromUTF8(arenaOpt, utf8); +} diff --git a/security/nss/lib/pkix/src/Time/Decode.c b/security/nss/lib/pkix/src/Time/Decode.c new file mode 100644 index 000000000..948dc0b93 --- /dev/null +++ b/security/nss/lib/pkix/src/Time/Decode.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXTime_Decode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTime upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXTime * +NSSPKIXTime_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXTime *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXTime *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXTime_Decode(arenaOpt, ber); +} diff --git a/security/nss/lib/pkix/src/Time/Destroy.c b/security/nss/lib/pkix/src/Time/Destroy.c new file mode 100644 index 000000000..d694850ef --- /dev/null +++ b/security/nss/lib/pkix/src/Time/Destroy.c @@ -0,0 +1,62 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXTime_Destroy + * + */ + +NSS_IMPLEMENT PR_STATUS +NSSPKIXTime_Destroy +( + NSSPKIXTime *time +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXTime_verifyPointer(time) ) { + return PR_FAILURE; + } +#endif /* DEBUG */ + + return nssPKIXTime_Destroy(time); +} diff --git a/security/nss/lib/pkix/src/Time/Duplicate.c b/security/nss/lib/pkix/src/Time/Duplicate.c new file mode 100644 index 000000000..dee6f61e9 --- /dev/null +++ b/security/nss/lib/pkix/src/Time/Duplicate.c @@ -0,0 +1,69 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXTime_Duplicate + * + */ + +NSS_IMPLEMENT NSSPKIXTime * +NSSPKXITime_Duplicate +( + NSSPKIXTime *time, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXTime_verifyPointer(time) ) { + return (NSSPKXITime *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXTime *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXTime_Duplicate(time, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/Time/Encode.c b/security/nss/lib/pkix/src/Time/Encode.c new file mode 100644 index 000000000..9063e4f3a --- /dev/null +++ b/security/nss/lib/pkix/src/Time/Encode.c @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXTime_Encode + * + */ + +NSS_IMPLEMENT NSSBER * +NSSPKIXTime_Encode +( + NSSPKIXTime *time, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXTime_verifyPointer(time) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXTime_Encode(time, encoding, rvOpt, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/Time/Equal.c b/security/nss/lib/pkix/src/Time/Equal.c new file mode 100644 index 000000000..4ed05acd5 --- /dev/null +++ b/security/nss/lib/pkix/src/Time/Equal.c @@ -0,0 +1,74 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXTime_Equal + * + */ + +NSS_IMPLEMENT PRBool +NSSPKXITime_Equal +( + NSSPKXITime *time1, + NSSPKXITime *time2, + PRStatus *statusOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXTime_verifyPointer(time1) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; + } + + if( PR_SUCCESS != nssPKIXTime_verifyPointer(time2) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; + } +#endif /* DEBUG */ + + return nssPKIXTime_Equal(time1, time2, statusOpt); +} diff --git a/security/nss/lib/pkix/src/Time/GetPRTime.c b/security/nss/lib/pkix/src/Time/GetPRTime.c new file mode 100644 index 000000000..5871a482d --- /dev/null +++ b/security/nss/lib/pkix/src/Time/GetPRTime.c @@ -0,0 +1,64 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXTime_GetPRTime + * + * Returns a zero on error + */ + +NSS_IMPLEMENT PRTime +NSSPKIXTime_GetPRTime +( + NSSPKIXTime *time, + PRStatus *statusOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXTime_verifyPointer(time) ) { + return (PRTime)0; + } +#endif /* DEBUG */ + + return nssPKIXTime_GetPRTime(time, statusOpt); +} diff --git a/security/nss/lib/pkix/src/Time/GetUTF8Encoding.c b/security/nss/lib/pkix/src/Time/GetUTF8Encoding.c new file mode 100644 index 000000000..7fc383b81 --- /dev/null +++ b/security/nss/lib/pkix/src/Time/GetUTF8Encoding.c @@ -0,0 +1,69 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXTime_GetUTF8Encoding + * + */ + +NSS_IMPLEMENT NSSUTF8 * +NSSPKXITime_GetUTF8Encoding +( + NSSPKIXTime *time, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXTime_verifyPointer(time) ) { + return (NSSUTF8 *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSUTF8 *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXTime_GetUTF8Encoding(time, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/Time/PCreateFromPRTime.c b/security/nss/lib/pkix/src/Time/PCreateFromPRTime.c new file mode 100644 index 000000000..13805e65d --- /dev/null +++ b/security/nss/lib/pkix/src/Time/PCreateFromPRTime.c @@ -0,0 +1,117 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXTime_CreateFromPRTime + * + */ + +NSS_IMPLEMENT NSSPKIXTime * +nssPKIXTime_CreateFromPRTime +( + NSSArena *arenaOpt, + PRTime prTime +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXTime *rv = (NSSPKIXTime *)NULL; + PRStatus status; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXTime *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXTime); + if( (NSSPKIXTime *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + + rv->prTime = prTime; + rv->prTimeValid = PR_TRUE; + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_Time_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXTime *)NULL; +} diff --git a/security/nss/lib/pkix/src/Time/PCreateFromUTF8.c b/security/nss/lib/pkix/src/Time/PCreateFromUTF8.c new file mode 100644 index 000000000..1a15639ed --- /dev/null +++ b/security/nss/lib/pkix/src/Time/PCreateFromUTF8.c @@ -0,0 +1,121 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXTime_CreateFromUTF8 + * + */ + +NSS_IMPLEMENT NSSPKIXTime * +nssPKIXTime_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXTime *rv = (NSSPKIXTime *)NULL; + PRStatus status; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXTime *)NULL; + } + } + + if( (NSSUTF8 *)NULL == utf8 ) { + nss_SetError(NSS_ERROR_INVALID_STRING); + return (NSSPKIXTime *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXTime); + if( (NSSPKIXTime *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + + /* fgmr base on nspr's pl implementation? */ + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_Time_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXTime *)NULL; +} diff --git a/security/nss/lib/pkix/src/Time/PDecode.c b/security/nss/lib/pkix/src/Time/PDecode.c new file mode 100644 index 000000000..385665468 --- /dev/null +++ b/security/nss/lib/pkix/src/Time/PDecode.c @@ -0,0 +1,137 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXTime_Decode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXTime upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXTime * +nssPKIXTime_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + NSSArena *arena; + PRBool arena_allocated = PR_FALSE; + nssArenaMark *mark = (nssArenaMark *)NULL; + NSSPKIXTime *rv = (NSSPKIXTime *)NULL; + PRStatus status; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXTime *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXTime *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL == arenaOpt ) { + arena = nssArena_Create(); + if( (NSSArena *)NULL == arena ) { + goto loser; + } + arena_allocated = PR_TRUE; + } else { + arena = arenaOpt; + mark = nssArena_Mark(arena); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arena, NSSPKIXTime); + if( (NSSPKIXTime *)NULL == rv ) { + goto loser; + } + + rv->arena = arena; + rv->i_allocated_arena = arena_allocated; + rv->ber = nssItem_Duplicate(ber, arena, (NSSItem *)NULL); + if( (NSSItem *)NULL == rv->ber ) { + goto loser; + } + + status = nssASN1_DecodeBER(arena, rv, nssPKIXTime_template, ber); + if( PR_SUCCESS != status ) { + goto loser; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arena, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_Time_add_pointer(rv) ) { + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arena, mark); + } + + if( PR_TRUE == arena_allocated ) { + (void)nssArena_Destroy(arena); + } + + return (NSSPKIXTime *)NULL; +} diff --git a/security/nss/lib/pkix/src/Time/PDestroy.c b/security/nss/lib/pkix/src/Time/PDestroy.c new file mode 100644 index 000000000..973974b51 --- /dev/null +++ b/security/nss/lib/pkix/src/Time/PDestroy.c @@ -0,0 +1,68 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXTime_Destroy + * + */ + +NSS_IMPLEMENT PR_STATUS +nssPKIXTime_Destroy +( + NSSPKIXTime *time +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXTime_verifyPointer(time) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + +#ifdef DEBUG + (void)nss_pkix_Time_remove_pointer(time); +#endif /* DEBUG */ + + if( PR_TRUE == time->i_allocated_arena ) { + return nssArena_Destroy(time->arena); + } + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/Time/PEncode.c b/security/nss/lib/pkix/src/Time/PEncode.c new file mode 100644 index 000000000..8904fac50 --- /dev/null +++ b/security/nss/lib/pkix/src/Time/PEncode.c @@ -0,0 +1,66 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXTime_Encode + * + */ + +NSS_IMPLEMENT NSSBER * +nssPKIXTime_Encode +( + NSSPKIXTime *time, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXTime_verifyPointer(time) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* NSSDEBUG */ diff --git a/security/nss/lib/pkix/src/Time/template.c b/security/nss/lib/pkix/src/Time/template.c new file mode 100644 index 000000000..38c4f3c78 --- /dev/null +++ b/security/nss/lib/pkix/src/Time/template.c @@ -0,0 +1,54 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifndef ASN1_H +#include "asn1.h" +#endif /* ASN1_H */ + +/* + * nssPKIXTime_template + * + */ + +const nssASN1Template nssPKIXTime_template[] = { + { nssASN1_INLINE, offsetof(NSSPKIXTime, asn1item), + nssASN1Template_Any, sizeof(NSSPKIXTime) } +}; diff --git a/security/nss/lib/pkix/src/X520Name/CreateFromUTF8.c b/security/nss/lib/pkix/src/X520Name/CreateFromUTF8.c new file mode 100644 index 000000000..84df20054 --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/CreateFromUTF8.c @@ -0,0 +1,105 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXX520Name_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXX520Name * +NSSPKIXX520Name_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +) +{ + PRStatus status = PR_SUCCESS; + PRUint32 length; + nss_ClearErrorStack(); + + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXX520Name *)NULL; + } + } + + if( (NSSUTF8 *)NULL == utf8 ) { + nss_SetError(NSS_ERROR_INVALID_STRING); + return (NSSPKIXX520Name *)NULL; + } +#endif /* DEBUG */ + + length = nssUTF8_Length(utf8, &status); + if( PR_SUCCESS != status ) { + if( NSS_ERROR_VALUE_TOO_LARGE == NSS_GetError() ) { + nss_SetError(NSS_ERROR_STRING_TOO_LONG); + } + return (NSSPKIXX520Name *)NULL; + } + + if( (length < 1 ) || (length > NSSPKIXX520Name_MAXIMUM_LENGTH) ) { + nss_SetError(NSS_ERROR_STRING_TOO_LONG); + } + + return nssPKIXX520Name_CreateFromUTF8(arenaOpt, utf8); +} + +/* + * NSSPKIXX520Name_MAXIMUM_LENGTH + * + * From RFC 2459: + * + * ub-name INTEGER ::= 32768 + */ + +const PRUint32 NSSPKIXX520Name_MAXIMUM_LENGTH = 32768; diff --git a/security/nss/lib/pkix/src/X520Name/Decode.c b/security/nss/lib/pkix/src/X520Name/Decode.c new file mode 100644 index 000000000..ac59d5598 --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/Decode.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXX520Name_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXX520Name * +NSSPKIXX520Name_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXAttribute *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXX520Name_Decode(arenaOpt, ber); +} diff --git a/security/nss/lib/pkix/src/X520Name/Destroy.c b/security/nss/lib/pkix/src/X520Name/Destroy.c new file mode 100644 index 000000000..49037d3b4 --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/Destroy.c @@ -0,0 +1,70 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXX520Name_Destroy + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT NSSDER * +NSSPKIXX520Name_Destroy +( + NSSPKIXX520Name *name +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXX520Name_verifyPointer(name) ) { + return (NSSDER *)NULL; + } +#endif /* DEBUG */ + + return nssPKIXX520Name_Destroy(name); +} diff --git a/security/nss/lib/pkix/src/X520Name/Duplicate.c b/security/nss/lib/pkix/src/X520Name/Duplicate.c new file mode 100644 index 000000000..bcb4b5a2b --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/Duplicate.c @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXX520Name_Duplicate + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXX520Name * +NSSPKIXX520Name_Duplicate +( + NSSPKIXX520Name *name, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXX520Name_verifyPointer(name) ) { + return (NSSPKIXAttribute *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXX520Name_Duplicate(name, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/X520Name/Encode.c b/security/nss/lib/pkix/src/X520Name/Encode.c new file mode 100644 index 000000000..83cfd5442 --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/Encode.c @@ -0,0 +1,80 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXX520Name_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSBER * +NSSPKIXX520Name_Encode +( + NSSPKIXX520Name *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXX520Name_verifyPointer(name) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXX520Name_Encode(name, encoding, rvOpt, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/X520Name/Equal.c b/security/nss/lib/pkix/src/X520Name/Equal.c new file mode 100644 index 000000000..75842e8f5 --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/Equal.c @@ -0,0 +1,83 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXX520Name_Equal + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_IMPLEMENT PRBool +NSSPKIXX520Name_Equal +( + NSSPKIXX520Name *name1, + NSSPKIXX520Name *name2, + PRStatus *statusOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXX520Name_verifyPointer(name1) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; + } + + if( PR_SUCCESS != nssPKIXX520Name_verifyPointer(name2) ) { + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; + } +#endif /* DEBUG */ + + return nssPKIXX520Name_Equal(name1, name2, statusOpt); +} diff --git a/security/nss/lib/pkix/src/X520Name/GetUTF8Encoding.c b/security/nss/lib/pkix/src/X520Name/GetUTF8Encoding.c new file mode 100644 index 000000000..2e42124eb --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/GetUTF8Encoding.c @@ -0,0 +1,78 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * NSSPKIXX520Name_GetUTF8Encoding + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSDER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSUTF8 * +NSSPKIXX520Name_GetUTF8Encoding +( + NSSPKIXX520Name *name, + NSSArena *arenaOpt +) +{ + nss_ClearErrorStack(); + +#ifdef DEBUG + if( PR_SUCCESS != nssPKIXX520Name_verifyPointer(name) ) { + return (NSSUTF8 *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSUTF8 *)NULL; + } + } +#endif /* DEBUG */ + + return nssPKIXX520Name_GetUTF8Encoding(name, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/X520Name/MDoUTF8.c b/security/nss/lib/pkix/src/X520Name/MDoUTF8.c new file mode 100644 index 000000000..69cbf691e --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/MDoUTF8.c @@ -0,0 +1,97 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +/* + * nss_pkix_X520Name_DoUTF8 + * + */ + +NSS_IMPLEMENT PR_STATUS +nss_pkix_X520Name_DoUTF8 +( + NSSPKIXX520Name *name +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXX520Name_verifyPointer(name) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( (NSSUTF8 *)NULL == name->utf8 ) { + PRUint8 tag = (*(PRUint8 *)name->string.data) & nssASN1_TAG_MASK; + nssStringType type; + void *data = (void *)&((PRUint8 *)name->string.data)[1]; + PRUint32 size = name->string.size-1; + + switch( tag ) { + case nssASN1_TELETEX_STRING: + type = nssStringType_TeletexString; + break; + case nssASN1_PRINTABLE_STRING: + type = nssStringType_PrintableString; + break; + case nssASN1_UNIVERSAL_STRING: + type = nssStringType_UniversalString; + break; + case nssASN1_BMP_STRING: + type = nssStringType_BMPString; + break; + case nssASN1_UTF8_STRING: + type = nssStringType_UTF8String; + break; + default: + nss_SetError(NSS_ERROR_INVALID_BER); + return PR_FAILURE; + } + + name->utf8 = nssUTF8_Create(arenaOpt, type, data, size); + if( (NSSUTF8 *)NULL == name->utf8 ) { + return PR_FAILURE; + } + + if( nssASN1_PRINTABLE_STRING == tag ) { + name->wasPrintable = PR_TRUE; + } + } + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/X520Name/PCreate.c b/security/nss/lib/pkix/src/X520Name/PCreate.c new file mode 100644 index 000000000..c507a8f75 --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/PCreate.c @@ -0,0 +1,169 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXX520Name_Create + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_STRING_TYPE + * NSS_ERROR_INVALID_ITEM + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXX520Name * +nssPKIXX520Name_Create +( + NSSArena *arenaOpt, + nssStringType type, + NSSItem *data +) +{ + NSSPKIXX520Name *rv = (NSSPKIXX520Name *)NULL; + nssArenaMark *mark = (nssArenaMark *)NULL; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXX520Name *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(data) ) { + return (NSSPKIXX520Name *)NULL; + } +#endif /* NSSDEBUG */ + + switch( type ) { + case nssStringType_TeletexString: + case nssStringType_PrintableString: + case nssStringType_UniversalString: + case nssStringType_UTF8String: + case nssStringType_BMPString: + break; + default: + nss_SetError(NSS_ERROR_INVALID_STRING_TYPE); + goto loser; + } + + if( (NSSArena *)NULL != arenaOpt ) { + mark = nssArena_Mark(arenaOpt); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arenaOpt, NSSPKIXX520Name); + if( (NSSPKIXX520Name *)NULL == rv ) { + goto loser; + } + + rv->utf8 = nssUTF8_Create(arenaOpt, type, data->data, data->size); + if( (NSSUTF8 *)NULL == rv->utf8 ) { + goto loser; + } + + if( nssStringType_PrintableString == type ) { + rv->wasPrintable = PR_TRUE; + } + + rv->der = nssUTF8_GetDEREncoding(arenaOpt, type, rv->utf8); + if( (NSSDER *)NULL == rv->der ) { + goto loser; + } + + rv->string.size = rv->der->size; + rv->string.data = nss_ZAlloc(arenaOpt, rv->string.size); + if( (void *)NULL == rv->string.data ) { + goto loser; + } + + (void)nsslibc_memcpy(rv->string.data, rv->der->data, rv->string.size); + + if( (NSSArena *)NULL != arenaOpt ) { + rv->inArena = PR_TRUE; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arenaOpt, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_X520Name_add_pointer(rv) ) { + goto loser; + } + + if( PR_SUCCESS != nssArena_registerDestructor(arena, + nss_pkix_X520Name_remove_pointer, rv) ) { + (void)nss_pkix_X520Name_remove_pointer(rv); + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arenaOpt, mark); + } + + if( (NSSArena *)NULL == arenaOpt ) { + if( (NSSPKIXX520Name *)NULL != rv ) { + if( (NSSDER *)NULL != rv->der ) { + nss_ZFreeIf(rv->der->data); + nss_ZFreeIf(rv->der); + } + + nss_ZFreeIf(rv->string.data); + nss_ZFreeIf(rv->utf8); + nss_ZFreeIf(rv); + } + } + + return (NSSPKIXX520Name *)NULL; +} diff --git a/security/nss/lib/pkix/src/X520Name/PCreateFromUTF8.c b/security/nss/lib/pkix/src/X520Name/PCreateFromUTF8.c new file mode 100644 index 000000000..0459f8c51 --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/PCreateFromUTF8.c @@ -0,0 +1,164 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXX520Name_CreateFromUTF8 + * + * { basically just enforces the length limit } + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXX520Name * +nssPKIXX520Name_CreateFromUTF8 +( + NSSArena *arenaOpt, + NSSUTF8 *utf8 +) +{ + NSSPKIXX520Name *rv = (NSSPKIXX520Name *)NULL; + nssArenaMark *mark = (nssArenaMark *)NULL; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXX520Name *)NULL; + } + } + + if( (NSSUTF8 *)NULL == utf8 ) { + nss_SetError(NSS_ERROR_INVALID_STRING); + return (NSSPKIXX520Name *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL != arenaOpt ) { + mark = nssArena_Mark(arenaOpt); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arenaOpt, NSSPKIXX520Name); + if( (NSSPKIXX520Name *)NULL == rv ) { + goto loser; + } + + rv->utf8 = nssUTF8_Duplicate(utf8, arenaOpt); + if( (NSSUTF8 *)NULL == rv->utf8 ) { + goto loser; + } + + /* + * RFC 2459 states (s. 4.1.2.4) that certificates issued after + * 2003-12-31 MUST encode strings as UTF8Strings, and until + * then they may be encoded as PrintableStrings, BMPStrings, + * or UTF8Strings (when the character sets allow). However, it + * specifically notes that even before 2003-12-31, strings may + * be encoded as UTF8Strings. So unless something important + * breaks, I'll do UTF8Strings. + */ + + rv->der = nssUTF8_GetDEREncoding(arenaOpt, nssStringType_UTF8String, + utf8); + if( (NSSDER *)NULL == rv->der ) { + goto loser; + } + + rv->string.size = rv->der->size; + rv->string.data = nss_ZAlloc(arenaOpt, rv->string.size); + if( (void *)NULL == rv->string.data ) { + goto loser; + } + + (void)nsslibc_memcpy(rv->string.data, rv->der->size, rv->string.size); + + if( (NSSArena *)NULL != arenaOpt ) { + rv->inArena = PR_TRUE; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arenaOpt, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_X520Name_add_pointer(rv) ) { + goto loser; + } + + if( PR_SUCCESS != nssArena_registerDestructor(arena, + nss_pkix_X520Name_remove_pointer, rv) ) { + (void)nss_pkix_X520Name_remove_pointer(rv); + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arenaOpt, mark); + } + + if( (NSSArena *)NULL == arenaOpt ) { + if( (NSSPKIXX520Name *)NULL != rv ) { + if( (NSSDER *)NULL != rv->der ) { + nss_ZFreeIf(rv->der->data); + nss_ZFreeIf(rv->der); + } + + nss_ZFreeIf(rv->string.data); + nss_ZFreeIf(rv->utf8); + nss_ZFreeIf(rv); + } + } + + return (NSSPKIXX520Name *)NULL; +} diff --git a/security/nss/lib/pkix/src/X520Name/PDecode.c b/security/nss/lib/pkix/src/X520Name/PDecode.c new file mode 100644 index 000000000..8228c8db4 --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/PDecode.c @@ -0,0 +1,135 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXX520Name_Decode + * + * -- fgmr comments -- + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_BER + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXX520Name * +nssPKIXX520Name_Decode +( + NSSArena *arenaOpt, + NSSBER *ber +) +{ + NSSPKIXX520Name *rv = (NSSPKIXX520Name *)NULL; + nssArenaMark *mark = (nssArenaMark *)NULL; + PRStatus status; + +#ifdef NSSDEBUG + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } + + if( PR_SUCCESS != nssItem_verifyPointer(ber) ) { + return (NSSPKIXAttribute *)NULL; + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL != arenaOpt ) { + mark = nssArena_Mark(arenaOpt); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arenaOpt, NSSPKIXX520Name); + if( (NSSPKIXX520Name *)NULL == rv ) { + goto loser; + } + + status = nssASN1_DecodeBER(arenaOpt, rv, nssPKIXX520_template, ber); + if( PR_SUCCESS != status ) { + goto loser; + } + + if( (NSSArena *)NULL != arenaOpt ) { + rv->inArena = PR_TRUE; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arenaOpt, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_X520Name_add_pointer(rv) ) { + goto loser; + } + + if( PR_SUCCESS != nssArena_registerDestructor(arena, + nss_pkix_X520Name_remove_pointer, rv) ) { + (void)nss_pkix_X520Name_remove_pointer(rv); + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arenaOpt, mark); + } + + if( (NSSArena *)NULL == arenaOpt ) { + if( (NSSPKIXX520Name *)NULL != rv ) { + nss_ZFreeIf(rv->string.data); + nss_ZFreeIf(rv->utf8); + nss_ZFreeIf(rv); + } + } + + return (NSSPKIXX520Name *)NULL; +} diff --git a/security/nss/lib/pkix/src/X520Name/PDestroy.c b/security/nss/lib/pkix/src/X520Name/PDestroy.c new file mode 100644 index 000000000..9a9bdaaa2 --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/PDestroy.c @@ -0,0 +1,87 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXX520Name_Destroy + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_EXTERN NSSDER * +nssPKIXX520Name_Destroy +( + NSSPKIXX520Name *name +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXX520Name_verifyPointer(name) ) { + return PR_FAILURE; + } +#endif /* NSSDEBUG */ + + if( PR_TRUE != name->inArena ) { + /* + * Note that inArena is merely a hint. If this object was + * created passively, this flag will be NULL no matter if + * it was in an arena or not. However, you may safely + * (try to) free memory in an NSSArena, so this isn't a + * problem. + */ + + if( (NSSDER *)NULL != name->der ) { + nss_ZFreeIf(name->der->data); + nss_ZFreeIf(name->der); + } + + nss_ZFreeIf(name->utf8); + nss_ZFreeIf(name->string.data); + nss_ZFreeIf(name); + } + + return PR_SUCCESS; +} diff --git a/security/nss/lib/pkix/src/X520Name/PDuplicate.c b/security/nss/lib/pkix/src/X520Name/PDuplicate.c new file mode 100644 index 000000000..a2b6d7e53 --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/PDuplicate.c @@ -0,0 +1,158 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXX520Name_Duplicate + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INVALID_ARENA + * + * Return value: + * A valid pointer to an NSSPKIXX520Name upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSPKIXX520Name * +nssPKIXX520Name_Duplicate +( + NSSPKIXX520Name *name, + NSSArena *arenaOpt +) +{ + NSSPKIXX520Name *rv = (NSSPKIXX520Name *)NULL; + nssArenaMark *mark = (nssArenaMark *)NULL; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXX520Name_verifyPointer(name) ) { + return (NSSPKIXAttribute *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSPKIXAttribute *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSArena *)NULL != arenaOpt ) { + mark = nssArena_Mark(arenaOpt); + if( (nssArenaMark *)NULL == mark ) { + goto loser; + } + } + + rv = nss_ZNEW(arenaOpt, NSSPKIXX520Name); + if( (NSSPKIXX520Name *)NULL == rv ) { + goto loser; + } + + rv->string.size = name->string.size; + rv->string.data = nss_ZAlloc(arenaOpt, name->string.size); + if( (void *)NULL == rv->string.data ) { + goto loser; + } + + (void)nsslibc_memcpy(rv->string.data, name->string.data, name->string.size); + + if( (NSSUTF8 *)NULL != name->utf8 ) { + rv->utf8 = nssUTF8_Duplicate(name->utf8, arenaOpt); + if( (NSSUTF8 *)NULL == rv->utf8 ) { + goto loser; + } + } + + if( (NSSDER *)NULL != name->der ) { + rv->der = nssItem_Duplicate(name->der, arenaOpt, (NSSItem *)NULL); + if( (NSSDER *)NULL == rv->der ) { + goto loser; + } + } + + rv->wasPrintable = name->wasPrintable; + + if( (NSSArena *)NULL != arenaOpt ) { + rv->inArena = PR_TRUE; + } + + if( (nssArenaMark *)NULL != mark ) { + if( PR_SUCCESS != nssArena_Unmark(arenaOpt, mark) ) { + goto loser; + } + } + +#ifdef DEBUG + if( PR_SUCCESS != nss_pkix_X520Name_add_pointer(rv) ) { + goto loser; + } + + if( PR_SUCCESS != nssArena_registerDestructor(arena, + nss_pkix_X520Name_remove_pointer, rv) ) { + (void)nss_pkix_X520Name_remove_pointer(rv); + goto loser; + } +#endif /* DEBUG */ + + return rv; + + loser: + if( (nssArenaMark *)NULL != mark ) { + (void)nssArena_Release(arenaOpt, mark); + } + + if( (NSSArena *)NULL == arenaOpt ) { + if( (NSSPKIXX520Name *)NULL != rv ) { + if( (NSSDER *)NULL != rv->der ) { + nss_ZFreeIf(rv->der->data); + nss_ZFreeIf(rv->der); + } + + nss_ZFreeIf(rv->string.data); + nss_ZFreeIf(rv->utf8); + nss_ZFreeIf(rv); + } + } + + return (NSSPKIXX520Name *)NULL; +} diff --git a/security/nss/lib/pkix/src/X520Name/PEncode.c b/security/nss/lib/pkix/src/X520Name/PEncode.c new file mode 100644 index 000000000..d9f001bae --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/PEncode.c @@ -0,0 +1,93 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXX520Name_Encode + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSBER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSBER * +nssPKIXX520Name_Encode +( + NSSPKIXX520Name *name, + NSSASN1EncodingType encoding, + NSSBER *rvOpt, + NSSArena *arenaOpt +) +{ + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXX520Name_verifyPointer(name) ) { + return (NSSBER *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSBER *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSDER *)NULL == name->der ) { + /* XXX fgmr */ + if( (NSSUTF8 *)NULL == name->utf8 ) { + if( PR_SUCCESS != nss_pkix_X520Name_DoUTF8(name) ) { + return (NSSBER *)NULL; + } + } + + rv->der = nssUTF8_GetDEREncoding(arenaOpt, type, rv->utf8); + if( (NSSDER *)NULL == rv->der ) { + return (NSSBER *)NULL; + } + } + + return nssItem_Duplicate(name->der, arenaOpt, rvOpt); +} diff --git a/security/nss/lib/pkix/src/X520Name/PEqual.c b/security/nss/lib/pkix/src/X520Name/PEqual.c new file mode 100644 index 000000000..9ebe75005 --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/PEqual.c @@ -0,0 +1,100 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXX520Name_Equal + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * + * Return value: + * PR_TRUE if the two objects have equal values + * PR_FALSE otherwise + * PR_FALSE upon error + */ + +NSS_IMPLEMENT PRBool +nssPKIXX520Name_Equal +( + NSSPKIXX520Name *name1, + NSSPKIXX520Name *name2, + PRStatus *statusOpt +) +{ + PRBool rv; + +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXX520Name_verifyPointer(name1) ) { + goto loser; + } + + if( PR_SUCCESS != nssPKIXX520Name_verifyPointer(name2) ) { + goto loser; + } +#endif /* NSSDEBUG */ + + if( (NSSUTF8 *)NULL == name1->utf8 ) { + if( PR_SUCCESS != nss_pkix_X520Name_DoUTF8(name1) ) { + goto loser; + } + } + + if( (NSSUTF8 *)NULL == name2->utf8 ) { + if( PR_SUCCESS != nss_pkix_X520Name_DoUTF8(name2) ) { + goto loser; + } + } + + if( (PR_TRUE == name1->wasPrintable) && (PR_TRUE == name2->wasPrintable) ) { + return nssUTF8_PrintableMatch(name1->utf8, name2->utf8, statusOpt); + } + + return nssUTF8_Equal(name1->utf8, name2->utf8, statusOpt); + + loser: + if( (PRStatus *)NULL != statusOpt ) { + *statusOpt = PR_FAILURE; + } + + return PR_FALSE; +} diff --git a/security/nss/lib/pkix/src/X520Name/PGetUTF8Encoding.c b/security/nss/lib/pkix/src/X520Name/PGetUTF8Encoding.c new file mode 100644 index 000000000..b023b1fea --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/PGetUTF8Encoding.c @@ -0,0 +1,82 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +/* + * nssPKIXX520Name_GetUTF8Encoding + * + * + * + * The error may be one of the following values: + * NSS_ERROR_INVALID_X520_NAME + * NSS_ERROR_NO_MEMORY + * + * Return value: + * A valid NSSDER pointer upon success + * NULL upon failure + */ + +NSS_IMPLEMENT NSSUTF8 * +nssPKIXX520Name_GetUTF8Encoding +( + NSSPKIXX520Name *name, + NSSArena *arenaOpt +) +{ +#ifdef NSSDEBUG + if( PR_SUCCESS != nssPKIXX520Name_verifyPointer(name) ) { + return (NSSUTF8 *)NULL; + } + + if( (NSSArena *)NULL != arenaOpt ) { + if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) { + return (NSSUTF8 *)NULL; + } + } +#endif /* NSSDEBUG */ + + if( (NSSUTF8 *)NULL == name->utf8 ) { + if( PR_SUCCESS != nss_pkix_X520Name_DoUTF8(name) ) { + return (NSSUTF8 *)NULL; + } + } + + return nssUTF8_Duplicate(rv->utf8, arenaOpt); +} diff --git a/security/nss/lib/pkix/src/X520Name/template.c b/security/nss/lib/pkix/src/X520Name/template.c new file mode 100644 index 000000000..63f18e724 --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/template.c @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIX_H +#include "pkix.h" +#endif /* PKIX_H */ + +#ifndef ASN1_H +#include "asn1.h" +#endif /* ASN1_H */ + +/* + * nssPKIXX520Name_template + * + * + */ + +const nssASN1Template nssPKIXX520Name_template[] = { + { nssASN1_ANY, offsetof(NSSPKIXX520Name, string), NULL, + sizeof(NSSPKIXX520Name) }, + { 0 } +}; diff --git a/security/nss/lib/pkix/src/X520Name/verifyPointer.c b/security/nss/lib/pkix/src/X520Name/verifyPointer.c new file mode 100644 index 000000000..9e447797d --- /dev/null +++ b/security/nss/lib/pkix/src/X520Name/verifyPointer.c @@ -0,0 +1,169 @@ +/* + * 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. + */ + +#ifdef DEBUG +static const char CVS_ID[] = "@(#) $Source$ $Revision$ $Date$ $Name$"; +#endif /* DEBUG */ + +#ifndef PKIXM_H +#include "pkixm.h" +#endif /* PKIXM_H */ + +#ifdef DEBUG + +extern const NSSError NSS_ERROR_INTERNAL_ERROR; + +static nssPointerTracker pkix_x520_name_pointer_tracker; + +/* + * nss_pkix_X520Name_add_pointer + * + * This method is only present in debug builds. + * + * This module-private routine adds an NSSPKIXX520Name pointer to + * the internal pointer-tracker. This routine should only be used + * by the NSSPKIX module. This routine returns a PRStatus value; + * upon error it will place an error on the error stack and return + * PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_NO_MEMORY + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_X520Name_add_pointer +( + const NSSPKIXX520Name *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_x520_name_pointer_tracker); + if( PR_SUCCESS != rv ) { + return rv; + } + + rv = nssPointerTracker_add(&pkix_x520_name_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + NSSError e = NSS_GetError(); + if( NSS_ERROR_NO_MEMORY != e ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + + return rv; + } + + return PR_SUCCESS; +} + +/* + * nss_pkix_X520Name_remove_pointer + * + * This method is only present in debug builds. + * + * This module-private routine removes a valid NSSPKIXX520Name + * pointer from the internal pointer-tracker. This routine should + * only be used by the NSSPKIX module. This routine returns a + * PRStatus value; upon error it will place an error on the error + * stack and return PR_FAILURE. + * + * The error may be one of the following values: + * NSS_ERROR_INTERNAL_ERROR + * + * Return value: + * PR_SUCCESS upon success + * PR_FAILURE upon failure + */ + +NSS_IMPLEMENT PRStatus +nss_pkix_X520Name_remove_pointer +( + const NSSPKIXX520Name *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_remove(&pkix_x520_name_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INTERNAL_ERROR); + } + + return rv; +} + +/* + * nssPKIXX520Name_verifyPointer + * + * This method is only present in debug builds. + * + * If the specified pointer is a valid pointer to an NSSPKIXX520Name + * 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_PKIX_X520_NAME + * + * Return value: + * PR_SUCCESS if the pointer is valid + * PR_FAILURE if it isn't + */ + +NSS_IMPLEMENT PRStatus +nssPKIXX520Name_verifyPointer +( + NSSPKIXX520Name *p +) +{ + PRStatus rv; + + rv = nssPointerTracker_initialize(&pkix_x520_name_pointer_tracker); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_X520_NAME); + return PR_FAILURE; + } + + rv = nssPointerTracker_verify(&pkix_x520_name_pointer_tracker, p); + if( PR_SUCCESS != rv ) { + nss_SetError(NSS_ERROR_INVALID_PKIX_X520_NAME); + return PR_FAILURE; + } + + return PR_SUCCESS; +} + +#endif /* DEBUG */ |