2 * Key server protocol definition
3 * Copyright (C) 1990, 1991 Sun Microsystems, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following
13 * disclaimer in the documentation and/or other materials
14 * provided with the distribution.
15 * * Neither the name of Sun Microsystems, Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * The keyserver is a public key storage/encryption/decryption service
33 * The encryption method used is based on the Diffie-Hellman exponential
34 * key exchange technology.
36 * The key server is local to each machine, akin to the portmapper.
37 * Under TI-RPC, communication with the keyserver is through the
40 * NOTE: This .x file generates the USER level headers for the keyserver.
41 * the KERNEL level headers are created by hand as they kernel has special
46 %#pragma ident "@(#)key_prot.x 1.7 94/04/29 SMI"
49 %/* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */
52 % * Compiled from key_prot.x using rpcgen.
53 % * DO NOT EDIT THIS FILE!
54 % * This is NOT source code!
58 * PROOT and MODULUS define the way the Diffie-Hellman key is generated.
60 * MODULUS should be chosen as a prime of the form: MODULUS == 2*p + 1,
61 * where p is also prime.
63 * PROOT satisfies the following two conditions:
64 * (1) (PROOT ** 2) % MODULUS != 1
65 * (2) (PROOT ** p) % MODULUS != 1
70 const HEXMODULUS = "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b";
72 const HEXKEYBYTES = 48; /* HEXKEYBYTES == strlen(HEXMODULUS) */
73 const KEYSIZE = 192; /* KEYSIZE == bit length of key */
74 const KEYBYTES = 24; /* byte length of key */
77 * The first 16 hex digits of the encrypted secret key are used as
78 * a checksum in the database.
80 const KEYCHECKSUMSIZE = 16;
86 KEY_SUCCESS, /* no problems */
87 KEY_NOSECRET, /* no secret key stored */
88 KEY_UNKNOWN, /* unknown netname */
89 KEY_SYSTEMERR /* system error (out of memory, encryption failure) */
92 typedef opaque keybuf[HEXKEYBYTES]; /* store key in hex */
94 typedef string netnamestr<MAXNETNAMELEN>;
97 * Argument to ENCRYPT or DECRYPT
100 netnamestr remotename;
105 * Argument to ENCRYPT_PK or DECRYPT_PK
107 struct cryptkeyarg2 {
108 netnamestr remotename;
109 netobj remotekey; /* Contains a length up to 1024 bytes */
115 * Result of ENCRYPT, DECRYPT, ENCRYPT_PK, and DECRYPT_PK
117 union cryptkeyres switch (keystatus status) {
124 const MAXGIDS = 16; /* max number of gids in gid list */
136 * Result returned from GETCRED
138 union getcredres switch (keystatus status) {
148 struct key_netstarg {
151 netnamestr st_netname;
154 union key_netstres switch (keystatus status){
172 * This is my secret key.
179 * I want to talk to X.
180 * Encrypt a conversation key for me.
183 KEY_ENCRYPT(cryptkeyarg) = 2;
186 * X just sent me a message.
187 * Decrypt the conversation key for me.
190 KEY_DECRYPT(cryptkeyarg) = 3;
193 * Generate a secure conversation key for me
199 * Get me the uid, gid and group-access-list associated
200 * with this netname (for kernel which cannot use NIS)
203 KEY_GETCRED(netnamestr) = 5;
209 * Procedures 1-5 are identical to version 1
214 * This is my secret key.
221 * I want to talk to X.
222 * Encrypt a conversation key for me.
225 KEY_ENCRYPT(cryptkeyarg) = 2;
228 * X just sent me a message.
229 * Decrypt the conversation key for me.
232 KEY_DECRYPT(cryptkeyarg) = 3;
235 * Generate a secure conversation key for me
241 * Get me the uid, gid and group-access-list associated
242 * with this netname (for kernel which cannot use NIS)
245 KEY_GETCRED(netnamestr) = 5;
248 * I want to talk to X. and I know X's public key
249 * Encrypt a conversation key for me.
252 KEY_ENCRYPT_PK(cryptkeyarg2) = 6;
255 * X just sent me a message. and I know X's public key
256 * Decrypt the conversation key for me.
259 KEY_DECRYPT_PK(cryptkeyarg2) = 7;
262 * Store my public key, netname and private key.
265 KEY_NET_PUT(key_netstarg) = 8;
268 * Retrieve my public key, netname and private key.
271 KEY_NET_GET(void) = 9;
274 * Return me the conversation key that is constructed
275 * from my secret key and this publickey.
279 KEY_GET_CONV(keybuf) = 10;