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 PKIX-C library.
16 * The Initial Developer of the Original Code is
17 * Sun Microsystems, Inc.
18 * Portions created by the Initial Developer are
19 * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
22 * Sun Microsystems, Inc.
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 ***** */
38 * This file defines functions associated with the results used
39 * by the top-level functions.
43 #ifndef _PKIX_RESULTS_H
44 #define _PKIX_RESULTS_H
54 * Please refer to the libpkix Programmer's Guide for detailed information
55 * about how to use the libpkix library. Certain key warnings and notices from
56 * that document are repeated here for emphasis.
58 * All identifiers in this file (and all public identifiers defined in
59 * libpkix) begin with "PKIX_". Private identifiers only intended for use
60 * within the library begin with "pkix_".
62 * A function returns NULL upon success, and a PKIX_Error pointer upon failure.
64 * Unless otherwise noted, for all accessor (gettor) functions that return a
65 * PKIX_PL_Object pointer, callers should assume that this pointer refers to a
66 * shared object. Therefore, the caller should treat this shared object as
67 * read-only and should not modify this shared object. When done using the
68 * shared object, the caller should release the reference to the object by
69 * using the PKIX_PL_Object_DecRef function.
71 * While a function is executing, if its arguments (or anything referred to by
72 * its arguments) are modified, free'd, or destroyed, the function's behavior
76 /* PKIX_ValidateResult
78 * PKIX_ValidateResult represents the result of a PKIX_ValidateChain call. It
79 * consists of the valid policy tree and public key resulting from validation,
80 * as well as the trust anchor used for this chain. Once created, a
81 * ValidateResult object is immutable.
85 * FUNCTION: PKIX_ValidateResult_GetPolicyTree
88 * Retrieves the PolicyNode component (representing the valid_policy_tree)
89 * from the ValidateResult object pointed to by "result" and stores it at
94 * Address of ValidateResult whose policy tree is to be stored. Must be
97 * Address where object pointer will be stored. Must be non-NULL.
99 * Platform-specific context pointer.
101 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
103 * Returns NULL if the function succeeds.
104 * Returns a Result Error if the function fails in a non-fatal way.
105 * Returns a Fatal Error if the function fails in an unrecoverable way.
108 PKIX_ValidateResult_GetPolicyTree(
109 PKIX_ValidateResult
*result
,
110 PKIX_PolicyNode
**pPolicyTree
,
114 * FUNCTION: PKIX_ValidateResult_GetPublicKey
117 * Retrieves the PublicKey component (representing the valid public_key) of
118 * the ValidateResult object pointed to by "result" and stores it at
123 * Address of ValidateResult whose public key is to be stored.
126 * Address where object pointer will be stored. Must be non-NULL.
128 * Platform-specific context pointer.
130 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
132 * Returns NULL if the function succeeds.
133 * Returns a Result Error if the function fails in a non-fatal way.
134 * Returns a Fatal Error if the function fails in an unrecoverable way.
137 PKIX_ValidateResult_GetPublicKey(
138 PKIX_ValidateResult
*result
,
139 PKIX_PL_PublicKey
**pPublicKey
,
143 * FUNCTION: PKIX_ValidateResult_GetTrustAnchor
146 * Retrieves the TrustAnchor component (representing the trust anchor used
147 * during chain validation) of the ValidateResult object pointed to by
148 * "result" and stores it at "pTrustAnchor".
152 * Address of ValidateResult whose trust anchor is to be stored.
155 * Address where object pointer will be stored. Must be non-NULL.
157 * Platform-specific context pointer.
159 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
161 * Returns NULL if the function succeeds.
162 * Returns a Result Error if the function fails in a non-fatal way.
163 * Returns a Fatal Error if the function fails in an unrecoverable way.
166 PKIX_ValidateResult_GetTrustAnchor(
167 PKIX_ValidateResult
*result
,
168 PKIX_TrustAnchor
**pTrustAnchor
,
173 * PKIX_BuildResult represents the result of a PKIX_BuildChain call. It
174 * consists of a ValidateResult object, as well as the built and validated
175 * CertChain. Once created, a BuildResult object is immutable.
179 * FUNCTION: PKIX_BuildResult_GetValidateResult
182 * Retrieves the ValidateResult component (representing the build's validate
183 * result) of the BuildResult object pointed to by "result" and stores it at
188 * Address of BuildResult whose ValidateResult component is to be stored.
191 * Address where object pointer will be stored. Must be non-NULL.
193 * Platform-specific context pointer.
195 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
197 * Returns NULL if the function succeeds.
198 * Returns a Result Error if the function fails in a non-fatal way.
199 * Returns a Fatal Error if the function fails in an unrecoverable way.
202 PKIX_BuildResult_GetValidateResult(
203 PKIX_BuildResult
*result
,
204 PKIX_ValidateResult
**pResult
,
208 * FUNCTION: PKIX_BuildResult_GetCertChain
211 * Retrieves the List of Certs (certChain) component (representing the built
212 * and validated CertChain) of the BuildResult object pointed to by "result"
213 * and stores it at "pChain".
217 * Address of BuildResult whose CertChain component is to be stored.
220 * Address where object pointer will be stored. Must be non-NULL.
222 * Platform-specific context pointer.
224 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
226 * Returns NULL if the function succeeds.
227 * Returns a Result Error if the function fails in a non-fatal way.
228 * Returns a Fatal Error if the function fails in an unrecoverable way.
231 PKIX_BuildResult_GetCertChain(
232 PKIX_BuildResult
*result
,
238 * PKIX_PolicyNode represents a node in the policy tree returned in
239 * ValidateResult. The policy tree is the same length as the validated
240 * certificate chain and the nodes are associated with a particular depth
241 * (corresponding to a particular certificate in the chain).
242 * PKIX_ValidateResult_GetPolicyTree returns the root node of the valid policy
243 * tree. Other nodes can be accessed using the getChildren and getParents
244 * functions, and individual elements of a node can be accessed with the
245 * appropriate gettors. Once created, a PolicyNode is immutable.
249 * FUNCTION: PKIX_PolicyNode_GetChildren
252 * Retrieves the List of PolicyNodes representing the child nodes of the
253 * Policy Node pointed to by "node" and stores it at "pChildren". If "node"
254 * has no child nodes, this function stores an empty List at "pChildren".
256 * Note that the List returned by this function is immutable.
260 * Address of PolicyNode whose child nodes are to be stored.
263 * Address where object pointer will be stored. Must be non-NULL.
265 * Platform-specific context pointer.
267 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
269 * Returns NULL if the function succeeds.
270 * Returns a Result Error if the function fails in a non-fatal way.
271 * Returns a Fatal Error if the function fails in an unrecoverable way.
274 PKIX_PolicyNode_GetChildren(
275 PKIX_PolicyNode
*node
,
276 PKIX_List
**pChildren
, /* list of PKIX_PolicyNode */
280 * FUNCTION: PKIX_PolicyNode_GetParent
283 * Retrieves the PolicyNode representing the parent node of the PolicyNode
284 * pointed to by "node" and stores it at "pParent". If "node" has no parent
285 * node, this function stores NULL at "pParent".
289 * Address of PolicyNode whose parent node is to be stored.
292 * Address where object pointer will be stored. Must be non-NULL.
294 * Platform-specific context pointer.
296 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
298 * Returns NULL if the function succeeds.
299 * Returns a Result Error if the function fails in a non-fatal way.
300 * Returns a Fatal Error if the function fails in an unrecoverable way.
303 PKIX_PolicyNode_GetParent(
304 PKIX_PolicyNode
*node
,
305 PKIX_PolicyNode
**pParent
,
309 * FUNCTION: PKIX_PolicyNode_GetValidPolicy
312 * Retrieves the OID representing the valid policy of the PolicyNode pointed
313 * to by "node" and stores it at "pValidPolicy".
317 * Address of PolicyNode whose valid policy is to be stored.
320 * Address where object pointer will be stored. Must be non-NULL.
322 * Platform-specific context pointer.
324 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
326 * Returns NULL if the function succeeds.
327 * Returns a Result Error if the function fails in a non-fatal way.
328 * Returns a Fatal Error if the function fails in an unrecoverable way.
331 PKIX_PolicyNode_GetValidPolicy(
332 PKIX_PolicyNode
*node
,
333 PKIX_PL_OID
**pValidPolicy
,
337 * FUNCTION: PKIX_PolicyNode_GetPolicyQualifiers
340 * Retrieves the List of CertPolicyQualifiers representing the policy
341 * qualifiers associated with the PolicyNode pointed to by "node" and stores
342 * it at "pQualifiers". If "node" has no policy qualifiers, this function
343 * stores an empty List at "pQualifiers".
345 * Note that the List returned by this function is immutable.
349 * Address of PolicyNode whose policy qualifiers are to be stored.
352 * Address where object pointer will be stored. Must be non-NULL.
354 * Platform-specific context pointer.
356 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
358 * Returns NULL if the function succeeds.
359 * Returns a Result Error if the function fails in a non-fatal way.
360 * Returns a Fatal Error if the function fails in an unrecoverable way.
363 PKIX_PolicyNode_GetPolicyQualifiers(
364 PKIX_PolicyNode
*node
,
365 PKIX_List
**pQualifiers
, /* list of PKIX_PL_CertPolicyQualifier */
369 * FUNCTION: PKIX_PolicyNode_GetExpectedPolicies
372 * Retrieves the List of OIDs representing the expected policies associated
373 * with the PolicyNode pointed to by "node" and stores it at "pExpPolicies".
375 * Note that the List returned by this function is immutable.
379 * Address of PolicyNode whose expected policies are to be stored.
382 * Address where object pointer will be stored. Must be non-NULL.
384 * Platform-specific context pointer.
386 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
388 * Returns NULL if the function succeeds.
389 * Returns a Result Error if the function fails in a non-fatal way.
390 * Returns a Fatal Error if the function fails in an unrecoverable way.
393 PKIX_PolicyNode_GetExpectedPolicies(
394 PKIX_PolicyNode
*node
,
395 PKIX_List
**pExpPolicies
, /* list of PKIX_PL_OID */
399 * FUNCTION: PKIX_PolicyNode_IsCritical
402 * Checks the criticality field of the PolicyNode pointed to by "node" and
403 * stores the Boolean result at "pCritical".
407 * Address of PolicyNode whose criticality field is examined.
410 * Address where Boolean will be stored. Must be non-NULL.
412 * Platform-specific context pointer.
414 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
416 * Returns NULL if the function succeeds.
417 * Returns a Result Error if the function fails in a non-fatal way.
418 * Returns a Fatal Error if the function fails in an unrecoverable way.
421 PKIX_PolicyNode_IsCritical(
422 PKIX_PolicyNode
*node
,
423 PKIX_Boolean
*pCritical
,
427 * FUNCTION: PKIX_PolicyNode_GetDepth
430 * Retrieves the depth component of the PolicyNode pointed to by "node" and
431 * stores it at "pDepth".
435 * Address of PolicyNode whose depth component is to be stored.
438 * Address where PKIX_UInt32 will be stored. Must be non-NULL.
440 * Platform-specific context pointer.
442 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
444 * Returns NULL if the function succeeds.
445 * Returns a Result Error if the function fails in a non-fatal way.
446 * Returns a Fatal Error if the function fails in an unrecoverable way.
449 PKIX_PolicyNode_GetDepth(
450 PKIX_PolicyNode
*node
,
458 #endif /* _PKIX_RESULTS_H */