1 /*
2  * key.h
3  *
4  * Copyright (c) 2001 Dug Song <dugsong@arbor.net>
5  * Copyright (c) 2001 Arbor Networks, Inc.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *   1. Redistributions of source code must retain the above copyright
12  *      notice, this list of conditions and the following disclaimer.
13  *   2. Redistributions in binary form must reproduce the above copyright
14  *      notice, this list of conditions and the following disclaimer in the
15  *      documentation and/or other materials provided with the distribution.
16  *   3. The names of the copyright holders may not be used to endorse or
17  *      promote products derived from this software without specific
18  *      prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21  *   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22  *   AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23  *   THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24  *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  *   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26  *   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28  *   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29  *   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  *
31  * $Vendor: key.h,v 1.2 2005/04/01 16:47:31 dugsong Exp $
32  */
33 
34 #ifndef KEY_H
35 #define KEY_H
36 
37 enum key_type {
38 	KEY_UNSPEC,
39 	KEY_RSA,
40 	KEY_DSA
41 };
42 
43 struct key {
44 	int	 type;
45 	void	*data;
46 };
47 
48 struct key	*key_new(void);
49 int		 key_load_public(struct key *k, char *filename);
50 int		 key_load_private(struct key *k, char *filename);
51 int		 key_sign(struct key *k, u_char *msg, int mlen,
52 	             u_char *sig, int slen);
53 int		 key_verify(struct key *k, u_char *msg, int mlen,
54 	             u_char *sig, int slen);
55 void		 key_free(struct key *k);
56 
57 #endif /* KEY_H */
58