Purpose
Asks the keyserv daemon for a secure conversation key.
Library
C Library (libc.a)
Syntax
#include <rpc/rpc.h>
key_gendes ( deskey)
des_block *deskey;
Description
The key_gendes subroutine interfaces to the keyserv daemon, which is associated with the secure authentication system known as Data Encryption Standard (DES). This subroutine asks the keyserv daemon for a secure conversation key. Choosing a key at random is not recommended because the common ways of choosing random numbers, such as the current time, are easy to guess. User programs rarely need to call this subroutine. System commands such as keylogin and the Remote Procedure Call (RPC) library are the main clients.
Parameters
Item | Description |
---|---|
deskey | Points to the des_block structure. |
Return Values
Upon successful completion, this subroutine returns a value of 0. If unsuccessful, it returns a value of -1.
Purpose
Gets a secure conversation key from the keyserver daemon.
Library
Network Services Library (libnsl.a)
Syntax
#include <rpc/rpc.h>
int key_gendes ( deskey)
des_block *deskey;
Description
Parameters
Item | Description |
---|---|
deskey | Specifies the secure conversation key after successful completion. |
Return Values
Item | Description |
---|---|
0 | successful |
-1 | unsuccessful |
Examples
#include <rpc/rpc.h>
int main()
{
char name[255]; /* contains netname of owner of server process */
char rhost[255]; /* Remote host name on which server resides */
rpcprog_t PROGNUM = 0x3fffffffL;
rpcvers_t PROGVER = 0x1L;
CLIENT *clnt;
des_block dblock;
/* Obtain network name of remote host */
if (!host2netname(name, rhost, NULL))
{
fprintf(stderr, "\nhost2netname() failed\n");
exit(EXIT_FAILURE);
}
if (key_gendes(&dblock) == -1) {
fprintf(stderr, "\nkey_gendes() failed\n");
exit(EXIT_FAILURE);
}
/* Create a client handle for remote host rhost
*for PROGNUM & PROGVER on tcp transport
*/
clnt = clnt_create(rhost, PROGNUM, PROGVER, "tcp");
if (clnt == (CLIENT *) NULL) {
fprintf(stderr,"client_create() error\n");
exit(1);
}
clnt->cl_auth = authdes_seccreate(name, 80, rhost, &dblock);
/*
* Make a call to clnt_call() subroutine
*/
/* Destroy the authentication handle */
auth_destroy(clnt->cl_auth);
/* Destroy the client handle in the end */
clnt_destroy(clnt);
return 0;
}