1ebfedea0SLionel Sambuc /* rsautl.c */
2*0a6a1f1dSLionel Sambuc /*
3*0a6a1f1dSLionel Sambuc * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
4*0a6a1f1dSLionel Sambuc * 2000.
5ebfedea0SLionel Sambuc */
6ebfedea0SLionel Sambuc /* ====================================================================
7ebfedea0SLionel Sambuc * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
8ebfedea0SLionel Sambuc *
9ebfedea0SLionel Sambuc * Redistribution and use in source and binary forms, with or without
10ebfedea0SLionel Sambuc * modification, are permitted provided that the following conditions
11ebfedea0SLionel Sambuc * are met:
12ebfedea0SLionel Sambuc *
13ebfedea0SLionel Sambuc * 1. Redistributions of source code must retain the above copyright
14ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer.
15ebfedea0SLionel Sambuc *
16ebfedea0SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright
17ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer in
18ebfedea0SLionel Sambuc * the documentation and/or other materials provided with the
19ebfedea0SLionel Sambuc * distribution.
20ebfedea0SLionel Sambuc *
21ebfedea0SLionel Sambuc * 3. All advertising materials mentioning features or use of this
22ebfedea0SLionel Sambuc * software must display the following acknowledgment:
23ebfedea0SLionel Sambuc * "This product includes software developed by the OpenSSL Project
24ebfedea0SLionel Sambuc * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25ebfedea0SLionel Sambuc *
26ebfedea0SLionel Sambuc * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27ebfedea0SLionel Sambuc * endorse or promote products derived from this software without
28ebfedea0SLionel Sambuc * prior written permission. For written permission, please contact
29ebfedea0SLionel Sambuc * licensing@OpenSSL.org.
30ebfedea0SLionel Sambuc *
31ebfedea0SLionel Sambuc * 5. Products derived from this software may not be called "OpenSSL"
32ebfedea0SLionel Sambuc * nor may "OpenSSL" appear in their names without prior written
33ebfedea0SLionel Sambuc * permission of the OpenSSL Project.
34ebfedea0SLionel Sambuc *
35ebfedea0SLionel Sambuc * 6. Redistributions of any form whatsoever must retain the following
36ebfedea0SLionel Sambuc * acknowledgment:
37ebfedea0SLionel Sambuc * "This product includes software developed by the OpenSSL Project
38ebfedea0SLionel Sambuc * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39ebfedea0SLionel Sambuc *
40ebfedea0SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41ebfedea0SLionel Sambuc * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42ebfedea0SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43ebfedea0SLionel Sambuc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44ebfedea0SLionel Sambuc * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45ebfedea0SLionel Sambuc * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46ebfedea0SLionel Sambuc * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47ebfedea0SLionel Sambuc * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48ebfedea0SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49ebfedea0SLionel Sambuc * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50ebfedea0SLionel Sambuc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51ebfedea0SLionel Sambuc * OF THE POSSIBILITY OF SUCH DAMAGE.
52ebfedea0SLionel Sambuc * ====================================================================
53ebfedea0SLionel Sambuc *
54ebfedea0SLionel Sambuc * This product includes cryptographic software written by Eric Young
55ebfedea0SLionel Sambuc * (eay@cryptsoft.com). This product includes software written by Tim
56ebfedea0SLionel Sambuc * Hudson (tjh@cryptsoft.com).
57ebfedea0SLionel Sambuc *
58ebfedea0SLionel Sambuc */
59ebfedea0SLionel Sambuc
60ebfedea0SLionel Sambuc #include <openssl/opensslconf.h>
61ebfedea0SLionel Sambuc #ifndef OPENSSL_NO_RSA
62ebfedea0SLionel Sambuc
63ebfedea0SLionel Sambuc # include "apps.h"
64ebfedea0SLionel Sambuc # include <string.h>
65ebfedea0SLionel Sambuc # include <openssl/err.h>
66ebfedea0SLionel Sambuc # include <openssl/pem.h>
67ebfedea0SLionel Sambuc # include <openssl/rsa.h>
68ebfedea0SLionel Sambuc
69ebfedea0SLionel Sambuc # define RSA_SIGN 1
70ebfedea0SLionel Sambuc # define RSA_VERIFY 2
71ebfedea0SLionel Sambuc # define RSA_ENCRYPT 3
72ebfedea0SLionel Sambuc # define RSA_DECRYPT 4
73ebfedea0SLionel Sambuc
74ebfedea0SLionel Sambuc # define KEY_PRIVKEY 1
75ebfedea0SLionel Sambuc # define KEY_PUBKEY 2
76ebfedea0SLionel Sambuc # define KEY_CERT 3
77ebfedea0SLionel Sambuc
78ebfedea0SLionel Sambuc static void usage(void);
79ebfedea0SLionel Sambuc
80ebfedea0SLionel Sambuc # undef PROG
81ebfedea0SLionel Sambuc
82ebfedea0SLionel Sambuc # define PROG rsautl_main
83ebfedea0SLionel Sambuc
84ebfedea0SLionel Sambuc int MAIN(int argc, char **);
85ebfedea0SLionel Sambuc
MAIN(int argc,char ** argv)86ebfedea0SLionel Sambuc int MAIN(int argc, char **argv)
87ebfedea0SLionel Sambuc {
88ebfedea0SLionel Sambuc ENGINE *e = NULL;
89ebfedea0SLionel Sambuc BIO *in = NULL, *out = NULL;
90ebfedea0SLionel Sambuc char *infile = NULL, *outfile = NULL;
91ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_ENGINE
92ebfedea0SLionel Sambuc char *engine = NULL;
93ebfedea0SLionel Sambuc # endif
94ebfedea0SLionel Sambuc char *keyfile = NULL;
95ebfedea0SLionel Sambuc char rsa_mode = RSA_VERIFY, key_type = KEY_PRIVKEY;
96ebfedea0SLionel Sambuc int keyform = FORMAT_PEM;
97ebfedea0SLionel Sambuc char need_priv = 0, badarg = 0, rev = 0;
98ebfedea0SLionel Sambuc char hexdump = 0, asn1parse = 0;
99ebfedea0SLionel Sambuc X509 *x;
100ebfedea0SLionel Sambuc EVP_PKEY *pkey = NULL;
101ebfedea0SLionel Sambuc RSA *rsa = NULL;
102ebfedea0SLionel Sambuc unsigned char *rsa_in = NULL, *rsa_out = NULL, pad;
103ebfedea0SLionel Sambuc char *passargin = NULL, *passin = NULL;
104ebfedea0SLionel Sambuc int rsa_inlen, rsa_outlen = 0;
105ebfedea0SLionel Sambuc int keysize;
106ebfedea0SLionel Sambuc
107ebfedea0SLionel Sambuc int ret = 1;
108ebfedea0SLionel Sambuc
109ebfedea0SLionel Sambuc argc--;
110ebfedea0SLionel Sambuc argv++;
111ebfedea0SLionel Sambuc
112*0a6a1f1dSLionel Sambuc if (!bio_err)
113*0a6a1f1dSLionel Sambuc bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
114ebfedea0SLionel Sambuc
115ebfedea0SLionel Sambuc if (!load_config(bio_err, NULL))
116ebfedea0SLionel Sambuc goto end;
117ebfedea0SLionel Sambuc ERR_load_crypto_strings();
118ebfedea0SLionel Sambuc OpenSSL_add_all_algorithms();
119ebfedea0SLionel Sambuc pad = RSA_PKCS1_PADDING;
120ebfedea0SLionel Sambuc
121*0a6a1f1dSLionel Sambuc while (argc >= 1) {
122ebfedea0SLionel Sambuc if (!strcmp(*argv, "-in")) {
123ebfedea0SLionel Sambuc if (--argc < 1)
124ebfedea0SLionel Sambuc badarg = 1;
125ebfedea0SLionel Sambuc else
126ebfedea0SLionel Sambuc infile = *(++argv);
127ebfedea0SLionel Sambuc } else if (!strcmp(*argv, "-out")) {
128ebfedea0SLionel Sambuc if (--argc < 1)
129ebfedea0SLionel Sambuc badarg = 1;
130ebfedea0SLionel Sambuc else
131ebfedea0SLionel Sambuc outfile = *(++argv);
132ebfedea0SLionel Sambuc } else if (!strcmp(*argv, "-inkey")) {
133ebfedea0SLionel Sambuc if (--argc < 1)
134ebfedea0SLionel Sambuc badarg = 1;
135ebfedea0SLionel Sambuc else
136ebfedea0SLionel Sambuc keyfile = *(++argv);
137ebfedea0SLionel Sambuc } else if (!strcmp(*argv, "-passin")) {
138ebfedea0SLionel Sambuc if (--argc < 1)
139ebfedea0SLionel Sambuc badarg = 1;
140ebfedea0SLionel Sambuc else
141ebfedea0SLionel Sambuc passargin = *(++argv);
142ebfedea0SLionel Sambuc } else if (strcmp(*argv, "-keyform") == 0) {
143ebfedea0SLionel Sambuc if (--argc < 1)
144ebfedea0SLionel Sambuc badarg = 1;
145ebfedea0SLionel Sambuc else
146ebfedea0SLionel Sambuc keyform = str2fmt(*(++argv));
147ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_ENGINE
148ebfedea0SLionel Sambuc } else if (!strcmp(*argv, "-engine")) {
149ebfedea0SLionel Sambuc if (--argc < 1)
150ebfedea0SLionel Sambuc badarg = 1;
151ebfedea0SLionel Sambuc else
152ebfedea0SLionel Sambuc engine = *(++argv);
153ebfedea0SLionel Sambuc # endif
154ebfedea0SLionel Sambuc } else if (!strcmp(*argv, "-pubin")) {
155ebfedea0SLionel Sambuc key_type = KEY_PUBKEY;
156ebfedea0SLionel Sambuc } else if (!strcmp(*argv, "-certin")) {
157ebfedea0SLionel Sambuc key_type = KEY_CERT;
158*0a6a1f1dSLionel Sambuc } else if (!strcmp(*argv, "-asn1parse"))
159*0a6a1f1dSLionel Sambuc asn1parse = 1;
160*0a6a1f1dSLionel Sambuc else if (!strcmp(*argv, "-hexdump"))
161*0a6a1f1dSLionel Sambuc hexdump = 1;
162*0a6a1f1dSLionel Sambuc else if (!strcmp(*argv, "-raw"))
163*0a6a1f1dSLionel Sambuc pad = RSA_NO_PADDING;
164*0a6a1f1dSLionel Sambuc else if (!strcmp(*argv, "-oaep"))
165*0a6a1f1dSLionel Sambuc pad = RSA_PKCS1_OAEP_PADDING;
166*0a6a1f1dSLionel Sambuc else if (!strcmp(*argv, "-ssl"))
167*0a6a1f1dSLionel Sambuc pad = RSA_SSLV23_PADDING;
168*0a6a1f1dSLionel Sambuc else if (!strcmp(*argv, "-pkcs"))
169*0a6a1f1dSLionel Sambuc pad = RSA_PKCS1_PADDING;
170*0a6a1f1dSLionel Sambuc else if (!strcmp(*argv, "-x931"))
171*0a6a1f1dSLionel Sambuc pad = RSA_X931_PADDING;
172ebfedea0SLionel Sambuc else if (!strcmp(*argv, "-sign")) {
173ebfedea0SLionel Sambuc rsa_mode = RSA_SIGN;
174ebfedea0SLionel Sambuc need_priv = 1;
175*0a6a1f1dSLionel Sambuc } else if (!strcmp(*argv, "-verify"))
176*0a6a1f1dSLionel Sambuc rsa_mode = RSA_VERIFY;
177*0a6a1f1dSLionel Sambuc else if (!strcmp(*argv, "-rev"))
178*0a6a1f1dSLionel Sambuc rev = 1;
179*0a6a1f1dSLionel Sambuc else if (!strcmp(*argv, "-encrypt"))
180*0a6a1f1dSLionel Sambuc rsa_mode = RSA_ENCRYPT;
181ebfedea0SLionel Sambuc else if (!strcmp(*argv, "-decrypt")) {
182ebfedea0SLionel Sambuc rsa_mode = RSA_DECRYPT;
183ebfedea0SLionel Sambuc need_priv = 1;
184*0a6a1f1dSLionel Sambuc } else
185*0a6a1f1dSLionel Sambuc badarg = 1;
186ebfedea0SLionel Sambuc if (badarg) {
187ebfedea0SLionel Sambuc usage();
188ebfedea0SLionel Sambuc goto end;
189ebfedea0SLionel Sambuc }
190ebfedea0SLionel Sambuc argc--;
191ebfedea0SLionel Sambuc argv++;
192ebfedea0SLionel Sambuc }
193ebfedea0SLionel Sambuc
194ebfedea0SLionel Sambuc if (need_priv && (key_type != KEY_PRIVKEY)) {
195ebfedea0SLionel Sambuc BIO_printf(bio_err, "A private key is needed for this operation\n");
196ebfedea0SLionel Sambuc goto end;
197ebfedea0SLionel Sambuc }
198ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_ENGINE
199ebfedea0SLionel Sambuc e = setup_engine(bio_err, engine, 0);
200ebfedea0SLionel Sambuc # endif
201ebfedea0SLionel Sambuc if (!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
202ebfedea0SLionel Sambuc BIO_printf(bio_err, "Error getting password\n");
203ebfedea0SLionel Sambuc goto end;
204ebfedea0SLionel Sambuc }
205ebfedea0SLionel Sambuc
206ebfedea0SLionel Sambuc /* FIXME: seed PRNG only if needed */
207ebfedea0SLionel Sambuc app_RAND_load_file(NULL, bio_err, 0);
208ebfedea0SLionel Sambuc
209ebfedea0SLionel Sambuc switch (key_type) {
210ebfedea0SLionel Sambuc case KEY_PRIVKEY:
211ebfedea0SLionel Sambuc pkey = load_key(bio_err, keyfile, keyform, 0,
212ebfedea0SLionel Sambuc passin, e, "Private Key");
213ebfedea0SLionel Sambuc break;
214ebfedea0SLionel Sambuc
215ebfedea0SLionel Sambuc case KEY_PUBKEY:
216ebfedea0SLionel Sambuc pkey = load_pubkey(bio_err, keyfile, keyform, 0,
217ebfedea0SLionel Sambuc NULL, e, "Public Key");
218ebfedea0SLionel Sambuc break;
219ebfedea0SLionel Sambuc
220ebfedea0SLionel Sambuc case KEY_CERT:
221*0a6a1f1dSLionel Sambuc x = load_cert(bio_err, keyfile, keyform, NULL, e, "Certificate");
222ebfedea0SLionel Sambuc if (x) {
223ebfedea0SLionel Sambuc pkey = X509_get_pubkey(x);
224ebfedea0SLionel Sambuc X509_free(x);
225ebfedea0SLionel Sambuc }
226ebfedea0SLionel Sambuc break;
227ebfedea0SLionel Sambuc }
228ebfedea0SLionel Sambuc
229ebfedea0SLionel Sambuc if (!pkey) {
230ebfedea0SLionel Sambuc return 1;
231ebfedea0SLionel Sambuc }
232ebfedea0SLionel Sambuc
233ebfedea0SLionel Sambuc rsa = EVP_PKEY_get1_RSA(pkey);
234ebfedea0SLionel Sambuc EVP_PKEY_free(pkey);
235ebfedea0SLionel Sambuc
236ebfedea0SLionel Sambuc if (!rsa) {
237ebfedea0SLionel Sambuc BIO_printf(bio_err, "Error getting RSA key\n");
238ebfedea0SLionel Sambuc ERR_print_errors(bio_err);
239ebfedea0SLionel Sambuc goto end;
240ebfedea0SLionel Sambuc }
241ebfedea0SLionel Sambuc
242ebfedea0SLionel Sambuc if (infile) {
243ebfedea0SLionel Sambuc if (!(in = BIO_new_file(infile, "rb"))) {
244ebfedea0SLionel Sambuc BIO_printf(bio_err, "Error Reading Input File\n");
245ebfedea0SLionel Sambuc ERR_print_errors(bio_err);
246ebfedea0SLionel Sambuc goto end;
247ebfedea0SLionel Sambuc }
248*0a6a1f1dSLionel Sambuc } else
249*0a6a1f1dSLionel Sambuc in = BIO_new_fp(stdin, BIO_NOCLOSE);
250ebfedea0SLionel Sambuc
251ebfedea0SLionel Sambuc if (outfile) {
252ebfedea0SLionel Sambuc if (!(out = BIO_new_file(outfile, "wb"))) {
253ebfedea0SLionel Sambuc BIO_printf(bio_err, "Error Reading Output File\n");
254ebfedea0SLionel Sambuc ERR_print_errors(bio_err);
255ebfedea0SLionel Sambuc goto end;
256ebfedea0SLionel Sambuc }
257ebfedea0SLionel Sambuc } else {
258ebfedea0SLionel Sambuc out = BIO_new_fp(stdout, BIO_NOCLOSE);
259ebfedea0SLionel Sambuc # ifdef OPENSSL_SYS_VMS
260ebfedea0SLionel Sambuc {
261ebfedea0SLionel Sambuc BIO *tmpbio = BIO_new(BIO_f_linebuffer());
262ebfedea0SLionel Sambuc out = BIO_push(tmpbio, out);
263ebfedea0SLionel Sambuc }
264ebfedea0SLionel Sambuc # endif
265ebfedea0SLionel Sambuc }
266ebfedea0SLionel Sambuc
267ebfedea0SLionel Sambuc keysize = RSA_size(rsa);
268ebfedea0SLionel Sambuc
269ebfedea0SLionel Sambuc rsa_in = OPENSSL_malloc(keysize * 2);
270ebfedea0SLionel Sambuc rsa_out = OPENSSL_malloc(keysize);
271*0a6a1f1dSLionel Sambuc if (!rsa_in || !rsa_out) {
272*0a6a1f1dSLionel Sambuc BIO_printf(bio_err, "Out of memory\n");
273*0a6a1f1dSLionel Sambuc ERR_print_errors(bio_err);
274*0a6a1f1dSLionel Sambuc goto end;
275*0a6a1f1dSLionel Sambuc }
276ebfedea0SLionel Sambuc
277ebfedea0SLionel Sambuc /* Read the input data */
278ebfedea0SLionel Sambuc rsa_inlen = BIO_read(in, rsa_in, keysize * 2);
279ebfedea0SLionel Sambuc if (rsa_inlen <= 0) {
280ebfedea0SLionel Sambuc BIO_printf(bio_err, "Error reading input Data\n");
281ebfedea0SLionel Sambuc exit(1);
282ebfedea0SLionel Sambuc }
283ebfedea0SLionel Sambuc if (rev) {
284ebfedea0SLionel Sambuc int i;
285ebfedea0SLionel Sambuc unsigned char ctmp;
286ebfedea0SLionel Sambuc for (i = 0; i < rsa_inlen / 2; i++) {
287ebfedea0SLionel Sambuc ctmp = rsa_in[i];
288ebfedea0SLionel Sambuc rsa_in[i] = rsa_in[rsa_inlen - 1 - i];
289ebfedea0SLionel Sambuc rsa_in[rsa_inlen - 1 - i] = ctmp;
290ebfedea0SLionel Sambuc }
291ebfedea0SLionel Sambuc }
292ebfedea0SLionel Sambuc switch (rsa_mode) {
293ebfedea0SLionel Sambuc
294ebfedea0SLionel Sambuc case RSA_VERIFY:
295ebfedea0SLionel Sambuc rsa_outlen = RSA_public_decrypt(rsa_inlen, rsa_in, rsa_out, rsa, pad);
296ebfedea0SLionel Sambuc break;
297ebfedea0SLionel Sambuc
298ebfedea0SLionel Sambuc case RSA_SIGN:
299*0a6a1f1dSLionel Sambuc rsa_outlen =
300*0a6a1f1dSLionel Sambuc RSA_private_encrypt(rsa_inlen, rsa_in, rsa_out, rsa, pad);
301ebfedea0SLionel Sambuc break;
302ebfedea0SLionel Sambuc
303ebfedea0SLionel Sambuc case RSA_ENCRYPT:
304ebfedea0SLionel Sambuc rsa_outlen = RSA_public_encrypt(rsa_inlen, rsa_in, rsa_out, rsa, pad);
305ebfedea0SLionel Sambuc break;
306ebfedea0SLionel Sambuc
307ebfedea0SLionel Sambuc case RSA_DECRYPT:
308*0a6a1f1dSLionel Sambuc rsa_outlen =
309*0a6a1f1dSLionel Sambuc RSA_private_decrypt(rsa_inlen, rsa_in, rsa_out, rsa, pad);
310ebfedea0SLionel Sambuc break;
311ebfedea0SLionel Sambuc
312ebfedea0SLionel Sambuc }
313ebfedea0SLionel Sambuc
314ebfedea0SLionel Sambuc if (rsa_outlen <= 0) {
315ebfedea0SLionel Sambuc BIO_printf(bio_err, "RSA operation error\n");
316ebfedea0SLionel Sambuc ERR_print_errors(bio_err);
317ebfedea0SLionel Sambuc goto end;
318ebfedea0SLionel Sambuc }
319ebfedea0SLionel Sambuc ret = 0;
320ebfedea0SLionel Sambuc if (asn1parse) {
321ebfedea0SLionel Sambuc if (!ASN1_parse_dump(out, rsa_out, rsa_outlen, 1, -1)) {
322ebfedea0SLionel Sambuc ERR_print_errors(bio_err);
323ebfedea0SLionel Sambuc }
324*0a6a1f1dSLionel Sambuc } else if (hexdump)
325*0a6a1f1dSLionel Sambuc BIO_dump(out, (char *)rsa_out, rsa_outlen);
326*0a6a1f1dSLionel Sambuc else
327*0a6a1f1dSLionel Sambuc BIO_write(out, rsa_out, rsa_outlen);
328ebfedea0SLionel Sambuc end:
329ebfedea0SLionel Sambuc RSA_free(rsa);
330ebfedea0SLionel Sambuc BIO_free(in);
331ebfedea0SLionel Sambuc BIO_free_all(out);
332*0a6a1f1dSLionel Sambuc if (rsa_in)
333*0a6a1f1dSLionel Sambuc OPENSSL_free(rsa_in);
334*0a6a1f1dSLionel Sambuc if (rsa_out)
335*0a6a1f1dSLionel Sambuc OPENSSL_free(rsa_out);
336*0a6a1f1dSLionel Sambuc if (passin)
337*0a6a1f1dSLionel Sambuc OPENSSL_free(passin);
338ebfedea0SLionel Sambuc return ret;
339ebfedea0SLionel Sambuc }
340ebfedea0SLionel Sambuc
usage()341ebfedea0SLionel Sambuc static void usage()
342ebfedea0SLionel Sambuc {
343ebfedea0SLionel Sambuc BIO_printf(bio_err, "Usage: rsautl [options]\n");
344ebfedea0SLionel Sambuc BIO_printf(bio_err, "-in file input file\n");
345ebfedea0SLionel Sambuc BIO_printf(bio_err, "-out file output file\n");
346ebfedea0SLionel Sambuc BIO_printf(bio_err, "-inkey file input key\n");
347ebfedea0SLionel Sambuc BIO_printf(bio_err, "-keyform arg private key format - default PEM\n");
348ebfedea0SLionel Sambuc BIO_printf(bio_err, "-pubin input is an RSA public\n");
349*0a6a1f1dSLionel Sambuc BIO_printf(bio_err,
350*0a6a1f1dSLionel Sambuc "-certin input is a certificate carrying an RSA public key\n");
351ebfedea0SLionel Sambuc BIO_printf(bio_err, "-ssl use SSL v2 padding\n");
352ebfedea0SLionel Sambuc BIO_printf(bio_err, "-raw use no padding\n");
353*0a6a1f1dSLionel Sambuc BIO_printf(bio_err,
354*0a6a1f1dSLionel Sambuc "-pkcs use PKCS#1 v1.5 padding (default)\n");
355ebfedea0SLionel Sambuc BIO_printf(bio_err, "-oaep use PKCS#1 OAEP\n");
356ebfedea0SLionel Sambuc BIO_printf(bio_err, "-sign sign with private key\n");
357ebfedea0SLionel Sambuc BIO_printf(bio_err, "-verify verify with public key\n");
358ebfedea0SLionel Sambuc BIO_printf(bio_err, "-encrypt encrypt with public key\n");
359ebfedea0SLionel Sambuc BIO_printf(bio_err, "-decrypt decrypt with private key\n");
360ebfedea0SLionel Sambuc BIO_printf(bio_err, "-hexdump hex dump output\n");
361ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_ENGINE
362*0a6a1f1dSLionel Sambuc BIO_printf(bio_err,
363*0a6a1f1dSLionel Sambuc "-engine e use engine e, possibly a hardware device.\n");
364ebfedea0SLionel Sambuc BIO_printf(bio_err, "-passin arg pass phrase source\n");
365ebfedea0SLionel Sambuc # endif
366ebfedea0SLionel Sambuc
367ebfedea0SLionel Sambuc }
368ebfedea0SLionel Sambuc
369ebfedea0SLionel Sambuc #else /* !OPENSSL_NO_RSA */
370ebfedea0SLionel Sambuc
371ebfedea0SLionel Sambuc # if PEDANTIC
372ebfedea0SLionel Sambuc static void *dummy = &dummy;
373ebfedea0SLionel Sambuc # endif
374ebfedea0SLionel Sambuc
375ebfedea0SLionel Sambuc #endif
376