2001-01-29 15:39:26 +08:00
|
|
|
/* $OpenBSD: key.h,v 1.9 2001/01/29 01:58:16 niklas Exp $ */
|
|
|
|
|
2000-09-16 10:29:08 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2000 Markus Friedl. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
2000-03-26 11:04:51 +08:00
|
|
|
#ifndef KEY_H
|
|
|
|
#define KEY_H
|
|
|
|
|
2001-01-22 13:34:40 +08:00
|
|
|
#include <openssl/rsa.h>
|
|
|
|
#include <openssl/dsa.h>
|
|
|
|
|
2000-03-26 11:04:51 +08:00
|
|
|
typedef struct Key Key;
|
|
|
|
enum types {
|
2000-11-13 19:57:25 +08:00
|
|
|
KEY_RSA1,
|
2000-03-26 11:04:51 +08:00
|
|
|
KEY_RSA,
|
|
|
|
KEY_DSA,
|
2000-11-13 19:57:25 +08:00
|
|
|
KEY_UNSPEC
|
2000-03-26 11:04:51 +08:00
|
|
|
};
|
|
|
|
struct Key {
|
|
|
|
int type;
|
|
|
|
RSA *rsa;
|
|
|
|
DSA *dsa;
|
|
|
|
};
|
|
|
|
|
|
|
|
Key *key_new(int type);
|
2000-11-13 19:57:25 +08:00
|
|
|
Key *key_new_private(int type);
|
2000-03-26 11:04:51 +08:00
|
|
|
void key_free(Key *k);
|
|
|
|
int key_equal(Key *a, Key *b);
|
|
|
|
char *key_fingerprint(Key *k);
|
- Remove references to SSLeay.
- Big OpenBSD CVS update
- markus@cvs.openbsd.org
[clientloop.c]
- typo
[session.c]
- update proctitle on pty alloc/dealloc, e.g. w/ windows client
[session.c]
- update proctitle for proto 1, too
[channels.h nchan.c serverloop.c session.c sshd.c]
- use c-style comments
- deraadt@cvs.openbsd.org
[scp.c]
- more atomicio
- markus@cvs.openbsd.org
[channels.c]
- set O_NONBLOCK
[ssh.1]
- update AUTHOR
[readconf.c ssh-keygen.c ssh.h]
- default DSA key file ~/.ssh/id_dsa
[clientloop.c]
- typo, rm verbose debug
- deraadt@cvs.openbsd.org
[ssh-keygen.1]
- document DSA use of ssh-keygen
[sshd.8]
- a start at describing what i understand of the DSA side
[ssh-keygen.1]
- document -X and -x
[ssh-keygen.c]
- simplify usage
- markus@cvs.openbsd.org
[sshd.8]
- there is no rhosts_dsa
[ssh-keygen.1]
- document -y, update -X,-x
[nchan.c]
- fix close for non-open ssh1 channels
[servconf.c servconf.h ssh.h sshd.8 sshd.c ]
- s/DsaKey/HostDSAKey/, document option
[sshconnect2.c]
- respect number_of_password_prompts
[channels.c channels.h servconf.c servconf.h session.c sshd.8]
- GatewayPorts for sshd, ok deraadt@
[ssh-add.1 ssh-agent.1 ssh.1]
- more doc on: DSA, id_dsa, known_hosts2, authorized_keys2
[ssh.1]
- more info on proto 2
[sshd.8]
- sync AUTHOR w/ ssh.1
[key.c key.h sshconnect.c]
- print key type when talking about host keys
[packet.c]
- clear padding in ssh2
[dsa.c key.c radix.c ssh.h sshconnect1.c uuencode.c uuencode.h]
- replace broken uuencode w/ libc b64_ntop
[auth2.c]
- log failure before sending the reply
[key.c radix.c uuencode.c]
- remote trailing comments before calling __b64_pton
[auth2.c readconf.c readconf.h servconf.c servconf.h ssh.1]
[sshconnect2.c sshd.8]
- add DSAAuthetication option to ssh/sshd, document SSH2 in sshd.8
- Bring in b64_ntop and b64_pton from OpenBSD libc (bsd-base64.[ch])
2000-05-07 10:03:14 +08:00
|
|
|
char *key_type(Key *k);
|
2000-03-26 11:04:51 +08:00
|
|
|
int key_write(Key *key, FILE *f);
|
2000-11-13 19:57:25 +08:00
|
|
|
int key_read(Key *key, char **cpp);
|
|
|
|
u_int key_size(Key *k);
|
|
|
|
|
2000-12-22 09:43:59 +08:00
|
|
|
Key *key_generate(int type, u_int bits);
|
2000-11-13 19:57:25 +08:00
|
|
|
Key *key_from_private(Key *k);
|
|
|
|
int key_type_from_name(char *name);
|
|
|
|
|
|
|
|
Key *key_from_blob(char *blob, int blen);
|
2000-12-22 09:43:59 +08:00
|
|
|
int key_to_blob(Key *key, u_char **blobp, u_int *lenp);
|
2000-11-13 19:57:25 +08:00
|
|
|
char *key_ssh_name(Key *k);
|
|
|
|
|
|
|
|
int
|
|
|
|
key_sign(
|
|
|
|
Key *key,
|
2000-12-22 09:43:59 +08:00
|
|
|
u_char **sigp, int *lenp,
|
|
|
|
u_char *data, int datalen);
|
2000-11-13 19:57:25 +08:00
|
|
|
|
|
|
|
int
|
|
|
|
key_verify(
|
|
|
|
Key *key,
|
2000-12-22 09:43:59 +08:00
|
|
|
u_char *signature, int signaturelen,
|
|
|
|
u_char *data, int datalen);
|
2000-03-26 11:04:51 +08:00
|
|
|
|
|
|
|
#endif
|