xref: /titanic_41/usr/src/common/net/wanboot/p12access.h (revision 450396635f70344c58b6b1e4db38cf17ff34445c)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2002, 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_P12ACCESS_H
28 #define	_P12ACCESS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <p12aux.h>
37 #include <openssl/ssl.h>
38 
39 /*
40  * sunw_p12_use_certfile - read a client certificate from a pkcs12 file and
41  *              pass it in to SSL.
42  *
43  * Read in the certificate in pkcs12-formated file.  If there is a pass phrase
44  * use that to decrypt; if no pass phrase was given and there is a callback
45  * routine, call it.  Pass the cert to SSL.
46  *
47  * Arguments:
48  *   ctx        - SSL's context structure
49  *   filename	- Name of file with the client certificate.
50  *   passwd     - Pass phrase for pkcs12 data.
51  *
52  * Returns:
53  *   -1 	- Error occurred.  Check the error stack for specifics.
54  *   0          - Success.  Cert was successfully added.
55  */
56 int sunw_p12_use_certfile(SSL_CTX *, char *, char *);
57 
58 /*
59  * sunw_p12_use_keyfile - read a RSA private key from a pkcs12 file and pass
60  *              it in to SSL.
61  *
62  * Read in the RSA private key in pkcs12 format.  If there is a pass phrase
63  * use it to decrypt; if no pass phrase was given and there is a callback
64  * given, call it.  Pass the key to SSL.
65  *
66  * Arguments:
67  *   ctx        - SSL's context structure
68  *   filename	- Name of file with private key.
69  *   passwd     - Pass phrase for pkcs12 data.
70  *
71  * Returns:
72  *   -1 	- Error occurred.  Check the error stack for specifics.
73  *   0          - Success.
74  */
75 int sunw_p12_use_keyfile(SSL_CTX *, char *, char *);
76 
77 /*
78  * sunw_p12_use_trustfile - read a list of trustanchors from a pkcs12 file and
79  *              pass the stack in to SSL.
80  *
81  * Read in the trust anchors from pkcs12-formated file.  If there is a pass
82  * phrase use that to decrypt; if no pass phrase was given and there is a
83  * callback routine, call it.  Pass the stack of certs to SSL.
84  *
85  * Arguments:
86  *   ctx        - SSL's context structure
87  *   filename	- Name of file with the certificates.
88  *   passwd     - Pass phrase for pkcs12 data.
89  *
90  * Returns:
91  *   -1 	- Error occurred.  Check the error stack for specifics.
92  *   0          - Success.  Trust anchors were successfully added.
93  */
94 int sunw_p12_use_trustfile(SSL_CTX *, char *, char *);
95 
96 
97 #ifdef	__cplusplus
98 }
99 #endif
100 
101 #endif	/* _P12ACCESS_H */
102