rsautl.c revision 9dc0df1bac950d6e491f9a7c7e4888f2b301cb15
/* rsautl.c */
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
* project 2000.
*/
/* ====================================================================
* Copyright (c) 2000 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#include <openssl/opensslconf.h>
#ifndef OPENSSL_NO_RSA
#include "apps.h"
#include <string.h>
#define RSA_SIGN 1
#define RSA_VERIFY 2
#define RSA_ENCRYPT 3
#define RSA_DECRYPT 4
#define KEY_PRIVKEY 1
#define KEY_PUBKEY 2
#define KEY_CERT 3
static void usage(void);
#define PROG rsautl_main
{
#ifndef OPENSSL_NO_ENGINE
#endif
int keyform = FORMAT_PEM;
X509 *x;
int rsa_inlen, rsa_outlen = 0;
int keysize;
int ret = 1;
argc--;
argv++;
goto end;
while(argc >= 1)
{
#ifndef OPENSSL_NO_ENGINE
#endif
}
need_priv = 1;
need_priv = 1;
} else badarg = 1;
if(badarg) {
usage();
goto end;
}
argc--;
argv++;
}
goto end;
}
#ifndef OPENSSL_NO_ENGINE
#endif
goto end;
}
/* FIXME: seed PRNG only if needed */
switch(key_type) {
case KEY_PRIVKEY:
passin, e, "Private Key");
break;
case KEY_PUBKEY:
NULL, e, "Public Key");
break;
case KEY_CERT:
NULL, e, "Certificate");
if(x) {
pkey = X509_get_pubkey(x);
X509_free(x);
}
break;
}
if(!pkey) {
return 1;
}
if(!rsa) {
goto end;
}
if(infile) {
goto end;
}
if(outfile) {
goto end;
}
} else {
#ifdef OPENSSL_SYS_VMS
{
}
#endif
}
/* Read the input data */
if(rsa_inlen <= 0) {
exit(1);
}
if(rev) {
int i;
unsigned char ctmp;
for(i = 0; i < rsa_inlen/2; i++) {
}
}
switch(rsa_mode) {
case RSA_VERIFY:
break;
case RSA_SIGN:
break;
case RSA_ENCRYPT:
break;
case RSA_DECRYPT:
break;
}
if(rsa_outlen <= 0) {
goto end;
}
ret = 0;
if(asn1parse) {
}
end:
return ret;
}
static void usage()
{
#ifndef OPENSSL_NO_ENGINE
#endif
}
#endif