Damien Miller | e4340be | 2000-09-16 13:29:08 +1100 | [diff] [blame] | 1 | /* |
| 2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
| 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
| 4 | * All rights reserved |
| 5 | * Functions to interface with the SSH_AUTHENTICATION_FD socket. |
| 6 | * |
| 7 | * As far as I am concerned, the code I have written for this software |
| 8 | * can be used freely for any purpose. Any derived versions of this |
| 9 | * software must be clearly marked as such, and if the derived work is |
| 10 | * incompatible with the protocol description in the RFC file, it must be |
| 11 | * called by a name other than "ssh" or "Secure Shell". |
| 12 | */ |
Damien Miller | 389edc4 | 2000-11-06 12:39:34 +1100 | [diff] [blame] | 13 | |
| 14 | /* $OpenBSD: authfile.h,v 1.5 2000/10/16 09:38:44 djm Exp $ */ |
| 15 | |
Damien Miller | eba71ba | 2000-04-29 23:57:08 +1000 | [diff] [blame] | 16 | #ifndef AUTHFILE_H |
| 17 | #define AUTHFILE_H |
| 18 | |
Damien Miller | 389edc4 | 2000-11-06 12:39:34 +1100 | [diff] [blame] | 19 | |
Damien Miller | eba71ba | 2000-04-29 23:57:08 +1000 | [diff] [blame] | 20 | /* |
| 21 | * Saves the authentication (private) key in a file, encrypting it with |
| 22 | * passphrase. |
| 23 | * For RSA keys: The identification of the file (lowest 64 bits of n) |
| 24 | * will precede the key to provide identification of the key without |
| 25 | * needing a passphrase. |
| 26 | */ |
| 27 | int |
| 28 | save_private_key(const char *filename, const char *passphrase, |
| 29 | Key * private_key, const char *comment); |
| 30 | |
| 31 | /* |
| 32 | * Loads the public part of the key file (public key and comment). Returns 0 |
| 33 | * if an error occurred; zero if the public key was successfully read. The |
| 34 | * comment of the key is returned in comment_return if it is non-NULL; the |
| 35 | * caller must free the value with xfree. |
| 36 | */ |
Damien Miller | e4340be | 2000-09-16 13:29:08 +1100 | [diff] [blame] | 37 | int load_public_key(const char *filename, Key * pub, char **comment_return); |
| 38 | int try_load_public_key(const char *filename, Key * pub, char **comment_return); |
Damien Miller | eba71ba | 2000-04-29 23:57:08 +1000 | [diff] [blame] | 39 | |
| 40 | /* |
| 41 | * Loads the private key from the file. Returns 0 if an error is encountered |
| 42 | * (file does not exist or is not readable, or passphrase is bad). This |
| 43 | * initializes the private key. The comment of the key is returned in |
| 44 | * comment_return if it is non-NULL; the caller must free the value with |
| 45 | * xfree. |
| 46 | */ |
| 47 | int |
| 48 | load_private_key(const char *filename, const char *passphrase, |
| 49 | Key * private_key, char **comment_return); |
| 50 | |
| 51 | #endif |