key.h revision 65668
12061Sjkh/*
227788Sasami * Copyright (c) 2000 Markus Friedl.  All rights reserved.
32061Sjkh *
42061Sjkh * Redistribution and use in source and binary forms, with or without
515603Smarkm * modification, are permitted provided that the following conditions
63197Scsgr * are met:
720710Sasami * 1. Redistributions of source code must retain the above copyright
820710Sasami *    notice, this list of conditions and the following disclaimer.
93197Scsgr * 2. Redistributions in binary form must reproduce the above copyright
102061Sjkh *    notice, this list of conditions and the following disclaimer in the
1112483Speter *    documentation and/or other materials provided with the distribution.
122160Scsgr *
132834Swollman * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
142061Sjkh * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
152061Sjkh * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
162160Scsgr * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1717308Speter * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1819320Sadam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1927788Sasami * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2027788Sasami * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2125980Sasami * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
221594Srgrimes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2317308Speter */
2417308Speter#ifndef KEY_H
2517308Speter#define KEY_H
2617308Speter
2717308Spetertypedef struct Key Key;
2817308Speterenum types {
2917308Speter	KEY_RSA,
3019175Sbde	KEY_DSA,
3119175Sbde	KEY_EMPTY
3219175Sbde};
3319175Sbdestruct Key {
3417308Speter	int	type;
3525647Sbde	RSA	*rsa;
3617308Speter	DSA	*dsa;
372061Sjkh};
382061Sjkh
391594SrgrimesKey	*key_new(int type);
4025313Sbdevoid	key_free(Key *k);
4125313Sbdeint	key_equal(Key *a, Key *b);
4225313Sbdechar	*key_fingerprint(Key *k);
4325313Sbdechar	*key_type(Key *k);
4425313Sbdeint	key_write(Key *key, FILE *f);
4525313Sbdeunsigned int	key_read(Key *key, char **cpp);
4625313Sbdeunsigned int	key_size(Key *k);
4725313Sbde
487407Srgrimes#endif
497108Sphk