]> andersk Git - moira.git/blob - util/gdss/lib/crypto/write_pubkey.c
initial import of gdss from the Athena source tree
[moira.git] / util / gdss / lib / crypto / write_pubkey.c
1 /*
2  * COPYRIGHT (C) 1990 DIGITAL EQUIPMENT CORPORATION
3  * ALL RIGHTS RESERVED
4  *
5  * "Digital Equipment Corporation authorizes the reproduction,
6  * distribution and modification of this software subject to the following
7  * restrictions:
8  * 
9  * 1.  Any partial or whole copy of this software, or any modification
10  * thereof, must include this copyright notice in its entirety.
11  *
12  * 2.  This software is supplied "as is" with no warranty of any kind,
13  * expressed or implied, for any purpose, including any warranty of fitness 
14  * or merchantibility.  DIGITAL assumes no responsibility for the use or
15  * reliability of this software, nor promises to provide any form of 
16  * support for it on any basis.
17  *
18  * 3.  Distribution of this software is authorized only if no profit or
19  * remuneration of any kind is received in exchange for such distribution.
20  * 
21  * 4.  This software produces public key authentication certificates
22  * bearing an expiration date established by DIGITAL and RSA Data
23  * Security, Inc.  It may cease to generate certificates after the expiration
24  * date.  Any modification of this software that changes or defeats
25  * the expiration date or its effect is unauthorized.
26  * 
27  * 5.  Software that will renew or extend the expiration date of
28  * authentication certificates produced by this software may be obtained
29  * from RSA Data Security, Inc., 10 Twin Dolphin Drive, Redwood City, CA
30  * 94065, (415)595-8782, or from DIGITAL"
31  *
32  */
33
34 #include <stdio.h>
35 #include <ctype.h>
36 #include "BigZ.h"
37 #include "BigRSA.h"
38
39 write_pubkey(keys,name,subject,uidBuf,uid_len)
40 RSAKeyStorage *keys;
41 int  uid_len;
42 char *uidBuf, *name, *subject;
43 {
44         char publicBuf [80], *tempbuf;
45         FILE *publ;
46         
47         strcpy(publicBuf,name);
48         strcat(publicBuf,"_pubkey");
49         
50         if ((publ = fopen(publicBuf, "w")) == NULL)
51         {
52             printf("\n%s: could not open/create %s", __FILE__, publicBuf);
53             return(0);
54         }
55         fprintf(publ, "%s", subject);
56         fdumphex(uidBuf, uid_len, publ);
57         fprintf(publ," ;");
58         if ((tempbuf = (char *)EncodePublic(keys))==NULL) {
59                 printf("\n%s: Allocation Error.\n", __FILE__);
60                 return(0);
61         }
62         fdumphex(tempbuf, DecodeTotalLength(tempbuf), publ);
63         FreePublic(tempbuf);
64         fprintf(publ," ;");
65         fclose(publ);
66 }
This page took 0.042043 seconds and 5 git commands to generate.