authfile.h revision 69587
165668Skris/*
265668Skris * Author: Tatu Ylonen <ylo@cs.hut.fi>
365668Skris * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
465668Skris *                    All rights reserved
565668Skris * Functions to interface with the SSH_AUTHENTICATION_FD socket.
665668Skris *
765668Skris * As far as I am concerned, the code I have written for this software
865668Skris * can be used freely for any purpose.  Any derived versions of this
965668Skris * software must be clearly marked as such, and if the derived work is
1065668Skris * incompatible with the protocol description in the RFC file, it must be
1165668Skris * called by a name other than "ssh" or "Secure Shell".
1265668Skris */
1369587Sgreen
1469587Sgreen/* $OpenBSD: authfile.h,v 1.5 2000/10/16 09:38:44 djm Exp $ */
1569587Sgreen
1660573Skris#ifndef AUTHFILE_H
1760573Skris#define AUTHFILE_H
1860573Skris
1969587Sgreen
2060573Skris/*
2160573Skris * Saves the authentication (private) key in a file, encrypting it with
2260573Skris * passphrase.
2360573Skris * For RSA keys: The identification of the file (lowest 64 bits of n)
2460573Skris * will precede the key to provide identification of the key without
2560573Skris * needing a passphrase.
2660573Skris */
2760573Skrisint
2860573Skrissave_private_key(const char *filename, const char *passphrase,
2960573Skris    Key * private_key, const char *comment);
3060573Skris
3160573Skris/*
3260573Skris * Loads the public part of the key file (public key and comment). Returns 0
3360573Skris * if an error occurred; zero if the public key was successfully read.  The
3460573Skris * comment of the key is returned in comment_return if it is non-NULL; the
3560573Skris * caller must free the value with xfree.
3660573Skris */
3765668Skrisint load_public_key(const char *filename, Key * pub, char **comment_return);
3865668Skrisint try_load_public_key(const char *filename, Key * pub, char **comment_return);
3960573Skris
4060573Skris/*
4160573Skris * Loads the private key from the file.  Returns 0 if an error is encountered
4260573Skris * (file does not exist or is not readable, or passphrase is bad). This
4360573Skris * initializes the private key.  The comment of the key is returned in
4460573Skris * comment_return if it is non-NULL; the caller must free the value with
4560573Skris * xfree.
4660573Skris */
4760573Skrisint
4860573Skrisload_private_key(const char *filename, const char *passphrase,
4960573Skris    Key * private_key, char **comment_return);
5060573Skris
5160573Skris#endif
52