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