'\"macro stdmacro
.if n .pH g3n.publickey @(#)publickey	40.3 of 10/10/89
.\" Copyright 1989 AT&T
.\" ident	"@(#)svid_rs:rs_lib/publickey	1.3"
.\" @(#)publickey 1.3 89/06/27 SMI;
'\" macro stdmacro
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
.nr X
.if \nX=0 .ds x} publickey 3N "" "\&"
.if \nX=1 .ds x} publickey 3N ""
.if \nX=2 .ds x} publickey 3N "" "\&"
.if \nX=3 .ds x} publickey "" "" "\&"
.TH \*(x}
.SH NAME
\f4publickey\fP: \f4getpublickey\f1, \f4getsecretkey\f1 \- retrieve public or secret key
.SH SYNOPSIS
.nf
.ft 4
#include <rpc/rpc.h>
#include <rpc/key_prot.h>
.ft 1
.P
.ft 4
getpublickey(const char netname[MAXNETNAMELEN],
	char publickey[HEXKEYBYTES]);
.ft 1
.P
.ft 4
getsecretkey(const char netname[MAXNETNAMELEN],
	char secretkey[HEXKEYBYTES], const char *passwd);
.ft 1
.fi
.SH DESCRIPTION
\f4getpublickey\f1 and \f4getsecretkey\f1 get
public and secret keys for \f2netname\f1 from the
\f4publickey\fP(4) database.
.P
\f4getsecretkey\f1
has an extra argument,
\f2passwd\f1,
used to decrypt the encrypted secret key stored in the database.
.P
Both routines return \f41\f1 if they are successful
in finding the key, \f40\f1 otherwise.
The keys are returned as
NULL-terminated,
hexadecimal strings.
If the password supplied to
\f4getsecretkey\f1
fails to decrypt the secret key,
the routine will return \f41\fP but the
\f2secretkey\f1
argument will be a
NULL
string.
.SH "SEE ALSO"
.na
\f4publickey\fP(4).
.ad
