'\" te .\" Copyright 1989 AT&T .\" Copyright (C) 2005, Sun Microsystems, Inc. All Rights Reserved .TH getpublickey 3NSL "10 Dec 2009" "SunOS 5.11" "Networking Services Library Functions" .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 .sp .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 .sp .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 .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ MT-LevelSafe .TE .SH SEE ALSO .sp .LP \fBsecure_rpc\fR(3NSL), \fBnsswitch.conf\fR(4), \fBpublickey\fR(4), \fBattributes\fR(5)