xref: /minix3/crypto/external/bsd/netpgp/dist/bindings/perl/netpgp.h (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel Sambuc /*-
2*ebfedea0SLionel Sambuc  * Copyright (c) 2009 The NetBSD Foundation, Inc.
3*ebfedea0SLionel Sambuc  * All rights reserved.
4*ebfedea0SLionel Sambuc  *
5*ebfedea0SLionel Sambuc  * This code is derived from software contributed to The NetBSD Foundation
6*ebfedea0SLionel Sambuc  * by Alistair Crooks (agc@netbsd.org)
7*ebfedea0SLionel Sambuc  *
8*ebfedea0SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
9*ebfedea0SLionel Sambuc  * modification, are permitted provided that the following conditions
10*ebfedea0SLionel Sambuc  * are met:
11*ebfedea0SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
12*ebfedea0SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
13*ebfedea0SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
14*ebfedea0SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
15*ebfedea0SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
16*ebfedea0SLionel Sambuc  *
17*ebfedea0SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18*ebfedea0SLionel Sambuc  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19*ebfedea0SLionel Sambuc  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20*ebfedea0SLionel Sambuc  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21*ebfedea0SLionel Sambuc  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22*ebfedea0SLionel Sambuc  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23*ebfedea0SLionel Sambuc  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24*ebfedea0SLionel Sambuc  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25*ebfedea0SLionel Sambuc  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26*ebfedea0SLionel Sambuc  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27*ebfedea0SLionel Sambuc  * POSSIBILITY OF SUCH DAMAGE.
28*ebfedea0SLionel Sambuc  */
29*ebfedea0SLionel Sambuc #ifndef NETPGP_H_
30*ebfedea0SLionel Sambuc #define NETPGP_H_
31*ebfedea0SLionel Sambuc 
32*ebfedea0SLionel Sambuc #ifndef __BEGIN_DECLS
33*ebfedea0SLionel Sambuc #  if defined(__cplusplus)
34*ebfedea0SLionel Sambuc #  define __BEGIN_DECLS           extern "C" {
35*ebfedea0SLionel Sambuc #  define __END_DECLS             }
36*ebfedea0SLionel Sambuc #  else
37*ebfedea0SLionel Sambuc #  define __BEGIN_DECLS
38*ebfedea0SLionel Sambuc #  define __END_DECLS
39*ebfedea0SLionel Sambuc #  endif
40*ebfedea0SLionel Sambuc #endif
41*ebfedea0SLionel Sambuc 
42*ebfedea0SLionel Sambuc __BEGIN_DECLS
43*ebfedea0SLionel Sambuc 
44*ebfedea0SLionel Sambuc /* structure used to hold (key,value) pair information */
45*ebfedea0SLionel Sambuc typedef struct netpgp_t {
46*ebfedea0SLionel Sambuc 	unsigned	  c;		/* # of elements used */
47*ebfedea0SLionel Sambuc 	unsigned	  size;		/* size of array */
48*ebfedea0SLionel Sambuc 	char		**name;		/* key names */
49*ebfedea0SLionel Sambuc 	char		**value;	/* value information */
50*ebfedea0SLionel Sambuc 	void		 *pubring;	/* public key ring */
51*ebfedea0SLionel Sambuc 	void		 *secring;	/* s3kr1t key ring */
52*ebfedea0SLionel Sambuc 	void		 *io;		/* the io struct for results/errs */
53*ebfedea0SLionel Sambuc 	void		 *passfp;	/* file pointer for password input */
54*ebfedea0SLionel Sambuc } netpgp_t;
55*ebfedea0SLionel Sambuc 
56*ebfedea0SLionel Sambuc /* begin and end */
57*ebfedea0SLionel Sambuc int netpgp_init(netpgp_t *);
58*ebfedea0SLionel Sambuc int netpgp_end(netpgp_t *);
59*ebfedea0SLionel Sambuc 
60*ebfedea0SLionel Sambuc /* debugging, reflection and information */
61*ebfedea0SLionel Sambuc int netpgp_set_debug(const char *);
62*ebfedea0SLionel Sambuc int netpgp_get_debug(const char *);
63*ebfedea0SLionel Sambuc const char *netpgp_get_info(const char *);
64*ebfedea0SLionel Sambuc int netpgp_list_packets(netpgp_t *, char *, int, char *);
65*ebfedea0SLionel Sambuc 
66*ebfedea0SLionel Sambuc /* variables */
67*ebfedea0SLionel Sambuc int netpgp_setvar(netpgp_t *, const char *, const char *);
68*ebfedea0SLionel Sambuc char *netpgp_getvar(netpgp_t *, const char *);
69*ebfedea0SLionel Sambuc int netpgp_incvar(netpgp_t *, const char *, const int);
70*ebfedea0SLionel Sambuc int netpgp_unsetvar(netpgp_t *, const char *);
71*ebfedea0SLionel Sambuc 
72*ebfedea0SLionel Sambuc /* set home directory information */
73*ebfedea0SLionel Sambuc int netpgp_set_homedir(netpgp_t *, char *, const char *, const int);
74*ebfedea0SLionel Sambuc 
75*ebfedea0SLionel Sambuc /* key management */
76*ebfedea0SLionel Sambuc int netpgp_list_keys(netpgp_t *, const int);
77*ebfedea0SLionel Sambuc int netpgp_find_key(netpgp_t *, char *);
78*ebfedea0SLionel Sambuc char *netpgp_get_key(netpgp_t *, const char *, const char *);
79*ebfedea0SLionel Sambuc char *netpgp_export_key(netpgp_t *, char *);
80*ebfedea0SLionel Sambuc int netpgp_import_key(netpgp_t *, char *);
81*ebfedea0SLionel Sambuc int netpgp_generate_key(netpgp_t *, char *, int);
82*ebfedea0SLionel Sambuc 
83*ebfedea0SLionel Sambuc /* file management */
84*ebfedea0SLionel Sambuc int netpgp_encrypt_file(netpgp_t *, const char *, const char *, char *, int);
85*ebfedea0SLionel Sambuc int netpgp_decrypt_file(netpgp_t *, const char *, char *, int);
86*ebfedea0SLionel Sambuc int netpgp_sign_file(netpgp_t *, const char *, const char *, char *, int, int, int);
87*ebfedea0SLionel Sambuc int netpgp_verify_file(netpgp_t *, const char *, const char *, int);
88*ebfedea0SLionel Sambuc 
89*ebfedea0SLionel Sambuc /* memory signing and encryption */
90*ebfedea0SLionel Sambuc int netpgp_sign_memory(netpgp_t *, const char *, char *, size_t, char *, size_t, const unsigned, const unsigned);
91*ebfedea0SLionel Sambuc int netpgp_verify_memory(netpgp_t *, const void *, const size_t, void *, size_t, const int);
92*ebfedea0SLionel Sambuc int netpgp_encrypt_memory(netpgp_t *, const char *, void *, const size_t, char *, size_t, int);
93*ebfedea0SLionel Sambuc int netpgp_decrypt_memory(netpgp_t *, const void *, const size_t, char *, size_t, const int);
94*ebfedea0SLionel Sambuc 
95*ebfedea0SLionel Sambuc /* match and hkp-related functions */
96*ebfedea0SLionel Sambuc int netpgp_match_keys(netpgp_t *, char *, const char *, void *, const int);
97*ebfedea0SLionel Sambuc int netpgp_match_pubkeys(netpgp_t *, char *, void *);
98*ebfedea0SLionel Sambuc 
99*ebfedea0SLionel Sambuc int netpgp_validate_sigs(netpgp_t *);
100*ebfedea0SLionel Sambuc 
101*ebfedea0SLionel Sambuc __END_DECLS
102*ebfedea0SLionel Sambuc 
103*ebfedea0SLionel Sambuc #endif /* !NETPGP_H_ */
104