2001-04-17 18:11:36 +00:00
|
|
|
/* $OpenBSD: key.h,v 1.12 2001/04/17 10:53:24 markus Exp $ */
|
2001-01-29 07:39:26 +00:00
|
|
|
|
2000-09-16 02:29:08 +00: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 03:04:51 +00:00
|
|
|
#ifndef KEY_H
|
|
|
|
#define KEY_H
|
|
|
|
|
2001-01-22 05:34:40 +00:00
|
|
|
#include <openssl/rsa.h>
|
|
|
|
#include <openssl/dsa.h>
|
|
|
|
|
2000-03-26 03:04:51 +00:00
|
|
|
typedef struct Key Key;
|
|
|
|
enum types {
|
2000-11-13 11:57:25 +00:00
|
|
|
KEY_RSA1,
|
2000-03-26 03:04:51 +00:00
|
|
|
KEY_RSA,
|
|
|
|
KEY_DSA,
|
2000-11-13 11:57:25 +00:00
|
|
|
KEY_UNSPEC
|
2000-03-26 03:04:51 +00:00
|
|
|
};
|
2001-03-11 20:03:44 +00:00
|
|
|
enum fp_type {
|
|
|
|
SSH_FP_SHA1,
|
|
|
|
SSH_FP_MD5
|
|
|
|
};
|
|
|
|
enum fp_rep {
|
|
|
|
SSH_FP_HEX,
|
|
|
|
SSH_FP_BUBBLEBABBLE
|
|
|
|
};
|
2000-03-26 03:04:51 +00:00
|
|
|
struct Key {
|
|
|
|
int type;
|
|
|
|
RSA *rsa;
|
|
|
|
DSA *dsa;
|
|
|
|
};
|
|
|
|
|
|
|
|
Key *key_new(int type);
|
2000-11-13 11:57:25 +00:00
|
|
|
Key *key_new_private(int type);
|
2000-03-26 03:04:51 +00:00
|
|
|
void key_free(Key *k);
|
|
|
|
int key_equal(Key *a, Key *b);
|
2001-03-13 04:57:58 +00:00
|
|
|
char *key_fingerprint(Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep);
|
- 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 02:03:14 +00:00
|
|
|
char *key_type(Key *k);
|
2000-03-26 03:04:51 +00:00
|
|
|
int key_write(Key *key, FILE *f);
|
2000-11-13 11:57:25 +00:00
|
|
|
int key_read(Key *key, char **cpp);
|
|
|
|
u_int key_size(Key *k);
|
|
|
|
|
2000-12-22 01:43:59 +00:00
|
|
|
Key *key_generate(int type, u_int bits);
|
2000-11-13 11:57:25 +00: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 01:43:59 +00:00
|
|
|
int key_to_blob(Key *key, u_char **blobp, u_int *lenp);
|
2000-11-13 11:57:25 +00:00
|
|
|
char *key_ssh_name(Key *k);
|
2001-04-17 18:11:36 +00:00
|
|
|
int key_names_valid2(const char *names);
|
2000-11-13 11:57:25 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
key_sign(
|
|
|
|
Key *key,
|
2000-12-22 01:43:59 +00:00
|
|
|
u_char **sigp, int *lenp,
|
|
|
|
u_char *data, int datalen);
|
2000-11-13 11:57:25 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
key_verify(
|
|
|
|
Key *key,
|
2000-12-22 01:43:59 +00:00
|
|
|
u_char *signature, int signaturelen,
|
|
|
|
u_char *data, int datalen);
|
2000-03-26 03:04:51 +00:00
|
|
|
|
|
|
|
#endif
|