Purpose
Encrypts a server network name and a Data Encryption Standard (DES) key.
Library
C Library (libc.a)
Syntax
#include <rpc/rpc.h>
key_encryptsession ( remotename, deskey)
char *remotename;
des_block *deskey;
Description
The key_encryptsession subroutine interfaces to the keyserv daemon, which is associated with the secure authentication system known as DES. This subroutine encrypts a server network name and a DES key. To do so, the routine uses the public key of the server and the secret key associated with the effective user number (UID) of the calling process. System commands such as keylogin and the Remote Procedure Call (RPC) library are the main clients. User programs rarely need to call this subroutine.
This subroutine is the inverse of the key_decryptsession subroutine.
Parameters
Item | Description |
---|---|
remotename | Points to the remote host name. |
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
Encrypts the Data Encryption Standard (DES) key.
Library
Network Services Library (libnsl.a)
Syntax
#include <rpc/rpc.h>
int key_encryptsession ( remotename, deskey)
char *remotename;
des_block *deskey;
Description
Parameters
Item | Description |
---|---|
remotename | Specifies the remote host name. |
deskname | Specifies the DES key. |
Return Values
Item | Description |
---|---|
0 | successful |
-1 | unsuccessful |
Examples
#include <rpc/rpc.h>
int main()
{
des_block dblock;
char name[255]; /* contains netname of owner of server process */
char rhost[255]; /* The Remote host */
/* Obtain network name of remote host */
if (!host2netname(name, rhost, NULL))
{
fprintf(stderr,"\nhost2netname() failed\n");
exit(1);
}
strcpy(dblock.c, "deskey");
if (key_encryptsession(name, &dblock) != 0) {
fprintf(stderr, "\nkey_encryptsession() failed\n");
exit(1);
}
return 0;
}