60 #ifndef OPENSSL_NO_RSA
77 static void usage(
void);
81 #define PROG rsautl_main
83 int MAIN(
int argc,
char **);
85 int MAIN(
int argc,
char **argv)
89 char *infile = NULL, *outfile = NULL;
90 #ifndef OPENSSL_NO_ENGINE
96 char need_priv = 0, badarg = 0, rev = 0;
97 char hexdump = 0, asn1parse = 0;
101 unsigned char *rsa_in = NULL, *rsa_out = NULL, pad;
102 char *passargin = NULL, *passin = NULL;
103 int rsa_inlen, rsa_outlen = 0;
121 if (!strcmp(*argv,
"-in")) {
126 }
else if (!strcmp(*argv,
"-out")) {
131 }
else if(!strcmp(*argv,
"-inkey")) {
136 }
else if (!strcmp(*argv,
"-passin")) {
140 passargin= *(++argv);
141 }
else if (strcmp(*argv,
"-keyform") == 0) {
146 #ifndef OPENSSL_NO_ENGINE
147 }
else if(!strcmp(*argv,
"-engine")) {
153 }
else if(!strcmp(*argv,
"-pubin")) {
155 }
else if(!strcmp(*argv,
"-certin")) {
158 else if(!strcmp(*argv,
"-asn1parse")) asn1parse = 1;
159 else if(!strcmp(*argv,
"-hexdump")) hexdump = 1;
165 else if(!strcmp(*argv,
"-sign")) {
168 }
else if(!strcmp(*argv,
"-verify")) rsa_mode =
RSA_VERIFY;
169 else if(!strcmp(*argv,
"-rev")) rev = 1;
170 else if(!strcmp(*argv,
"-encrypt")) rsa_mode =
RSA_ENCRYPT;
171 else if(!strcmp(*argv,
"-decrypt")) {
188 #ifndef OPENSSL_NO_ENGINE
202 passin, e,
"Private Key");
207 NULL, e,
"Public Key");
212 NULL, e,
"Certificate");
250 #ifdef OPENSSL_SYS_VMS
264 rsa_inlen =
BIO_read(in, rsa_in, keysize * 2);
272 for(i = 0; i < rsa_inlen/2; i++) {
274 rsa_in[i] = rsa_in[rsa_inlen - 1 - i];
275 rsa_in[rsa_inlen - 1 - i] = ctmp;
298 if(rsa_outlen <= 0) {
308 }
else if(hexdump)
BIO_dump(out, (
char *)rsa_out, rsa_outlen);
309 else BIO_write(out, rsa_out, rsa_outlen);
328 BIO_printf(
bio_err,
"-certin input is a certificate carrying an RSA public key\n");
338 #ifndef OPENSSL_NO_ENGINE
348 static void *dummy=&dummy;