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.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
40 * Test BuildParams Type
45 #include "testutil_nss.h"
47 void *plContext
= NULL
;
50 testDestroy(void *goodObject
, void *equalObject
, void *diffObject
)
54 subTest("PKIX_BuildParams_Destroy");
56 PKIX_TEST_DECREF_BC(goodObject
);
57 PKIX_TEST_DECREF_BC(equalObject
);
58 PKIX_TEST_DECREF_BC(diffObject
);
66 void testGetProcParams(
67 PKIX_BuildParams
*goodObject
,
68 PKIX_BuildParams
*equalObject
){
70 PKIX_ProcessingParams
*goodProcParams
= NULL
;
71 PKIX_ProcessingParams
*equalProcParams
= NULL
;
74 subTest("PKIX_BuildParams_GetProcessingParams");
76 PKIX_TEST_EXPECT_NO_ERROR(PKIX_BuildParams_GetProcessingParams
77 (goodObject
, &goodProcParams
, NULL
));
79 PKIX_TEST_EXPECT_NO_ERROR(PKIX_BuildParams_GetProcessingParams
80 (equalObject
, &equalProcParams
, NULL
));
83 ((PKIX_PL_Object
*)goodProcParams
,
84 (PKIX_PL_Object
*)equalProcParams
,
90 PKIX_TEST_DECREF_AC(goodProcParams
);
91 PKIX_TEST_DECREF_AC(equalProcParams
);
96 void printUsage(char *pName
){
97 printf("\nUSAGE: %s <central-data-dir>\n\n", pName
);
100 int main(int argc
, char *argv
[]) {
102 PKIX_BuildParams
*goodObject
= NULL
;
103 PKIX_BuildParams
*equalObject
= NULL
;
104 PKIX_BuildParams
*diffObject
= NULL
;
105 PKIX_UInt32 actualMinorVersion
;
107 PKIX_Boolean useArenas
= PKIX_FALSE
;
109 char *dataCentralDir
= NULL
;
110 char *goodInput
= "yassir2yassir";
111 char *diffInput
= "yassir2bcn";
113 char *expectedAscii
=
115 "\tProcessing Params: \n"
116 "\t********BEGIN PROCESSING PARAMS********\n"
119 "\tTrust Anchors: \n"
120 "\t********BEGIN LIST OF TRUST ANCHORS********\n"
123 "\tTrusted CA Name: "
124 "CN=yassir,OU=bcn,OU=east,O=sun,C=us\n"
125 "\tTrusted CA PublicKey: ANSI X9.57 DSA Signature\n"
126 "\tInitial Name Constraints:(null)\n"
129 "\tTrusted CA Name: OU=bcn,OU=east,O=sun,C=us\n"
130 "\tTrusted CA PublicKey: ANSI X9.57 DSA Signature\n"
131 "\tInitial Name Constraints:(null)\n"
134 "\t********END LIST OF TRUST ANCHORS********\n"
135 "\tDate: \t\t(null)\n"
136 "\tTarget Constraints: (null)\n"
137 "\tInitial Policies: (null)\n"
138 "\tQualifiers Rejected: FALSE\n"
139 "\tCert Stores: (EMPTY)\n"
140 "\tResource Limits: (null)\n"
141 "\tCRL Checking Enabled: 0\n"
144 "\t********END PROCESSING PARAMS********\n"
147 PKIX_TEST_STD_VARS();
149 startTests("BuildParams");
151 useArenas
= PKIX_TEST_ARENAS_ARG(argv
[1]);
153 PKIX_TEST_EXPECT_NO_ERROR(PKIX_Initialize
154 (PKIX_TRUE
, /* nssInitNeeded */
167 dataCentralDir
= argv
[j
+1];
169 subTest("PKIX_BuildParams_Create");
171 goodObject
= createBuildParams
180 equalObject
= createBuildParams
189 diffObject
= createBuildParams
198 testGetProcParams(goodObject
, equalObject
);
200 PKIX_TEST_EQ_HASH_TOSTR_DUP
208 testDestroy(goodObject
, equalObject
, diffObject
);
212 PKIX_Shutdown(plContext
);
216 endTests("BuildParams");