18 #define PEM_write_SPKI(fp,x) \
19 PEM_ASN1_write((int (*)())i2d_NETSCAPE_SPKI,"SPKI",fp,\
20 (char *)x,NULL,NULL,0,NULL)
25 #define RSA_F4 0x10001
26 #define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\
46 fprintf(stderr,
"generating RSA key, could take some time...\n");
51 if ((fp=fopen(argv[1],
"r")) == NULL)
52 { perror(argv[1]);
goto err; }
62 if ((spki=NETSCAPE_SPKI_new()) == NULL)
goto err;
66 fprintf(stderr,
"please enter challenge string:");
69 fgets(buf,
sizeof buf,stdin);
71 if (i > 0) buf[--i]=
'\0';
78 PEM_write_RSAPrivateKey(stdout,pkey->
pkey.
rsa,NULL,NULL,0,NULL);
84 fprintf(stderr,
"something bad happened....");
87 NETSCAPE_SPKI_free(spki);
98 if (pkey == NULL)
return(0);
99 if (pkey->pkey.ptr != NULL)
129 if (x == NULL)
return(0);
131 if ((pk=X509_PUBKEY_new()) == NULL)
goto err;
147 if ((s=(
unsigned char *)malloc(i+1)) == NULL)
goto err;
153 X509_PUBKEY_free(x->spkac->pubkey);
158 if (pk != NULL) X509_PUBKEY_free(pk);