'\" te .\" Copyright 1989 AT&T .\" Copyright (C) 2005, Sun Microsystems, Inc. All Rights Reserved .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH GETPUBLICKEY 3NSL "Feb 25, 2017" .SH NAME getpublickey, getsecretkey, publickey \- retrieve public or secret key .SH SYNOPSIS .LP .nf #include #include \fBint\fR \fBgetpublickey\fR(\fBconst char\fR \fInetname[MAXNETNAMELEN]\fR, \fBchar\fR \fIpublickey[HEXKEYBYTES+1]\fR); .fi .LP .nf \fBint\fR \fBgetsecretkey\fR(\fBconst char\fR \fInetname[MAXNETNAMELEN]\fR, \fBchar\fR \fIsecretkey[HEXKEYBYTES+1]\fR,\fBconst char *\fR\fIpasswd\fR); .fi .SH DESCRIPTION .LP The \fBgetpublickey()\fR and \fBgetsecretkey()\fR functions get public and secret keys for \fInetname\fR. The key may come from one of the following sources: .RS +4 .TP .ie t \(bu .el o \fB/etc/publickey\fR file. See \fBpublickey\fR(4). .RE .RS +4 .TP .ie t \(bu .el o \fBNIS\fR map ``publickey.byname''. The sources and their lookup order are specified in the \fB/etc/nsswitch.conf\fR file. See \fBnsswitch.conf\fR(4). .RE .sp .LP \fBgetsecretkey()\fR has an extra argument, \fBpasswd\fR, which is used to decrypt the encrypted secret key stored in the database. .SH RETURN VALUES .LP Both routines return \fB1\fR if they are successful in finding the key. Otherwise, the routines return \fB0\fR. The keys are returned as null-terminated, hexadecimal strings. If the password supplied to \fBgetsecretkey()\fR fails to decrypt the secret key, the routine will return 1 but the \fIsecretkey\fR [0] will be set to \fINULL\fR. .SH ATTRIBUTES .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ MT-Level Safe .TE .SH SEE ALSO .LP \fBsecure_rpc\fR(3NSL), \fBnsswitch.conf\fR(4), \fBpublickey\fR(4), \fBattributes\fR(5)