1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
14 * The Original Code is the Netscape security libraries.
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 1994-2000
19 * the Initial Developer. All Rights Reserved.
23 * Alternatively, the contents of this file may be used under the terms of
24 * either the GNU General Public License Version 2 or later (the "GPL"), or
25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 * in which case the provisions of the GPL or the LGPL are applicable instead
27 * of those above. If you wish to allow use of your version of this file only
28 * under the terms of either the GPL or the LGPL, and not to allow others to
29 * use your version of this file under the terms of the MPL, indicate your
30 * decision by deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL or the LGPL. If you do not delete
32 * the provisions above, a recipient may use your version of this file under
33 * the terms of any one of the MPL, the GPL or the LGPL.
35 * ***** END LICENSE BLOCK ***** */
41 static const char PKI1_CVS_ID
[] = "@(#) $RCSfile: pki1.h,v $ $Revision: 1.5 $ $Date: 2005/03/14 18:02:00 $";
47 * This file contains the prototypes to the non-public NSS routines
48 * relating to the PKIX part-1 objects.
57 #endif /* NSSPKI1_H */
61 extern const NSSOID nss_builtin_oids
[];
62 extern const PRUint32 nss_builtin_oid_count
;
64 extern const nssAttributeTypeAliasTable nss_attribute_type_aliases
[];
65 extern const PRUint32 nss_attribute_type_alias_count
;
70 * The non-public "methods" regarding this "object" are:
72 * nssOID_CreateFromBER -- constructor
73 * nssOID_CreateFromUTF8 -- constructor
74 * (there is no explicit destructor)
76 * nssOID_GetDEREncoding
77 * nssOID_GetUTF8Encoding
79 * In debug builds, the following non-public calls are also available:
81 * nssOID_verifyPointer
82 * nssOID_getExplanation
83 * nssOID_getTaggedUTF8
87 * nssOID_CreateFromBER
89 * This routine creates an NSSOID by decoding a BER- or DER-encoded
90 * OID. It may return NSS_OID_UNKNOWN upon error, in which case it
91 * will have set an error on the error stack.
93 * The error may be one of the following values:
94 * NSS_ERROR_INVALID_BER
98 * NSS_OID_UNKNOWN upon error
99 * An NSSOID upon success
108 extern const NSSError NSS_ERROR_INVALID_BER
;
109 extern const NSSError NSS_ERROR_NO_MEMORY
;
112 * nssOID_CreateFromUTF8
114 * This routine creates an NSSOID by decoding a UTF8 string
115 * representation of an OID in dotted-number format. The string may
116 * optionally begin with an octothorpe. It may return NSS_OID_UNKNOWN
117 * upon error, in which case it will have set an error on the error
120 * The error may be one of the following values:
121 * NSS_ERROR_INVALID_UTF8
122 * NSS_ERROR_NO_MEMORY
125 * NSS_OID_UNKNOWN upon error
126 * An NSSOID upon success
130 nssOID_CreateFromUTF8
135 extern const NSSError NSS_ERROR_INVALID_UTF8
;
136 extern const NSSError NSS_ERROR_NO_MEMORY
;
139 * nssOID_GetDEREncoding
141 * This routine returns the DER encoding of the specified NSSOID.
142 * If the optional arena argument is non-null, the memory used will
143 * be obtained from that arena; otherwise, the memory will be obtained
144 * from the heap. This routine may return return null upon error, in
145 * which case it will have set an error on the error stack.
147 * The error may be one of the following values:
148 * NSS_ERROR_INVALID_NSSOID
149 * NSS_ERROR_NO_MEMORY
153 * The DER encoding of this NSSOID
157 nssOID_GetDEREncoding
165 * nssOID_GetUTF8Encoding
167 * This routine returns a UTF8 string containing the dotted-number
168 * encoding of the specified NSSOID. If the optional arena argument
169 * is non-null, the memory used will be obtained from that arena;
170 * otherwise, the memory will be obtained from the heap. This routine
171 * may return null upon error, in which case it will have set an error
172 * on the error stack.
174 * The error may be one of the following values:
175 * NSS_ERROR_INVALID_NSSOID
176 * NSS_ERROR_NO_MEMORY
180 * A pointer to a UTF8 string containing the dotted-digit encoding of
185 nssOID_GetUTF8Encoding
192 * nssOID_verifyPointer
194 * This method is only present in debug builds.
196 * If the specified pointer is a valid poitner to an NSSOID object,
197 * this routine will return PR_SUCCESS. Otherwise, it will put an
198 * error on the error stack and return PR_FAILURE.
200 * The error may be one of the following values:
201 * NSS_ERROR_INVALID_NSSOID
204 * PR_SUCCESS if the pointer is valid
205 * PR_FAILURE if it isn't
215 extern const NSSError NSS_ERROR_INVALID_NSSOID
;
219 * nssOID_getExplanation
221 * This method is only present in debug builds.
223 * This routine will return a static pointer to a UTF8-encoded string
224 * describing (in English) the specified OID. The memory pointed to
225 * by the return value is not owned by the caller, and should not be
226 * freed or modified. Note that explanations are only provided for
227 * the OIDs built into the NSS library; there is no way to specify an
228 * explanation for dynamically created OIDs. This routine is intended
229 * only for use in debugging tools such as "derdump." This routine
230 * may return null upon error, in which case it will have placed an
231 * error on the error stack.
233 * The error may be one of the following values:
234 * NSS_ERROR_INVALID_NSSOID
238 * A static pointer to a readonly, non-caller-owned UTF8-encoded
239 * string explaining the specified OID.
243 NSS_EXTERN
const NSSUTF8
*
244 nssOID_getExplanation
249 extern const NSSError NSS_ERROR_INVALID_NSSOID
;
253 * nssOID_getTaggedUTF8
255 * This method is only present in debug builds.
257 * This routine will return a pointer to a caller-owned UTF8-encoded
258 * string containing a tagged encoding of the specified OID. Note
259 * that OID (component) tags are only provided for the OIDs built
260 * into the NSS library; there is no way to specify tags for
261 * dynamically created OIDs. This routine is intended for use in
262 * debugging tools such as "derdump." If the optional arena argument
263 * is non-null, the memory used will be obtained from that arena;
264 * otherwise, the memory will be obtained from the heap. This routine
265 * may return return null upon error, in which case it will have set
266 * an error on the error stack.
268 * The error may be one of the following values
269 * NSS_ERROR_INVALID_NSSOID
270 * NSS_ERROR_NO_MEMORY
274 * A pointer to a UTF8 string containing the tagged encoding of
286 extern const NSSError NSS_ERROR_INVALID_NSSOID
;
287 extern const NSSError NSS_ERROR_NO_MEMORY
;
293 * The non-public "methods" regarding this "object" are:
295 * nssATAV_CreateFromBER -- constructor
296 * nssATAV_CreateFromUTF8 -- constructor
297 * nssATAV_Create -- constructor
300 * nssATAV_GetDEREncoding
301 * nssATAV_GetUTF8Encoding
307 * In debug builds, the following non-public call is also available:
309 * nssATAV_verifyPointer
313 * nssATAV_CreateFromBER
315 * This routine creates an NSSATAV by decoding a BER- or DER-encoded
316 * ATAV. If the optional arena argument is non-null, the memory used
317 * will be obtained from that arena; otherwise, the memory will be
318 * obtained from the heap. This routine may return NULL upon error,
319 * in which case it will have set an error on the error stack.
321 * The error may be one of the following values:
322 * NSS_ERROR_INVALID_BER
323 * NSS_ERROR_NO_MEMORY
327 * A pointer to an NSSATAV upon success
331 nssATAV_CreateFromBER
334 const NSSBER
*berATAV
338 * nssATAV_CreateFromUTF8
340 * This routine creates an NSSATAV by decoding a UTF8 string in the
341 * "equals" format, e.g., "c=US." If the optional arena argument is
342 * non-null, the memory used will be obtained from that arena;
343 * otherwise, the memory will be obtained from the heap. This routine
344 * may return NULL upon error, in which case it will have set an error
345 * on the error stack.
347 * The error may be one of the following values:
348 * NSS_ERROR_UNKNOWN_ATTRIBUTE
349 * NSS_ERROR_INVALID_UTF8
350 * NSS_ERROR_NO_MEMORY
354 * A pointer to an NSSATAV upon success
358 nssATAV_CreateFromUTF8
361 const NSSUTF8
*stringATAV
367 * This routine creates an NSSATAV from the specified NSSOID and the
368 * specified data. If the optional arena argument is non-null, the
369 * memory used will be obtained from that arena; otherwise, the memory
370 * will be obtained from the heap.If the specified data length is zero,
371 * the data is assumed to be terminated by first zero byte; this allows
372 * UTF8 strings to be easily specified. This routine may return NULL
373 * upon error, in which case it will have set an error on the error
376 * The error may be one of the following values:
377 * NSS_ERROR_INVALID_ARENA
378 * NSS_ERROR_INVALID_NSSOID
379 * NSS_ERROR_INVALID_POINTER
380 * NSS_ERROR_NO_MEMORY
384 * A pointer to an NSSATAV upon success
399 * This routine will destroy an ATAV object. It should eventually be
400 * called on all ATAVs created without an arena. While it is not
401 * necessary to call it on ATAVs created within an arena, it is not an
402 * error to do so. This routine returns a PRStatus value; if
403 * successful, it will return PR_SUCCESS. If unsuccessful, it will
404 * set an error on the error stack and return PR_FAILURE.
406 * The error may be one of the following values:
407 * NSS_ERROR_INVALID_ATAV
410 * PR_FAILURE upon error
411 * PR_SUCCESS upon success
421 * nssATAV_GetDEREncoding
423 * This routine will DER-encode an ATAV object. If the optional arena
424 * argument is non-null, the memory used will be obtained from that
425 * arena; otherwise, the memory will be obtained from the heap. This
426 * routine may return null upon error, in which case it will have set
427 * an error on the error stack.
429 * The error may be one of the following values:
430 * NSS_ERROR_INVALID_ATAV
431 * NSS_ERROR_NO_MEMORY
435 * The DER encoding of this NSSATAV
439 nssATAV_GetDEREncoding
446 * nssATAV_GetUTF8Encoding
448 * This routine returns a UTF8 string containing a string
449 * representation of the ATAV in "equals" notation (e.g., "o=Acme").
450 * If the optional arena argument is non-null, the memory used will be
451 * obtained from that arena; otherwise, the memory will be obtained
452 * from the heap. This routine may return null upon error, in which
453 * case it will have set an error on the error stack.
455 * The error may be one of the following values:
456 * NSS_ERROR_INVALID_ATAV
457 * NSS_ERROR_NO_MEMORY
461 * A pointer to a UTF8 string containing the "equals" encoding of the
466 nssATAV_GetUTF8Encoding
475 * This routine returns the NSSOID corresponding to the attribute type
476 * in the specified ATAV. This routine may return NSS_OID_UNKNOWN
477 * upon error, in which case it will have set an error on the error
480 * The error may be one of the following values:
481 * NSS_ERROR_INVALID_ATAV
484 * NSS_OID_UNKNOWN upon error
485 * An element of enum NSSOIDenum upon success
488 NSS_EXTERN
const NSSOID
*
497 * This routine returns a string containing the attribute value
498 * in the specified ATAV. If the optional arena argument is non-null,
499 * the memory used will be obtained from that arena; otherwise, the
500 * memory will be obtained from the heap. This routine may return
501 * NULL upon error, in which case it will have set an error upon the
504 * The error may be one of the following values:
505 * NSS_ERROR_INVALID_ATAV
506 * NSS_ERROR_NO_MEMORY
510 * A pointer to an NSSItem containing the attribute value.
523 * This routine compares two ATAVs for equality. For two ATAVs to be
524 * equal, the attribute types must be the same, and the attribute
525 * values must have equal length and contents. The result of the
526 * comparison will be stored at the location pointed to by the "equalp"
527 * variable, which must point to a valid PRBool. This routine may
528 * return PR_FAILURE upon error, in which case it will have set an
529 * error on the error stack.
531 * The error may be one of the following values:
532 * NSS_ERROR_INVALID_ATAV
533 * NSS_ERROR_INVALID_ARGUMENT
536 * PR_FAILURE on error
537 * PR_SUCCESS upon a successful comparison (equal or not)
551 * This routine duplicates the specified ATAV. If the optional arena
552 * argument is non-null, the memory required will be obtained from
553 * that arena; otherwise, the memory will be obtained from the heap.
554 * This routine may return NULL upon error, in which case it will have
555 * placed an error on the error stack.
557 * The error may be one of the following values:
558 * NSS_ERROR_INVALID_ATAV
559 * NSS_ERROR_NO_MEMORY
563 * A pointer to a new ATAV
574 * nssATAV_verifyPointer
576 * This method is only present in debug builds.
578 * If the specified pointer is a valid pointer to an NSSATAV object,
579 * this routine will return PR_SUCCESS. Otherwise, it will put an
580 * error on the error stack and return PR_FAILRUE.
582 * The error may be one of the following values:
583 * NSS_ERROR_INVALID_NSSATAV
584 * NSS_ERROR_NO_MEMORY
587 * PR_SUCCESS if the pointer is valid
588 * PR_FAILURE if it isn't
593 nssATAV_verifyPointer
602 * The non-public "methods" regarding this "object" are:
604 * nssRDN_CreateFromBER -- constructor
605 * nssRDN_CreateFromUTF8 -- constructor
606 * nssRDN_Create -- constructor
607 * nssRDN_CreateSimple -- constructor
610 * nssRDN_GetDEREncoding
611 * nssRDN_GetUTF8Encoding
613 * nssRDN_GetATAVCount
615 * nssRDN_GetSimpleATAV
621 * nssRDN_CreateFromBER
623 * This routine creates an NSSRDN by decoding a BER- or DER-encoded
624 * RDN. If the optional arena argument is non-null, the memory used
625 * will be obtained from that arena; otherwise, the memory will be
626 * obtained from the heap. This routine may return NULL upon error,
627 * in which case it will have set an error on the error stack.
629 * The error may be one of the following values:
630 * NSS_ERROR_INVALID_BER
631 * NSS_ERROR_NO_MEMORY
635 * A pointer to an NSSRDN upon success
646 * nssRDN_CreateFromUTF8
648 * This routine creates an NSSRDN by decoding an UTF8 string
649 * consisting of either a single ATAV in the "equals" format, e.g.,
650 * "uid=smith," or one or more such ATAVs in parentheses, e.g.,
651 * "(sn=Smith,ou=Sales)." If the optional arena argument is non-null,
652 * the memory used will be obtained from that arena; otherwise, the
653 * memory will be obtained from the heap. This routine may return
654 * NULL upon error, in which case it will have set an error on the
657 * The error may be one of the following values:
658 * NSS_ERROR_UNKNOWN_ATTRIBUTE
659 * NSS_ERROR_INVALID_UTF8
660 * NSS_ERROR_NO_MEMORY
664 * A pointer to an NSSRDN upon success
668 nssRDN_CreateFromUTF8
677 * This routine creates an NSSRDN from one or more NSSATAVs. The
678 * final argument to this routine must be NULL. If the optional arena
679 * argument is non-null, the memory used will be obtained from that
680 * arena; otherwise, the memory will be obtained from the heap. This
681 * routine may return NULL upon error, in which case it will have set
682 * an error on the error stack.
684 * The error may be one of the following values:
685 * NSS_ERROR_NO_MEMORY
686 * NSS_ERROR_INVALID_ATAV
690 * A pointer to an NSSRDN upon success
702 * nssRDN_CreateSimple
704 * This routine creates a simple NSSRDN from a single NSSATAV. If the
705 * optional arena argument is non-null, the memory used will be
706 * obtained from that arena; otherwise, the memory will be obtained
707 * from the heap. This routine may return NULL upon error, in which
708 * case it will have set an error on the error stack.
710 * The error may be one of the following values:
711 * NSS_ERROR_NO_MEMORY
712 * NSS_ERROR_INVALID_ATAV
716 * A pointer to an NSSRDN upon success
729 * This routine will destroy an RDN object. It should eventually be
730 * called on all RDNs created without an arena. While it is not
731 * necessary to call it on RDNs created within an arena, it is not an
732 * error to do so. This routine returns a PRStatus value; if
733 * successful, it will return PR_SUCCESS. If unsuccessful, it will
734 * set an error on the error stack and return PR_FAILURE.
736 * The error may be one of the following values:
737 * NSS_ERROR_INVALID_RDN
740 * PR_FAILURE upon failure
741 * PR_SUCCESS upon success
751 * nssRDN_GetDEREncoding
753 * This routine will DER-encode an RDN object. If the optional arena
754 * argument is non-null, the memory used will be obtained from that
755 * arena; otherwise, the memory will be obtained from the heap. This
756 * routine may return null upon error, in which case it will have set
757 * an error on the error stack.
759 * The error may be one of the following values:
760 * NSS_ERROR_INVALID_RDN
761 * NSS_ERROR_NO_MEMORY
765 * The DER encoding of this NSSRDN
769 nssRDN_GetDEREncoding
776 * nssRDN_GetUTF8Encoding
778 * This routine returns a UTF8 string containing a string
779 * representation of the RDN. A simple (one-ATAV) RDN will be simply
780 * the string representation of that ATAV; a non-simple RDN will be in
781 * parenthesised form. If the optional arena argument is non-null,
782 * the memory used will be obtained from that arena; otherwise, the
783 * memory will be obtained from the heap. This routine may return
784 * null upon error, in which case it will have set an error on the
787 * The error may be one of the following values:
788 * NSS_ERROR_INVALID_RDN
789 * NSS_ERROR_NO_MEMORY
793 * A pointer to a UTF8 string
797 nssRDN_GetUTF8Encoding
806 * This routine adds an ATAV to the set of ATAVs in the specified RDN.
807 * Remember that RDNs consist of an unordered set of ATAVs. If the
808 * RDN was created with a non-null arena argument, that same arena
809 * will be used for any additional required memory. If the RDN was
810 * created with a NULL arena argument, any additional memory will
811 * be obtained from the heap. This routine returns a PRStatus value;
812 * it will return PR_SUCCESS upon success, and upon failure it will
813 * set an error on the error stack and return PR_FAILURE.
815 * The error may be one of the following values:
816 * NSS_ERROR_INVALID_RDN
817 * NSS_ERROR_INVALID_ATAV
818 * NSS_ERROR_NO_MEMORY
821 * PR_SUCCESS upon success
822 * PR_FAILURE upon failure
833 * nssRDN_GetATAVCount
835 * This routine returns the cardinality of the set of ATAVs within
836 * the specified RDN. This routine may return 0 upon error, in which
837 * case it will have set an error on the error stack.
839 * The error may be one of the following values:
840 * NSS_ERROR_INVALID_RDN
844 * A positive number upon success
856 * This routine returns a pointer to an ATAV that is a member of
857 * the set of ATAVs within the specified RDN. While the set of
858 * ATAVs within an RDN is unordered, this routine will return
859 * distinct values for distinct values of 'i' as long as the RDN
860 * is not changed in any way. The RDN may be changed by calling
861 * NSSRDN_AddATAV. The value of the variable 'i' is on the range
862 * [0,c) where c is the cardinality returned from NSSRDN_GetATAVCount.
863 * The caller owns the ATAV the pointer to which is returned. If the
864 * optional arena argument is non-null, the memory used will be
865 * obtained from that arena; otherwise, the memory will be obtained
866 * from the heap. This routine may return NULL upon error, in which
867 * case it will have set an error upon the error stack.
869 * The error may be one of the following values:
870 * NSS_ERROR_INVALID_RDN
871 * NSS_ERROR_VALUE_OUT_OF_RANGE
872 * NSS_ERROR_NO_MEMORY
876 * A caller-owned pointer to an NSSATAV
888 * nssRDN_GetSimpleATAV
890 * Most RDNs are actually very simple, with a single ATAV. This
891 * routine will return the single ATAV from such an RDN. The caller
892 * owns the ATAV the pointer to which is returned. If the optional
893 * arena argument is non-null, the memory used will be obtained from
894 * that arena; otherwise, the memory will be obtained from the heap.
895 * This routine may return NULL upon error, including the case where
896 * the set of ATAVs in the RDN is nonsingular. Upon error, this
897 * routine will have set an error on the error stack.
899 * The error may be one of the following values:
900 * NSS_ERROR_INVALID_RDN
901 * NSS_ERROR_RDN_NOT_SIMPLE
902 * NSS_ERROR_NO_MEMORY
906 * A caller-owned pointer to an NSSATAV
919 * This routine compares two RDNs for equality. For two RDNs to be
920 * equal, they must have the same number of ATAVs, and every ATAV in
921 * one must be equal to an ATAV in the other. (Note that the sets
922 * of ATAVs are unordered.) The result of the comparison will be
923 * stored at the location pointed to by the "equalp" variable, which
924 * must point to a valid PRBool. This routine may return PR_FAILURE
925 * upon error, in which case it will have set an error on the error
928 * The error may be one of the following values:
929 * NSS_ERROR_INVALID_RDN
930 * NSS_ERROR_INVALID_ARGUMENT
933 * PR_FAILURE on error
934 * PR_SUCCESS upon a successful comparison (equal or not)
948 * This routine duplicates the specified RDN. If the optional arena
949 * argument is non-null, the memory required will be obtained from
950 * that arena; otherwise, the memory will be obtained from the heap.
951 * This routine may return NULL upon error, in which case it will have
952 * placed an error on the error stack.
954 * The error may be one of the following values:
955 * NSS_ERROR_INVALID_RDN
956 * NSS_ERROR_NO_MEMORY
960 * A pointer to a new RDN
973 * The non-public "methods" regarding this "object" are:
975 * nssRDNSeq_CreateFromBER -- constructor
976 * nssRDNSeq_CreateFromUTF8 -- constructor
977 * nssRDNSeq_Create -- constructor
980 * nssRDNSeq_GetDEREncoding
981 * nssRDNSeq_GetUTF8Encoding
982 * nssRDNSeq_AppendRDN
983 * nssRDNSeq_GetRDNCount
986 * nssRDNSeq_Duplicate
988 * nssRDNSeq_EvaluateUTF8 -- not an object method
992 * nssRDNSeq_CreateFromBER
994 * This routine creates an NSSRDNSeq by decoding a BER- or DER-encoded
995 * sequence of RDNs. If the optional arena argument is non-null,
996 * the memory used will be obtained from that arena; otherwise, the
997 * memory will be obtained from the heap. This routine may return
998 * NULL upon error, in which case it will have set an error on the
1001 * The error may be one of the following values:
1002 * NSS_ERROR_INVALID_BER
1003 * NSS_ERROR_NO_MEMORY
1007 * A pointer to an NSSRDNSeq upon success
1010 NSS_EXTERN NSSRDNSeq
*
1011 nssRDNSeq_CreateFromBER
1018 * nssRDNSeq_CreateFromUTF8
1020 * This routine creates an NSSRDNSeq by decoding a UTF8 string
1021 * consisting of a comma-separated sequence of RDNs, such as
1022 * "(sn=Smith,ou=Sales),o=Acme,c=US." If the optional arena argument
1023 * is non-null, the memory used will be obtained from that arena;
1024 * otherwise, the memory will be obtained from the heap. This routine
1025 * may return NULL upon error, in which case it will have set an error
1026 * on the error stack.
1028 * The error may be one of the following values:
1029 * NSS_ERROR_UNKNOWN_ATTRIBUTE
1030 * NSS_ERROR_INVALID_UTF8
1031 * NSS_ERROR_NO_MEMORY
1035 * A pointer to an NSSRDNSeq upon success
1038 NSS_EXTERN NSSRDNSeq
*
1039 nssRDNSeq_CreateFromUTF8
1042 NSSUTF8
*stringRDNSeq
1048 * This routine creates an NSSRDNSeq from one or more NSSRDNs. The
1049 * final argument to this routine must be NULL. If the optional arena
1050 * argument is non-null, the memory used will be obtained from that
1051 * arena; otherwise, the memory will be obtained from the heap. This
1052 * routine may return NULL upon error, in which case it will have set
1053 * an error on the error stack.
1055 * The error may be one of the following values:
1056 * NSS_ERROR_NO_MEMORY
1057 * NSS_ERROR_INVALID_RDN
1061 * A pointero to an NSSRDNSeq upon success
1064 NSS_EXTERN NSSRDNSeq
*
1075 * This routine will destroy an RDNSeq object. It should eventually
1076 * be called on all RDNSeqs created without an arena. While it is not
1077 * necessary to call it on RDNSeqs created within an arena, it is not
1078 * an error to do so. This routine returns a PRStatus value; if
1079 * successful, it will return PR_SUCCESS. If unsuccessful, it will
1080 * set an error on the error stack and return PR_FAILURE.
1082 * The error may be one of the following values:
1083 * NSS_ERROR_INVALID_RDNSEQ
1086 * PR_FAILURE upon error
1087 * PR_SUCCESS upon success
1097 * nssRDNSeq_GetDEREncoding
1099 * This routine will DER-encode an RDNSeq object. If the optional
1100 * arena argument is non-null, the memory used will be obtained from
1101 * that arena; otherwise, the memory will be obtained from the heap.
1102 * This routine may return null upon error, in which case it will have
1103 * set an error on the error stack.
1105 * The error may be one of the following values:
1106 * NSS_ERROR_INVALID_RDNSEQ
1107 * NSS_ERROR_NO_MEMORY
1111 * The DER encoding of this NSSRDNSeq
1115 nssRDNSeq_GetDEREncoding
1122 * nssRDNSeq_GetUTF8Encoding
1124 * This routine returns a UTF8 string containing a string
1125 * representation of the RDNSeq as a comma-separated sequence of RDNs.
1126 * If the optional arena argument is non-null, the memory used will be
1127 * obtained from that arena; otherwise, the memory will be obtained
1128 * from the heap. This routine may return null upon error, in which
1129 * case it will have set an error on the error stack.
1131 * The error may be one of the following values:
1132 * NSS_ERROR_INVALID_RDNSEQ
1133 * NSS_ERROR_NO_MEMORY
1137 * A pointer to the UTF8 string
1140 NSS_EXTERN NSSUTF8
*
1141 nssRDNSeq_GetUTF8Encoding
1148 * nssRDNSeq_AppendRDN
1150 * This routine appends an RDN to the end of the existing RDN
1151 * sequence. If the RDNSeq was created with a non-null arena
1152 * argument, that same arena will be used for any additional required
1153 * memory. If the RDNSeq was created with a NULL arena argument, any
1154 * additional memory will be obtained from the heap. This routine
1155 * returns a PRStatus value; it will return PR_SUCCESS upon success,
1156 * and upon failure it will set an error on the error stack and return
1159 * The error may be one of the following values:
1160 * NSS_ERROR_INVALID_RDNSEQ
1161 * NSS_ERROR_INVALID_RDN
1162 * NSS_ERROR_NO_MEMORY
1165 * PR_SUCCESS upon success
1166 * PR_FAILURE upon failure
1177 * nssRDNSeq_GetRDNCount
1179 * This routine returns the cardinality of the sequence of RDNs within
1180 * the specified RDNSeq. This routine may return 0 upon error, in
1181 * which case it will have set an error on the error stack.
1183 * The error may be one of the following values:
1184 * NSS_ERROR_INVALID_RDNSEQ
1188 * A positive number upon success
1192 nssRDNSeq_GetRDNCount
1200 * This routine returns a pointer to the i'th RDN in the sequence of
1201 * RDNs that make up the specified RDNSeq. The sequence begins with
1202 * the top-level (e.g., "c=US") RDN. The value of the variable 'i'
1203 * is on the range [0,c) where c is the cardinality returned from
1204 * NSSRDNSeq_GetRDNCount. The caller owns the RDN the pointer to which
1205 * is returned. If the optional arena argument is non-null, the memory
1206 * used will be obtained from that areana; otherwise, the memory will
1207 * be obtained from the heap. This routine may return NULL upon error,
1208 * in which case it will have set an error upon the error stack. Note
1209 * that the usual UTF8 representation of RDN Sequences is from last
1212 * The error may be one of the following values:
1213 * NSS_ERROR_INVALID_RDNSEQ
1214 * NSS_ERROR_VALUE_OUT_OF_RANGE
1215 * NSS_ERROR_NO_MEMORY
1219 * A caller-owned pointer to an NSSRDN
1233 * This routine compares two RDNSeqs for equality. For two RDNSeqs to
1234 * be equal, they must have the same number of RDNs, and each RDN in
1235 * one sequence must be equal to the corresponding RDN in the other
1236 * sequence. The result of the comparison will be stored at the
1237 * location pointed to by the "equalp" variable, which must point to a
1238 * valid PRBool. This routine may return PR_FAILURE upon error, in
1239 * which case it will have set an error on the error stack.
1241 * The error may be one of the following values:
1242 * NSS_ERROR_INVALID_RDNSEQ
1243 * NSS_ERROR_INVALID_ARGUMENT
1246 * PR_FAILURE on error
1247 * PR_SUCCESS upon a successful comparison (equal or not)
1259 * nssRDNSeq_Duplicate
1261 * This routine duplicates the specified RDNSeq. If the optional arena
1262 * argument is non-null, the memory required will be obtained from that
1263 * arena; otherwise, the memory will be obtained from the heap. This
1264 * routine may return NULL upon error, in which case it will have
1265 * placed an error on the error stack.
1267 * The error may be one of the following values:
1268 * NSS_ERROR_INVALID_RDNSEQ
1269 * NSS_ERROR_NO_MEMORY
1273 * A pointer to a new RDNSeq
1276 NSS_EXTERN NSSRDNSeq
*
1284 * nssRDNSeq_EvaluateUTF8
1286 * This routine evaluates a UTF8 string, and returns PR_TRUE if the
1287 * string contains the string representation of an RDNSeq. This
1288 * routine is used by the (directory) Name routines
1289 * nssName_CreateFromUTF8 and nssName_EvaluateUTF8 to determine which
1290 * choice of directory name the string may encode. This routine may
1291 * return PR_FALSE upon error, but it subsumes that condition under the
1292 * general "string does not evaluate as an RDNSeq" state, and does not
1293 * set an error on the error stack.
1296 * PR_TRUE if the string represents an RDNSeq
1297 * PR_FALSE if otherwise
1301 nssRDNSeq_EvaluateUTF8
1309 * The non-public "methods" regarding this "object" are:
1311 * nssName_CreateFromBER -- constructor
1312 * nssName_CreateFromUTF8 -- constructor
1313 * nssName_Create -- constructor
1316 * nssName_GetDEREncoding
1317 * nssName_GetUTF8Encoding
1319 * nssName_GetRDNSequence
1320 * nssName_GetSpecifiedChoice
1326 * nssName_GetCommonName
1327 * nssName_GetOrganization
1328 * nssName_GetOrganizationalUnits
1329 * nssName_GetStateOrProvince
1330 * nssName_GetLocality
1331 * nssName_GetCountry
1332 * nssName_GetAttribute
1334 * nssName_EvaluateUTF8 -- not an object method
1338 * nssName_CreateFromBER
1340 * This routine creates an NSSName by decoding a BER- or DER-encoded
1341 * (directory) Name. If the optional arena argument is non-null,
1342 * the memory used will be obtained from that arena; otherwise,
1343 * the memory will be obtained from the heap. This routine may
1344 * return NULL upon error, in which case it will have set an error
1345 * on the error stack.
1347 * The error may be one of the following values:
1348 * NSS_ERROR_INVALID_BER
1349 * NSS_ERROR_NO_MEMORY
1353 * A pointer to an NSSName upon success
1356 NSS_EXTERN NSSName
*
1357 nssName_CreateFromBER
1364 * nssName_CreateFromUTF8
1366 * This routine creates an NSSName by decoding a UTF8 string
1367 * consisting of the string representation of one of the choices of
1368 * (directory) names. Currently the only choice is an RDNSeq. If the
1369 * optional arena argument is non-null, the memory used will be
1370 * obtained from that arena; otherwise, the memory will be obtained
1371 * from the heap. The routine may return NULL upon error, in which
1372 * case it will have set an error on the error stack.
1374 * The error may be one of the following values:
1375 * NSS_ERROR_INVALID_UTF8
1376 * NSS_ERROR_NO_MEMORY
1380 * A pointer to an NSSName upon success
1383 NSS_EXTERN NSSName
*
1384 nssName_CreateFromUTF8
1393 * This routine creates an NSSName with the specified choice of
1394 * underlying name types. The value of the choice variable must be
1395 * one of the values of the NSSNameChoice enumeration, and the type
1396 * of the arg variable must be as specified in the following table:
1399 * ======================== ===========
1400 * NSSNameChoiceRdnSequence NSSRDNSeq *
1402 * If the optional arena argument is non-null, the memory used will
1403 * be obtained from that arena; otherwise, the memory will be
1404 * obtained from the heap. This routine may return NULL upon error,
1405 * in which case it will have set an error on the error stack.
1407 * The error may be one of the following values:
1408 * NSS_ERROR_INVALID_CHOICE
1409 * NSS_ERROR_INVALID_ARGUMENT
1410 * NSS_ERROR_NO_MEMORY
1414 * A pointer to an NSSName upon success
1417 NSS_EXTERN NSSName
*
1421 NSSNameChoice choice
,
1428 * This routine will destroy a Name object. It should eventually be
1429 * called on all Names created without an arena. While it is not
1430 * necessary to call it on Names created within an arena, it is not
1431 * an error to do so. This routine returns a PRStatus value; if
1432 * successful, it will return PR_SUCCESS. If unsuccessful, it will
1433 * set an error on the error stack and return PR_FAILURE.
1435 * The error may be one of the following values:
1436 * NSS_ERROR_INVALID_NAME
1439 * PR_FAILURE upon error
1440 * PR_SUCCESS upon success
1450 * nssName_GetDEREncoding
1452 * This routine will DER-encode a name object. If the optional arena
1453 * argument is non-null, the memory used will be obtained from that
1454 * arena; otherwise, the memory will be obtained from the heap. This
1455 * routine may return null upon error, in which case it will have set
1456 * an error on the error stack.
1458 * The error may be one of the following values:
1459 * NSS_ERROR_INVALID_NAME
1460 * NSS_ERROR_NO_MEMORY
1464 * The DER encoding of this NSSName
1468 nssName_GetDEREncoding
1475 * nssName_GetUTF8Encoding
1477 * This routine returns a UTF8 string containing a string
1478 * representation of the Name in the format specified by the
1479 * underlying name choice. If the optional arena argument is non-null,
1480 * the memory used will be obtained from that arena; otherwise, the
1481 * memory will be obtained from the heap. This routine may return
1482 * NULL upon error, in which case it will have set an error on the
1485 * The error may be one of the following values:
1486 * NSS_ERROR_INVALID_NAME
1487 * NSS_ERROR_NO_MEMORY
1491 * A pointer to the UTF8 string
1494 NSS_EXTERN NSSUTF8
*
1495 nssName_GetUTF8Encoding
1504 * This routine returns the type of the choice underlying the specified
1505 * name. The return value will be a member of the NSSNameChoice
1506 * enumeration. This routine may return NSSNameChoiceInvalid upon
1507 * error, in which case it will have set an error on the error stack.
1509 * The error may be one of the following values:
1510 * NSS_ERROR_INVALID_NAME
1513 * NSSNameChoiceInvalid upon error
1514 * An other member of the NSSNameChoice enumeration upon success
1517 NSS_EXTERN NSSNameChoice
1524 * nssName_GetRDNSequence
1526 * If the choice underlying the specified NSSName is that of an
1527 * RDNSequence, this routine will return a pointer to that RDN
1528 * sequence. Otherwise, this routine will place an error on the
1529 * error stack, and return NULL. If the optional arena argument is
1530 * non-null, the memory required will be obtained from that arena;
1531 * otherwise, the memory will be obtained from the heap. The
1532 * caller owns the returned pointer. This routine may return NULL
1533 * upon error, in which case it will have set an error on the error
1536 * The error may be one of the following values:
1537 * NSS_ERROR_INVALID_NAME
1538 * NSS_ERROR_WRONG_CHOICE
1539 * NSS_ERROR_NO_MEMORY
1543 * A caller-owned pointer to an NSSRDNSeq
1546 NSS_EXTERN NSSRDNSeq
*
1547 nssName_GetRDNSequence
1554 * nssName_GetSpecifiedChoice
1556 * If the choice underlying the specified NSSName matches the specified
1557 * choice, a caller-owned pointer to that underlying object will be
1558 * returned. Otherwise, an error will be placed on the error stack and
1559 * NULL will be returned. If the optional arena argument is non-null,
1560 * the memory required will be obtained from that arena; otherwise, the
1561 * memory will be obtained from the heap. The caller owns the returned
1562 * pointer. This routine may return NULL upon error, in which case it
1563 * will have set an error on the error stack.
1565 * The error may be one of the following values:
1566 * NSS_ERROR_INVALID_NAME
1567 * NSS_ERROR_WRONG_CHOICE
1568 * NSS_ERROR_NO_MEMORY
1572 * A caller-owned pointer, which must be typecast
1576 nssName_GetSpecifiedChoice
1579 NSSNameChoice choice
,
1586 * This routine compares two Names for equality. For two Names to be
1587 * equal, they must have the same choice of underlying types, and the
1588 * underlying values must be equal. The result of the comparison will
1589 * be stored at the location pointed to by the "equalp" variable, which
1590 * must point to a valid PRBool. This routine may return PR_FAILURE
1591 * upon error, in which case it will have set an error on the error
1594 * The error may be one of the following values:
1595 * NSS_ERROR_INVALID_NAME
1596 * NSS_ERROR_INVALID_ARGUMENT
1599 * PR_FAILURE on error
1600 * PR_SUCCESS upon a successful comparison (equal or not)
1614 * This routine duplicates the specified nssname. If the optional
1615 * arena argument is non-null, the memory required will be obtained
1616 * from that arena; otherwise, the memory will be obtained from the
1617 * heap. This routine may return NULL upon error, in which case it
1618 * will have placed an error on the error stack.
1620 * The error may be one of the following values:
1621 * NSS_ERROR_INVALID_NAME
1622 * NSS_ERROR_NO_MEMORY
1626 * A pointer to a new NSSName
1629 NSS_EXTERN NSSName
*
1639 * This routine will attempt to derive a user identifier from the
1640 * specified name, if the choices and content of the name permit.
1641 * If the Name consists of a Sequence of Relative Distinguished
1642 * Names containing a UID attribute, the UID will be the value of
1643 * that attribute. Note that no UID attribute is defined in either
1644 * PKIX or PKCS#9; rather, this seems to derive from RFC 1274, which
1645 * defines the type as a caseIgnoreString. We'll return a Directory
1646 * String. If the optional arena argument is non-null, the memory
1647 * used will be obtained from that arena; otherwise, the memory will
1648 * be obtained from the heap. This routine may return NULL upon error,
1649 * in which case it will have set an error on the error stack.
1651 * The error may be one of the following values:
1652 * NSS_ERROR_INVALID_NAME
1654 * NSS_ERROR_NO_MEMORY
1658 * A pointer to a UTF8 String.
1661 NSS_EXTERN NSSUTF8
* /* XXX fgmr DirectoryString */
1671 * This routine will attempt to derive an email address from the
1672 * specified name, if the choices and content of the name permit.
1673 * If the Name consists of a Sequence of Relative Distinguished
1674 * Names containing either a PKIX email address or a PKCS#9 email
1675 * address, the result will be the value of that attribute. If the
1676 * optional arena argument is non-null, the memory used will be
1677 * obtained from that arena; otherwise, the memory will be obtained
1678 * from the heap. This routine may return NULL upon error, in which
1679 * case it will have set an error on the error stack.
1681 * The error may be one of the following values:
1682 * NSS_ERROR_INVALID_NAME
1683 * NSS_ERROR_NO_EMAIL
1684 * NSS_ERROR_NO_MEMORY
1688 * A pointer to a UTF8 String
1691 NSS_EXTERN NSSUTF8
* /* XXX fgmr IA5 String */
1699 * nssName_GetCommonName
1701 * This routine will attempt to derive a common name from the
1702 * specified name, if the choices and content of the name permit.
1703 * If the Name consists of a Sequence of Relative Distinguished Names
1704 * containing a PKIX Common Name, the result will be that name. If
1705 * the optional arena argument is non-null, the memory used will be
1706 * obtained from that arena; otherwise, the memory will be obtained
1707 * from the heap. This routine may return NULL upon error, in which
1708 * case it will have set an error on the error stack.
1710 * The error may be one of the following values:
1711 * NSS_ERROR_INVALID_NAME
1712 * NSS_ERROR_NO_COMMON_NAME
1713 * NSS_ERROR_NO_MEMORY
1717 * A pointer to a UTF8 String
1720 NSS_EXTERN NSSUTF8
* /* XXX fgmr DirectoryString */
1721 nssName_GetCommonName
1728 * nssName_GetOrganization
1730 * This routine will attempt to derive an organisation name from the
1731 * specified name, if the choices and content of the name permit.
1732 * If Name consists of a Sequence of Relative Distinguished names
1733 * containing a PKIX Organization, the result will be the value of
1734 * that attribute. If the optional arena argument is non-null, the
1735 * memory used will be obtained from that arena; otherwise, the memory
1736 * will be obtained from the heap. This routine may return NULL upon
1737 * error, in which case it will have set an error on the error stack.
1739 * The error may be one of the following values:
1740 * NSS_ERROR_INVALID_NAME
1741 * NSS_ERROR_NO_ORGANIZATION
1742 * NSS_ERROR_NO_MEMORY
1746 * A pointer to a UTF8 String
1749 NSS_EXTERN NSSUTF8
* /* XXX fgmr DirectoryString */
1750 nssName_GetOrganization
1757 * nssName_GetOrganizationalUnits
1759 * This routine will attempt to derive a sequence of organisational
1760 * unit names from the specified name, if the choices and content of
1761 * the name permit. If the Name consists of a Sequence of Relative
1762 * Distinguished Names containing one or more organisational units,
1763 * the result will be the values of those attributes. If the optional
1764 * arena argument is non-null, the memory used will be obtained from
1765 * that arena; otherwise, the memory will be obtained from the heap.
1766 * This routine may return NULL upon error, in which case it will have
1767 * set an error on the error stack.
1769 * The error may be one of the following values:
1770 * NSS_ERROR_INVALID_NAME
1771 * NSS_ERROR_NO_ORGANIZATIONAL_UNITS
1772 * NSS_ERROR_NO_MEMORY
1776 * A pointer to a null-terminated array of UTF8 Strings
1779 NSS_EXTERN NSSUTF8
** /* XXX fgmr DirectoryString */
1780 nssName_GetOrganizationalUnits
1787 * nssName_GetStateOrProvince
1789 * This routine will attempt to derive a state or province name from
1790 * the specified name, if the choices and content of the name permit.
1791 * If the Name consists of a Sequence of Relative Distinguished Names
1792 * containing a state or province, the result will be the value of
1793 * that attribute. If the optional arena argument is non-null, the
1794 * memory used will be obtained from that arena; otherwise, the memory
1795 * will be obtained from the heap. This routine may return NULL upon
1796 * error, in which case it will have set an error on the error stack.
1798 * The error may be one of the following values:
1799 * NSS_ERROR_INVALID_NAME
1800 * NSS_ERROR_NO_STATE_OR_PROVINCE
1801 * NSS_ERROR_NO_MEMORY
1805 * A pointer to a UTF8 String
1808 NSS_EXTERN NSSUTF8
* /* XXX fgmr DirectoryString */
1809 nssName_GetStateOrProvince
1816 * nssName_GetLocality
1818 * This routine will attempt to derive a locality name from the
1819 * specified name, if the choices and content of the name permit. If
1820 * the Name consists of a Sequence of Relative Distinguished names
1821 * containing a Locality, the result will be the value of that
1822 * attribute. If the optional arena argument is non-null, the memory
1823 * used will be obtained from that arena; otherwise, the memory will
1824 * be obtained from the heap. This routine may return NULL upon error,
1825 * in which case it will have set an error on the error stack.
1827 * The error may be one of the following values:
1828 * NSS_ERROR_INVALID_NAME
1829 * NSS_ERROR_NO_LOCALITY
1830 * NSS_ERROR_NO_MEMORY
1834 * A pointer to a UTF8 String
1837 NSS_EXTERN NSSUTF8
* /* XXX fgmr DirectoryString */
1845 * nssName_GetCountry
1847 * This routine will attempt to derive a country name from the
1848 * specified name, if the choices and content of the name permit.
1849 * If the Name consists of a Sequence of Relative Distinguished
1850 * Names containing a Country, the result will be the value of
1851 * that attribute.. If the optional arena argument is non-null,
1852 * the memory used will be obtained from that arena; otherwise,
1853 * the memory will be obtained from the heap. This routine may
1854 * return NULL upon error, in which case it will have set an error
1855 * on the error stack.
1857 * The error may be one of the following values:
1858 * NSS_ERROR_INVALID_NAME
1859 * NSS_ERROR_NO_COUNTRY
1860 * NSS_ERROR_NO_MEMORY
1864 * A pointer to a UTF8 String
1867 NSS_EXTERN NSSUTF8
* /* XXX fgmr PrintableString */
1875 * nssName_GetAttribute
1877 * If the specified name consists of a Sequence of Relative
1878 * Distinguished Names containing an attribute with the specified
1879 * type, and the actual value of that attribute may be expressed
1880 * with a Directory String, then the value of that attribute will
1881 * be returned as a Directory String. If the optional arena argument
1882 * is non-null, the memory used will be obtained from that arena;
1883 * otherwise, the memory will be obtained from the heap. This routine
1884 * may return NULL upon error, in which case it will have set an error
1885 * on the error stack.
1887 * The error may be one of the following values:
1888 * NSS_ERROR_INVALID_NAME
1889 * NSS_ERROR_NO_ATTRIBUTE
1890 * NSS_ERROR_ATTRIBUTE_VALUE_NOT_STRING
1894 * A pointer to a UTF8 String
1897 NSS_EXTERN NSSUTF8
* /* XXX fgmr DirectoryString */
1898 nssName_GetAttribute
1906 * nssName_EvaluateUTF8
1908 * This routine evaluates a UTF8 string, and returns PR_TRUE if the
1909 * string contains the string representation of an NSSName. This
1910 * routine is used by the GeneralName routine
1911 * nssGeneralName_CreateFromUTF8 to determine which choice of
1912 * general name the string may encode. This routine may return
1913 * PR_FALSE upon error, but it subsumes that condition under the
1914 * general "string does not evaluate as a Name" state, and does not
1915 * set an error on the error stack.
1918 * PR_TRUE if the string represents a Name
1919 * PR_FALSE otherwise
1923 nssName_EvaluateUTF8
1931 * The non-public "methods" regarding this "object" are:
1933 * nssGeneralName_CreateFromBER -- constructor
1934 * nssGeneralName_CreateFromUTF8 -- constructor
1935 * nssGeneralName_Create -- constructor
1937 * nssGeneralName_Destroy
1938 * nssGeneralName_GetDEREncoding
1939 * nssGeneralName_GetUTF8Encoding
1940 * nssGeneralName_GetChoice
1941 * nssGeneralName_GetOtherName
1942 * nssGeneralName_GetRfc822Name
1943 * nssGeneralName_GetDNSName
1944 * nssGeneralName_GetX400Address
1945 * nssGeneralName_GetDirectoryName
1946 * nssGeneralName_GetEdiPartyName
1947 * nssGeneralName_GetUniformResourceIdentifier
1948 * nssGeneralName_GetIPAddress
1949 * nssGeneralName_GetRegisteredID
1950 * nssGeneralName_GetSpecifiedChoice
1951 * nssGeneralName_Compare
1952 * nssGeneralName_Duplicate
1954 * nssGeneralName_GetUID
1955 * nssGeneralName_GetEmail
1956 * nssGeneralName_GetCommonName
1957 * nssGeneralName_GetOrganization
1958 * nssGeneralName_GetOrganizationalUnits
1959 * nssGeneralName_GetStateOrProvince
1960 * nssGeneralName_GetLocality
1961 * nssGeneralName_GetCountry
1962 * nssGeneralName_GetAttribute
1966 * nssGeneralName_CreateFromBER
1968 * This routine creates an NSSGeneralName by decoding a BER- or DER-
1969 * encoded general name. If the optional arena argument is non-null,
1970 * the memory used will be obtained from that arena; otherwise, the
1971 * memory will be obtained from the heap. This routine may return
1972 * NULL upon error, in which case it will have set an error on the
1975 * The error may be one of the following values:
1976 * NSS_ERROR_INVALID_BER
1977 * NSS_ERROR_NO_MEMORY
1981 * A pointer to an NSSGeneralName upon success
1984 NSS_EXTERN NSSGeneralName
*
1985 nssGeneralName_CreateFromBER
1988 NSSBER
*berGeneralName
1992 * nssGeneralName_CreateFromUTF8
1994 * This routine creates an NSSGeneralName by decoding a UTF8 string
1995 * consisting of the string representation of one of the choices of
1996 * general names. If the optional arena argument is non-null, the
1997 * memory used will be obtained from that arena; otherwise, the memory
1998 * will be obtained from the heap. The routine may return NULL upon
1999 * error, in which case it will have set an error on the error stack.
2001 * The error may be one of the following values:
2002 * NSS_ERROR_INVALID_UTF8
2003 * NSS_ERROR_NO_MEMORY
2007 * A pointer to an NSSGeneralName upon success
2010 NSS_EXTERN NSSGeneralName
*
2011 nssGeneralName_CreateFromUTF8
2014 NSSUTF8
*stringGeneralName
2018 * nssGeneralName_Create
2020 * This routine creates an NSSGeneralName with the specified choice of
2021 * underlying name types. The value of the choice variable must be one
2022 * of the values of the NSSGeneralNameChoice enumeration, and the type
2023 * of the arg variable must be as specified in the following table:
2026 * ============================================ =========
2027 * NSSGeneralNameChoiceOtherName
2028 * NSSGeneralNameChoiceRfc822Name
2029 * NSSGeneralNameChoiceDNSName
2030 * NSSGeneralNameChoiceX400Address
2031 * NSSGeneralNameChoiceDirectoryName NSSName *
2032 * NSSGeneralNameChoiceEdiPartyName
2033 * NSSGeneralNameChoiceUniformResourceIdentifier
2034 * NSSGeneralNameChoiceIPAddress
2035 * NSSGeneralNameChoiceRegisteredID
2037 * If the optional arena argument is non-null, the memory used will
2038 * be obtained from that arena; otherwise, the memory will be
2039 * obtained from the heap. This routine may return NULL upon error,
2040 * in which case it will have set an error on the error stack.
2042 * The error may be one fo the following values:
2043 * NSS_ERROR_INVALID_CHOICE
2044 * NSS_ERROR_INVALID_ARGUMENT
2045 * NSS_ERROR_NO_MEMORY
2049 * A pointer to an NSSGeneralName upon success
2052 NSS_EXTERN NSSGeneralName
*
2053 nssGeneralName_Create
2055 NSSGeneralNameChoice choice
,
2060 * nssGeneralName_Destroy
2062 * This routine will destroy a General Name object. It should
2063 * eventually be called on all General Names created without an arena.
2064 * While it is not necessary to call it on General Names created within
2065 * an arena, it is not an error to do so. This routine returns a
2066 * PRStatus value; if successful, it will return PR_SUCCESS. If
2067 * usuccessful, it will set an error on the error stack and return
2070 * The error may be one of the following values:
2071 * NSS_ERROR_INVALID_GENERAL_NAME
2074 * PR_FAILURE upon failure
2075 * PR_SUCCESS upon success
2079 nssGeneralName_Destroy
2081 NSSGeneralName
*generalName
2085 * nssGeneralName_GetDEREncoding
2087 * This routine will DER-encode a name object. If the optional arena
2088 * argument is non-null, the memory used will be obtained from that
2089 * arena; otherwise, the memory will be obtained from the heap. This
2090 * routine may return null upon error, in which case it will have set
2091 * an error on the error stack.
2093 * The error may be one of the following values:
2094 * NSS_ERROR_INVALID_GENERAL_NAME
2095 * NSS_ERROR_NO_MEMORY
2099 * The DER encoding of this NSSGeneralName
2103 nssGeneralName_GetDEREncoding
2105 NSSGeneralName
*generalName
,
2110 * nssGeneralName_GetUTF8Encoding
2112 * This routine returns a UTF8 string containing a string
2113 * representation of the General Name in the format specified by the
2114 * underlying name choice. If the optional arena argument is
2115 * non-null, the memory used will be obtained from that arena;
2116 * otherwise, the memory will be obtained from the heap. This routine
2117 * may return NULL upon error, in which case it will have set an error
2118 * on the error stack.
2120 * The error may be one of the following values:
2121 * NSS_ERROR_INVALID_GENERAL_NAME
2122 * NSS_ERROR_NO_MEMORY
2126 * A pointer to a UTF8 string
2129 NSS_EXTERN NSSUTF8
*
2130 nssGeneralName_GetUTF8Encoding
2132 NSSGeneralName
*generalName
,
2137 * nssGeneralName_GetChoice
2139 * This routine returns the type of choice underlying the specified
2140 * general name. The return value will be a member of the
2141 * NSSGeneralNameChoice enumeration. This routine may return
2142 * NSSGeneralNameChoiceInvalid upon error, in which case it will have
2143 * set an error on the error stack.
2145 * The error may be one of the following values:
2146 * NSS_ERROR_INVALID_GENERAL_NAME
2149 * NSSGeneralNameChoiceInvalid upon error
2150 * An other member of the NSSGeneralNameChoice enumeration
2153 NSS_EXTERN NSSGeneralNameChoice
2154 nssGeneralName_GetChoice
2156 NSSGeneralName
*generalName
2160 * nssGeneralName_GetOtherName
2162 * If the choice underlying the specified NSSGeneralName is that of an
2163 * Other Name, this routine will return a pointer to that Other name.
2164 * Otherwise, this routine will place an error on the error stack, and
2165 * return NULL. If the optional arena argument is non-null, the memory
2166 * required will be obtained from that arena; otherwise, the memory
2167 * will be obtained from the heap. The caller owns the returned
2168 * pointer. This routine may return NULL upon error, in which case it
2169 * will have set an error on the error stack.
2171 * The error may be one of the following values:
2172 * NSS_ERROR_INVALID_GENERAL_NAME
2173 * NSS_ERROR_WRONG_CHOICE
2174 * NSS_ERROR_NO_MEMORY
2178 * A caller-owned pointer to an NSSOtherName
2181 NSS_EXTERN NSSOtherName
*
2182 nssGeneralName_GetOtherName
2184 NSSGeneralName
*generalName
,
2189 * nssGeneralName_GetRfc822Name
2191 * If the choice underlying the specified NSSGeneralName is that of an
2192 * RFC 822 Name, this routine will return a pointer to that name.
2193 * Otherwise, this routine will place an error on the error stack, and
2194 * return NULL. If the optional arena argument is non-null, the memory
2195 * required will be obtained from that arena; otherwise, the memory
2196 * will be obtained from the heap. The caller owns the returned
2197 * pointer. This routine may return NULL upon error, in which case it
2198 * will have set an error on the error stack.
2200 * The error may be one of the following values:
2201 * NSS_ERROR_INVALID_GENERAL_NAME
2202 * NSS_ERROR_WRONG_CHOICE
2203 * NSS_ERROR_NO_MEMORY
2207 * A caller-owned pointer to an NSSRFC822Name
2210 NSS_EXTERN NSSRFC822Name
*
2211 nssGeneralName_GetRfc822Name
2213 NSSGeneralName
*generalName
,
2218 * nssGeneralName_GetDNSName
2220 * If the choice underlying the specified NSSGeneralName is that of a
2221 * DNS Name, this routine will return a pointer to that DNS name.
2222 * Otherwise, this routine will place an error on the error stack, and
2223 * return NULL. If the optional arena argument is non-null, the memory
2224 * required will be obtained from that arena; otherwise, the memory
2225 * will be obtained from the heap. The caller owns the returned
2226 * pointer. This routine may return NULL upon error, in which case it
2227 * will have set an error on the error stack.
2229 * The error may be one of the following values:
2230 * NSS_ERROR_INVALID_GENERAL_NAME
2231 * NSS_ERROR_WRONG_CHOICE
2232 * NSS_ERROR_NO_MEMORY
2236 * A caller-owned pointer to an NSSDNSName
2239 NSS_EXTERN NSSDNSName
*
2240 nssGeneralName_GetDNSName
2242 NSSGeneralName
*generalName
,
2247 * nssGeneralName_GetX400Address
2249 * If the choice underlying the specified NSSGeneralName is that of an
2250 * X.400 Address, this routine will return a pointer to that Address.
2251 * Otherwise, this routine will place an error on the error stack, and
2252 * return NULL. If the optional arena argument is non-null, the memory
2253 * required will be obtained from that arena; otherwise, the memory
2254 * will be obtained from the heap. The caller owns the returned
2255 * pointer. This routine may return NULL upon error, in which case it
2256 * will have set an error on the error stack.
2258 * The error may be one of the following values:
2259 * NSS_ERROR_INVALID_GENERAL_NAME
2260 * NSS_ERROR_WRONG_CHOICE
2261 * NSS_ERROR_NO_MEMORY
2265 * A caller-owned pointer to an NSSX400Address
2268 NSS_EXTERN NSSX400Address
*
2269 nssGeneralName_GetX400Address
2271 NSSGeneralName
*generalName
,
2276 * nssGeneralName_GetDirectoryName
2278 * If the choice underlying the specified NSSGeneralName is that of a
2279 * (directory) Name, this routine will return a pointer to that name.
2280 * Otherwise, this routine will place an error on the error stack, and
2281 * return NULL. If the optional arena argument is non-null, the memory
2282 * required will be obtained from that arena; otherwise, the memory
2283 * will be obtained from the heap. The caller owns the returned
2284 * pointer. This routine may return NULL upon error, in which case it
2285 * will have set an error on the error stack.
2287 * The error may be one of the following values:
2288 * NSS_ERROR_INVALID_GENERAL_NAME
2289 * NSS_ERROR_WRONG_CHOICE
2290 * NSS_ERROR_NO_MEMORY
2294 * A caller-owned pointer to an NSSName
2297 NSS_EXTERN NSSName
*
2298 nssGeneralName_GetName
2300 NSSGeneralName
*generalName
,
2305 * nssGeneralName_GetEdiPartyName
2307 * If the choice underlying the specified NSSGeneralName is that of an
2308 * EDI Party Name, this routine will return a pointer to that name.
2309 * Otherwise, this routine will place an error on the error stack, and
2310 * return NULL. If the optional arena argument is non-null, the memory
2311 * required will be obtained from that arena; otherwise, the memory
2312 * will be obtained from the heap. The caller owns the returned
2313 * pointer. This routine may return NULL upon error, in which case it
2314 * will have set an error on the error stack.
2316 * The error may be one of the following values:
2317 * NSS_ERROR_INVALID_GENERAL_NAME
2318 * NSS_ERROR_WRONG_CHOICE
2319 * NSS_ERROR_NO_MEMORY
2323 * A caller-owned pointer to an NSSEdiPartyName
2326 NSS_EXTERN NSSEdiPartyName
*
2327 nssGeneralName_GetEdiPartyName
2329 NSSGeneralName
*generalName
,
2334 * nssGeneralName_GetUniformResourceIdentifier
2336 * If the choice underlying the specified NSSGeneralName is that of a
2337 * URI, this routine will return a pointer to that URI.
2338 * Otherwise, this routine will place an error on the error stack, and
2339 * return NULL. If the optional arena argument is non-null, the memory
2340 * required will be obtained from that arena; otherwise, the memory
2341 * will be obtained from the heap. The caller owns the returned
2342 * pointer. This routine may return NULL upon error, in which case it
2343 * will have set an error on the error stack.
2345 * The error may be one of the following values:
2346 * NSS_ERROR_INVALID_GENERAL_NAME
2347 * NSS_ERROR_WRONG_CHOICE
2348 * NSS_ERROR_NO_MEMORY
2352 * A caller-owned pointer to an NSSURI
2356 nssGeneralName_GetUniformResourceIdentifier
2358 NSSGeneralName
*generalName
,
2363 * nssGeneralName_GetIPAddress
2365 * If the choice underlying the specified NSSGeneralName is that of an
2366 * IP Address , this routine will return a pointer to that address.
2367 * Otherwise, this routine will place an error on the error stack, and
2368 * return NULL. If the optional arena argument is non-null, the memory
2369 * required will be obtained from that arena; otherwise, the memory
2370 * will be obtained from the heap. The caller owns the returned
2371 * pointer. This routine may return NULL upon error, in which case it
2372 * will have set an error on the error stack.
2374 * The error may be one of the following values:
2375 * NSS_ERROR_INVALID_GENERAL_NAME
2376 * NSS_ERROR_WRONG_CHOICE
2377 * NSS_ERROR_NO_MEMORY
2381 * A caller-owned pointer to an NSSIPAddress
2384 NSS_EXTERN NSSIPAddress
*
2385 nssGeneralName_GetIPAddress
2387 NSSGeneralName
*generalName
,
2392 * nssGeneralName_GetRegisteredID
2394 * If the choice underlying the specified NSSGeneralName is that of a
2395 * Registered ID, this routine will return a pointer to that ID.
2396 * Otherwise, this routine will place an error on the error stack, and
2397 * return NULL. If the optional arena argument is non-null, the memory
2398 * required will be obtained from that arena; otherwise, the memory
2399 * will be obtained from the heap. The caller owns the returned
2400 * pointer. This routine may return NULL upon error, in which case it
2401 * will have set an error on the error stack.
2403 * The error may be one of the following values:
2404 * NSS_ERROR_INVALID_GENERAL_NAME
2405 * NSS_ERROR_WRONG_CHOICE
2406 * NSS_ERROR_NO_MEMORY
2410 * A caller-owned pointer to an NSSRegisteredID
2413 NSS_EXTERN NSSRegisteredID
*
2414 nssGeneralName_GetRegisteredID
2416 NSSGeneralName
*generalName
,
2421 * nssGeneralName_GetSpecifiedChoice
2423 * If the choice underlying the specified NSSGeneralName matches the
2424 * specified choice, a caller-owned pointer to that underlying object
2425 * will be returned. Otherwise, an error will be placed on the error
2426 * stack and NULL will be returned. If the optional arena argument
2427 * is non-null, the memory required will be obtained from that arena;
2428 * otherwise, the memory will be obtained from the heap. The caller
2429 * owns the returned pointer. This routine may return NULL upon
2430 * error, in which caes it will have set an error on the error stack.
2432 * The error may be one of the following values:
2433 * NSS_ERROR_INVALID_GENERAL_NAME
2434 * NSS_ERROR_WRONG_CHOICE
2435 * NSS_ERROR_NO_MEMORY
2439 * A caller-owned pointer, which must be typecast
2443 nssGeneralName_GetSpecifiedChoice
2445 NSSGeneralName
*generalName
,
2446 NSSGeneralNameChoice choice
,
2451 * nssGeneralName_Compare
2453 * This routine compares two General Names for equality. For two
2454 * General Names to be equal, they must have the same choice of
2455 * underlying types, and the underlying values must be equal. The
2456 * result of the comparison will be stored at the location pointed
2457 * to by the "equalp" variable, which must point to a valid PRBool.
2458 * This routine may return PR_FAILURE upon error, in which case it
2459 * will have set an error on the error stack.
2461 * The error may be one of the following value:
2462 * NSS_ERROR_INVALID_GENERAL_NAME
2463 * NSS_ERROR_INVALID_ARGUMENT
2466 * PR_FAILURE upon error
2467 * PR_SUCCESS upon a successful comparison (equal or not)
2471 nssGeneralName_Compare
2473 NSSGeneralName
*generalName1
,
2474 NSSGeneralName
*generalName2
,
2479 * nssGeneralName_Duplicate
2481 * This routine duplicates the specified General Name. If the optional
2482 * arena argument is non-null, the memory required will be obtained
2483 * from that arena; otherwise, the memory will be obtained from the
2484 * heap. This routine may return NULL upon error, in which case it
2485 * will have set an error on the error stack.
2487 * The error may be one of the following values:
2488 * NSS_ERROR_INVALID_GENERAL_NAME
2489 * NSS_ERROR_NO_MEMORY
2493 * A pointer to a new NSSGeneralName
2496 NSS_EXTERN NSSGeneralName
*
2497 nssGeneralName_Duplicate
2499 NSSGeneralName
*generalName
,
2504 * nssGeneralName_GetUID
2506 * This routine will attempt to derive a user identifier from the
2507 * specified general name, if the choices and content of the name
2508 * permit. If the General Name is a (directory) Name consisting
2509 * of a Sequence of Relative Distinguished Names containing a UID
2510 * attribute, the UID will be the value of that attribute. Note
2511 * that no UID attribute is defined in either PKIX or PKCS#9;
2512 * rather, this seems to derive from RFC 1274, which defines the
2513 * type as a caseIgnoreString. We'll return a Directory String.
2514 * If the optional arena argument is non-null, the memory used
2515 * will be obtained from that arena; otherwise, the memory will be
2516 * obtained from the heap. This routine may return NULL upon error,
2517 * in which case it will have set an error on the error stack.
2519 * The error may be one of the following values:
2520 * NSS_ERROR_INVALID_GENERAL_NAME
2522 * NSS_ERROR_NO_MEMORY
2526 * A pointer to a UTF8 String.
2529 NSS_EXTERN NSSUTF8
* /* XXX fgmr DirectoryString */
2530 nssGeneralName_GetUID
2532 NSSGeneralName
*generalName
,
2537 * nssGeneralName_GetEmail
2539 * This routine will attempt to derive an email address from the
2540 * specified general name, if the choices and content of the name
2541 * permit. If the General Name is a (directory) Name consisting
2542 * of a Sequence of Relative Distinguished names containing either
2543 * a PKIX email address or a PKCS#9 email address, the result will
2544 * be the value of that attribute. If the General Name is an RFC 822
2545 * Name, the result will be the string form of that name. If the
2546 * optional arena argument is non-null, the memory used will be
2547 * obtained from that arena; otherwise, the memory will be obtained
2548 * from the heap. This routine may return NULL upon error, in which
2549 * case it will have set an error on the error stack.
2551 * The error may be one of the following values:
2552 * NSS_ERROR_INVALID_GENERAL_NAME
2553 * NSS_ERROR_NO_EMAIL
2554 * NSS_ERROR_NO_MEMORY
2558 * A pointer to a UTF8 String
2561 NSS_EXTERN NSSUTF8
* /* XXX fgmr IA5String */
2562 nssGeneralName_GetEmail
2564 NSSGeneralName
*generalName
,
2569 * nssGeneralName_GetCommonName
2571 * This routine will attempt to derive a common name from the
2572 * specified general name, if the choices and content of the name
2573 * permit. If the General Name is a (directory) Name consisting
2574 * of a Sequence of Relative Distinguished names containing a PKIX
2575 * Common Name, the result will be that name. If the optional arena
2576 * argument is non-null, the memory used will be obtained from that
2577 * arena; otherwise, the memory will be obtained from the heap. This
2578 * routine may return NULL upon error, in which case it will have set
2579 * an error on the error stack.
2581 * The error may be one of the following values:
2582 * NSS_ERROR_INVALID_GENERAL_NAME
2583 * NSS_ERROR_NO_COMMON_NAME
2584 * NSS_ERROR_NO_MEMORY
2588 * A pointer to a UTF8 String
2591 NSS_EXTERN NSSUTF8
* /* XXX fgmr DirectoryString */
2592 nssGeneralName_GetCommonName
2594 NSSGeneralName
*generalName
,
2599 * nssGeneralName_GetOrganization
2601 * This routine will attempt to derive an organisation name from the
2602 * specified general name, if the choices and content of the name
2603 * permit. If the General Name is a (directory) Name consisting
2604 * of a Sequence of Relative Distinguished names containing an
2605 * Organization, the result will be the value of that attribute.
2606 * If the optional arena argument is non-null, the memory used will
2607 * be obtained from that arena; otherwise, the memory will be obtained
2608 * from the heap. This routine may return NULL upon error, in which
2609 * case it will have set an error on the error stack.
2611 * The error may be one of the following values:
2612 * NSS_ERROR_INVALID_GENERAL_NAME
2613 * NSS_ERROR_NO_ORGANIZATION
2614 * NSS_ERROR_NO_MEMORY
2618 * A pointer to a UTF8 String
2621 NSS_EXTERN NSSUTF8
* /* XXX fgmr DirectoryString */
2622 nssGeneralName_GetOrganization
2624 NSSGeneralName
*generalName
,
2629 * nssGeneralName_GetOrganizationalUnits
2631 * This routine will attempt to derive a sequence of organisational
2632 * unit names from the specified general name, if the choices and
2633 * content of the name permit. If the General Name is a (directory)
2634 * Name consisting of a Sequence of Relative Distinguished names
2635 * containing one or more organisational units, the result will
2636 * consist of those units. If the optional arena argument is non-
2637 * null, the memory used will be obtained from that arena; otherwise,
2638 * the memory will be obtained from the heap. This routine may return
2639 * NULL upon error, in which case it will have set an error on the
2642 * The error may be one of the following values:
2643 * NSS_ERROR_INVALID_GENERAL_NAME
2644 * NSS_ERROR_NO_ORGANIZATIONAL_UNITS
2645 * NSS_ERROR_NO_MEMORY
2649 * A pointer to a null-terminated array of UTF8 Strings
2652 NSS_EXTERN NSSUTF8
** /* XXX fgmr DirectoryString */
2653 nssGeneralName_GetOrganizationalUnits
2655 NSSGeneralName
*generalName
,
2660 * nssGeneralName_GetStateOrProvince
2662 * This routine will attempt to derive a state or province name from
2663 * the specified general name, if the choices and content of the name
2664 * permit. If the General Name is a (directory) Name consisting
2665 * of a Sequence of Relative Distinguished names containing a state or
2666 * province, the result will be the value of that attribute. If the
2667 * optional arena argument is non-null, the memory used will be
2668 * obtained from that arena; otherwise, the memory will be obtained
2669 * from the heap. This routine may return NULL upon error, in which
2670 * case it will have set an error on the error stack.
2672 * The error may be one of the following values:
2673 * NSS_ERROR_INVALID_GENERAL_NAME
2674 * NSS_ERROR_NO_STATE_OR_PROVINCE
2675 * NSS_ERROR_NO_MEMORY
2679 * A pointer to a UTF8 String
2682 NSS_EXTERN NSSUTF8
* /* XXX fgmr DirectoryString */
2683 nssGeneralName_GetStateOrProvince
2685 NSSGeneralName
*generalName
,
2690 * nssGeneralName_GetLocality
2692 * This routine will attempt to derive a locality name from
2693 * the specified general name, if the choices and content of the name
2694 * permit. If the General Name is a (directory) Name consisting
2695 * of a Sequence of Relative Distinguished names containing a Locality,
2696 * the result will be the value of that attribute. If the optional
2697 * arena argument is non-null, the memory used will be obtained from
2698 * that arena; otherwise, the memory will be obtained from the heap.
2699 * This routine may return NULL upon error, in which case it will have
2700 * set an error on the error stack.
2702 * The error may be one of the following values:
2703 * NSS_ERROR_INVALID_GENERAL_NAME
2704 * NSS_ERROR_NO_LOCALITY
2705 * NSS_ERROR_NO_MEMORY
2709 * A pointer to a UTF8 String
2712 NSS_EXTERN NSSUTF8
* /* XXX fgmr DirectoryString */
2713 nssGeneralName_GetLocality
2715 NSSGeneralName
*generalName
,
2720 * nssGeneralName_GetCountry
2722 * This routine will attempt to derive a country name from the
2723 * specified general name, if the choices and content of the name
2724 * permit. If the General Name is a (directory) Name consisting of a
2725 * Sequence of Relative Distinguished names containing a Country, the
2726 * result will be the value of that attribute. If the optional
2727 * arena argument is non-null, the memory used will be obtained from
2728 * that arena; otherwise, the memory will be obtained from the heap.
2729 * This routine may return NULL upon error, in which case it will have
2730 * set an error on the error stack.
2732 * The error may be one of the following values:
2733 * NSS_ERROR_INVALID_GENERAL_NAME
2734 * NSS_ERROR_NO_COUNTRY
2735 * NSS_ERROR_NO_MEMORY
2739 * A pointer to a UTF8 String
2742 NSS_EXTERN NSSUTF8
* /* XXX fgmr PrintableString */
2743 nssGeneralName_GetCountry
2745 NSSGeneralName
*generalName
,
2750 * nssGeneralName_GetAttribute
2752 * If the specified general name is a (directory) name consisting
2753 * of a Sequence of Relative Distinguished Names containing an
2754 * attribute with the specified type, and the actual value of that
2755 * attribute may be expressed with a Directory String, then the
2756 * value of that attribute will be returned as a Directory String.
2757 * If the optional arena argument is non-null, the memory used will
2758 * be obtained from that arena; otherwise, the memory will be obtained
2759 * from the heap. This routine may return NULL upon error, in which
2760 * case it will have set an error on the error stack.
2762 * The error may be one of the following values:
2763 * NSS_ERROR_INVALID_GENERAL_NAME
2764 * NSS_ERROR_NO_ATTRIBUTE
2765 * NSS_ERROR_ATTRIBUTE_VALUE_NOT_STRING
2769 * A pointer to a UTF8 String
2772 NSS_EXTERN NSSUTF8
* /* XXX fgmr DirectoryString */
2773 nssGeneralName_GetAttribute
2775 NSSGeneralName
*generalName
,
2783 * The public "methods" regarding this "object" are:
2785 * nssGeneralNameSeq_CreateFromBER -- constructor
2786 * nssGeneralNameSeq_Create -- constructor
2788 * nssGeneralNameSeq_Destroy
2789 * nssGeneralNameSeq_GetDEREncoding
2790 * nssGeneralNameSeq_AppendGeneralName
2791 * nssGeneralNameSeq_GetGeneralNameCount
2792 * nssGeneralNameSeq_GetGeneralName
2793 * nssGeneralNameSeq_Compare
2794 * nssGeneralnameSeq_Duplicate
2798 * nssGeneralNameSeq_CreateFromBER
2800 * This routine creates a general name sequence by decoding a BER-
2801 * or DER-encoded GeneralNames. If the optional arena argument is
2802 * non-null, the memory used will be obtained from that arena;
2803 * otherwise, the memory will be obtained from the heap. This routine
2804 * may return NULL upon error, in which case it will have set an error
2805 * on the error stack.
2807 * The error may be one of the following values:
2808 * NSS_ERROR_INVALID_BER
2809 * NSS_ERROR_NO_MEMORY
2813 * A pointer to an NSSGeneralNameSeq upon success
2816 NSS_EXTERN NSSGeneralNameSeq
*
2817 nssGeneralNameSeq_CreateFromBER
2820 NSSBER
*berGeneralNameSeq
2824 * nssGeneralNameSeq_Create
2826 * This routine creates an NSSGeneralNameSeq from one or more General
2827 * Names. The final argument to this routine must be NULL. If the
2828 * optional arena argument is non-null, the memory used will be
2829 * obtained from that arena; otherwise, the memory will be obtained
2830 * from the heap. This routine may return NULL upon error, in which
2831 * case it will have set an error on the error stack.
2833 * The error may be one of the following values:
2834 * NSS_ERROR_NO_MEMORY
2835 * NSS_ERROR_INVALID_GENERAL_NAME
2839 * A pointer to an NSSGeneralNameSeq upon success
2842 NSS_EXTERN NSSGeneralNameSeq
*
2843 nssGeneralNameSeq_Create
2846 NSSGeneralName
*generalName1
,
2851 * nssGeneralNameSeq_Destroy
2853 * This routine will destroy an NSSGeneralNameSeq object. It should
2854 * eventually be called on all NSSGeneralNameSeqs created without an
2855 * arena. While it is not necessary to call it on NSSGeneralNameSeq's
2856 * created within an arena, it is not an error to do so. This routine
2857 * returns a PRStatus value; if successful, it will return PR_SUCCESS.
2858 * If unsuccessful, it will set an error on the error stack and return
2861 * The error may be one of the following values:
2862 * NSS_ERROR_INVALID_GENERAL_NAME_SEQ
2865 * PR_FAILURE upon error
2866 * PR_SUCCESS upon success
2870 nssGeneralNameSeq_Destroy
2872 NSSGeneralNameSeq
*generalNameSeq
2876 * nssGeneralNameSeq_GetDEREncoding
2878 * This routine will DER-encode an NSSGeneralNameSeq object. If the
2879 * optional arena argument is non-null, the memory used will be
2880 * obtained from that arena; otherwise, the memory will be obtained
2881 * from the heap. This routine may return null upon error, in which
2882 * case it will have set an error on the error stack.
2884 * The error may be one of the following values:
2885 * NSS_ERROR_INVALID_GENERAL_NAME_SEQ
2886 * NSS_ERROR_NO_MEMORY
2890 * The DER encoding of this NSSGeneralNameSeq
2894 nssGeneralNameSeq_GetDEREncoding
2896 NSSGeneralNameSeq
*generalNameSeq
,
2901 * nssGeneralNameSeq_AppendGeneralName
2903 * This routine appends a General Name to the end of the existing
2904 * General Name Sequence. If the sequence was created with a non-null
2905 * arena argument, that same arena will be used for any additional
2906 * required memory. If the sequence was created with a NULL arena
2907 * argument, any additional memory will be obtained from the heap.
2908 * This routine returns a PRStatus value; it will return PR_SUCCESS
2909 * upon success, and upon failure it will set an error on the error
2910 * stack and return PR_FAILURE.
2912 * The error may be one of the following values:
2913 * NSS_ERROR_INVALID_GENERAL_NAME_SEQ
2914 * NSS_ERROR_INVALID_GENERAL_NAME
2915 * NSS_ERROR_NO_MEMORY
2918 * PR_SUCCESS upon success
2919 * PR_FAILURE upon failure.
2923 nssGeneralNameSeq_AppendGeneralName
2925 NSSGeneralNameSeq
*generalNameSeq
,
2926 NSSGeneralName
*generalName
2930 * nssGeneralNameSeq_GetGeneralNameCount
2932 * This routine returns the cardinality of the specified General name
2933 * Sequence. This routine may return 0 upon error, in which case it
2934 * will have set an error on the error stack.
2936 * The error may be one of the following values:
2937 * NSS_ERROR_INVALID_GENERAL_NAME_SEQ
2941 * A positive number upon success
2945 nssGeneralNameSeq_GetGeneralNameCount
2947 NSSGeneralNameSeq
*generalNameSeq
2951 * nssGeneralNameSeq_GetGeneralName
2953 * This routine returns a pointer to the i'th General Name in the
2954 * specified General Name Sequence. The value of the variable 'i' is
2955 * on the range [0,c) where c is the cardinality returned from
2956 * NSSGeneralNameSeq_GetGeneralNameCount. The caller owns the General
2957 * Name the pointer to which is returned. If the optional arena
2958 * argument is non-null, the memory used will be obtained from that
2959 * arena; otherwise, the memory will be obtained from the heap. This
2960 * routine may return NULL upon error, in which case it will have set
2961 * an error upon the error stack.
2963 * The error may be one of the following values:
2964 * NSS_ERROR_INVALID_GENERAL_NAME_SEQ
2965 * NSS_ERROR_VALUE_OUT_OF_RANGE
2966 * NSS_ERROR_NO_MEMORY
2970 * A caller-owned pointer to a General Name.
2973 NSS_EXTERN NSSGeneralName
*
2974 nssGeneralNameSeq_GetGeneralName
2976 NSSGeneralNameSeq
*generalNameSeq
,
2982 * nssGeneralNameSeq_Compare
2984 * This routine compares two General Name Sequences for equality. For
2985 * two General Name Sequences to be equal, they must have the same
2986 * cardinality, and each General Name in one sequence must be equal to
2987 * the corresponding General Name in the other. The result of the
2988 * comparison will be stored at the location pointed to by the "equalp"
2989 * variable, which must point to a valid PRBool. This routine may
2990 * return PR_FAILURE upon error, in which case it will have set an
2991 * error on the error stack.
2993 * The error may be one of the following values:
2994 * NSS_ERROR_INVALID_GENERAL_NAME_SEQ
2995 * NSS_ERROR_INVALID_ARGUMENT
2998 * PR_FAILURE upon error
2999 * PR_SUCCESS upon a successful comparison (equal or not)
3003 nssGeneralNameSeq_Compare
3005 NSSGeneralNameSeq
*generalNameSeq1
,
3006 NSSGeneralNameSeq
*generalNameSeq2
,
3011 * nssGeneralNameSeq_Duplicate
3013 * This routine duplicates the specified sequence of general names. If
3014 * the optional arena argument is non-null, the memory required will be
3015 * obtained from that arena; otherwise, the memory will be obtained
3016 * from the heap. This routine may return NULL upon error, in which
3017 * case it will have placed an error on the error stack.
3019 * The error may be one of the following values:
3020 * NSS_ERROR_INVALID_GENERAL_NAME_SEQ
3021 * NSS_ERROR_NO_MEMORY
3025 * A pointer to a new General Name Sequence.
3028 NSS_EXTERN NSSGeneralNameSeq
*
3029 nssGeneralNameSeq_Duplicate
3031 NSSGeneralNameSeq
*generalNameSeq
,