亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? rsa.c

?? OpenSSL的RSA算法應用舉例。是用VC寫的
?? C
字號:
/* apps/rsa.c *//* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. *  * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to.  The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code.  The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). *  * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. *  * 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 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 the *    documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *    "This product includes cryptographic software written by *     Eric Young (eay@cryptsoft.com)" *    The word 'cryptographic' can be left out if the rouines from the library *    being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from  *    the apps directory (application code) you must include an acknowledgement: *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" *  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS 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 AUTHOR OR 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. *  * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed.  i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */#ifndef NO_RSA#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#include "apps.h"#include <openssl/bio.h>#include <openssl/err.h>#include <openssl/rsa.h>#include <openssl/evp.h>#include <openssl/x509.h>#include <openssl/pem.h>#undef PROG#define PROG	rsa_main/* -inform arg	- input format - default PEM (one of DER, NET or PEM) * -outform arg - output format - default PEM * -in arg	- input file - default stdin * -out arg	- output file - default stdout * -des		- encrypt output if PEM format with DES in cbc mode * -des3	- encrypt output if PEM format * -idea	- encrypt output if PEM format * -text	- print a text version * -modulus	- print the RSA key modulus * -check	- verify key consistency * -pubin	- Expect a public key in input file. * -pubout	- Output a public key. */int MAIN(int, char **);int MAIN(int argc, char **argv)	{	int ret=1;	RSA *rsa=NULL;	int i,badops=0, sgckey=0;	const EVP_CIPHER *enc=NULL;	BIO *in=NULL,*out=NULL;	int informat,outformat,text=0,check=0,noout=0;	int pubin = 0, pubout = 0;	char *infile,*outfile,*prog;	char *passargin = NULL, *passargout = NULL;	char *passin = NULL, *passout = NULL;	int modulus=0;	apps_startup();	if (bio_err == NULL)		if ((bio_err=BIO_new(BIO_s_file())) != NULL)			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);	infile=NULL;	outfile=NULL;	informat=FORMAT_PEM;	outformat=FORMAT_PEM;	prog=argv[0];	argc--;	argv++;	while (argc >= 1)		{		if 	(strcmp(*argv,"-inform") == 0)			{			if (--argc < 1) goto bad;			informat=str2fmt(*(++argv));			}		else if (strcmp(*argv,"-outform") == 0)			{			if (--argc < 1) goto bad;			outformat=str2fmt(*(++argv));			}		else if (strcmp(*argv,"-in") == 0)			{			if (--argc < 1) goto bad;			infile= *(++argv);			}		else if (strcmp(*argv,"-out") == 0)			{			if (--argc < 1) goto bad;			outfile= *(++argv);			}		else if (strcmp(*argv,"-passin") == 0)			{			if (--argc < 1) goto bad;			passargin= *(++argv);			}		else if (strcmp(*argv,"-passout") == 0)			{			if (--argc < 1) goto bad;			passargout= *(++argv);			}		else if (strcmp(*argv,"-sgckey") == 0)			sgckey=1;		else if (strcmp(*argv,"-pubin") == 0)			pubin=1;		else if (strcmp(*argv,"-pubout") == 0)			pubout=1;		else if (strcmp(*argv,"-noout") == 0)			noout=1;		else if (strcmp(*argv,"-text") == 0)			text=1;		else if (strcmp(*argv,"-modulus") == 0)			modulus=1;		else if (strcmp(*argv,"-check") == 0)			check=1;		else if ((enc=EVP_get_cipherbyname(&(argv[0][1]))) == NULL)			{			BIO_printf(bio_err,"unknown option %s\n",*argv);			badops=1;			break;			}		argc--;		argv++;		}	if (badops)		{bad:		BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog);		BIO_printf(bio_err,"where options are\n");		BIO_printf(bio_err," -inform arg     input format - one of DER NET PEM\n");		BIO_printf(bio_err," -outform arg    output format - one of DER NET PEM\n");		BIO_printf(bio_err," -in arg         input file\n");		BIO_printf(bio_err," -sgckey         Use IIS SGC key format\n");		BIO_printf(bio_err," -passin arg     input file pass phrase source\n");		BIO_printf(bio_err," -out arg        output file\n");		BIO_printf(bio_err," -passout arg    output file pass phrase source\n");		BIO_printf(bio_err," -des            encrypt PEM output with cbc des\n");		BIO_printf(bio_err," -des3           encrypt PEM output with ede cbc des using 168 bit key\n");#ifndef NO_IDEA		BIO_printf(bio_err," -idea           encrypt PEM output with cbc idea\n");#endif		BIO_printf(bio_err," -text           print the key in text\n");		BIO_printf(bio_err," -noout          don't print key out\n");		BIO_printf(bio_err," -modulus        print the RSA key modulus\n");		BIO_printf(bio_err," -check          verify key consistency\n");		BIO_printf(bio_err," -pubin          expect a public key in input file\n");		BIO_printf(bio_err," -pubout         output a public key\n");		goto end;		}	ERR_load_crypto_strings();	if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {		BIO_printf(bio_err, "Error getting passwords\n");		goto end;	}	if(check && pubin) {		BIO_printf(bio_err, "Only private keys can be checked\n");		goto end;	}	in=BIO_new(BIO_s_file());	out=BIO_new(BIO_s_file());	if ((in == NULL) || (out == NULL))		{		ERR_print_errors(bio_err);		goto end;		}	if (infile == NULL)		BIO_set_fp(in,stdin,BIO_NOCLOSE);	else		{		if (BIO_read_filename(in,infile) <= 0)			{			perror(infile);			goto end;			}		}	BIO_printf(bio_err,"read RSA key\n");	if	(informat == FORMAT_ASN1) {		if (pubin) rsa=d2i_RSA_PUBKEY_bio(in,NULL);		else rsa=d2i_RSAPrivateKey_bio(in,NULL);	}#ifndef NO_RC4	else if (informat == FORMAT_NETSCAPE)		{		BUF_MEM *buf=NULL;		unsigned char *p;		int size=0;		buf=BUF_MEM_new();		for (;;)			{			if ((buf == NULL) || (!BUF_MEM_grow(buf,size+1024*10)))				goto end;			i=BIO_read(in,&(buf->data[size]),1024*10);			size+=i;			if (i == 0) break;			if (i < 0)				{				perror("reading private key");				BUF_MEM_free(buf);				goto end;				}			}		p=(unsigned char *)buf->data;		rsa=d2i_RSA_NET(NULL,&p,(long)size,NULL, sgckey);		BUF_MEM_free(buf);		}#endif	else if (informat == FORMAT_PEM) {		if(pubin) rsa=PEM_read_bio_RSA_PUBKEY(in,NULL,NULL,NULL);		else rsa=PEM_read_bio_RSAPrivateKey(in,NULL, NULL,passin);	}	else		{		BIO_printf(bio_err,"bad input format specified for key\n");		goto end;		}	if (rsa == NULL)		{		BIO_printf(bio_err,"unable to load key\n");		ERR_print_errors(bio_err);		goto end;		}	if (outfile == NULL)		{		BIO_set_fp(out,stdout,BIO_NOCLOSE);#ifdef VMS		{		BIO *tmpbio = BIO_new(BIO_f_linebuffer());		out = BIO_push(tmpbio, out);		}#endif		}	else		{		if (BIO_write_filename(out,outfile) <= 0)			{			perror(outfile);			goto end;			}		}	if (text) 		if (!RSA_print(out,rsa,0))			{			perror(outfile);			ERR_print_errors(bio_err);			goto end;			}	if (modulus)		{		BIO_printf(out,"Modulus=");		BN_print(out,rsa->n);		BIO_printf(out,"\n");		}	if (check)		{		int r = RSA_check_key(rsa);		if (r == 1)			BIO_printf(out,"RSA key ok\n");		else if (r == 0)			{			long e;			while ((e = ERR_peek_error()) != 0 &&				ERR_GET_LIB(e) == ERR_LIB_RSA &&				ERR_GET_FUNC(e) == RSA_F_RSA_CHECK_KEY &&				ERR_GET_REASON(e) != ERR_R_MALLOC_FAILURE)				{				BIO_printf(out, "RSA key error: %s\n", ERR_reason_error_string(e));				ERR_get_error(); /* remove e from error stack */				}			}				if (r == -1 || ERR_peek_error() != 0) /* should happen only if r == -1 */			{			ERR_print_errors(bio_err);			goto end;			}		}			if (noout)		{		ret = 0;		goto end;		}	BIO_printf(bio_err,"writing RSA key\n");	if 	(outformat == FORMAT_ASN1) {		if(pubout || pubin) i=i2d_RSA_PUBKEY_bio(out,rsa);		else i=i2d_RSAPrivateKey_bio(out,rsa);	}#ifndef NO_RC4	else if (outformat == FORMAT_NETSCAPE)		{		unsigned char *p,*pp;		int size;		i=1;		size=i2d_RSA_NET(rsa,NULL,NULL, sgckey);		if ((p=(unsigned char *)OPENSSL_malloc(size)) == NULL)			{			BIO_printf(bio_err,"Memory allocation failure\n");			goto end;			}		pp=p;		i2d_RSA_NET(rsa,&p,NULL, sgckey);		BIO_write(out,(char *)pp,size);		OPENSSL_free(pp);		}#endif	else if (outformat == FORMAT_PEM) {		if(pubout || pubin)		    i=PEM_write_bio_RSA_PUBKEY(out,rsa);		else i=PEM_write_bio_RSAPrivateKey(out,rsa,						enc,NULL,0,NULL,passout);	} else	{		BIO_printf(bio_err,"bad output format specified for outfile\n");		goto end;		}	if (!i)		{		BIO_printf(bio_err,"unable to write key\n");		ERR_print_errors(bio_err);		}	else		ret=0;end:	if(in != NULL) BIO_free(in);	if(out != NULL) BIO_free_all(out);	if(rsa != NULL) RSA_free(rsa);	if(passin) OPENSSL_free(passin);	if(passout) OPENSSL_free(passout);	OPENSSL_EXIT(ret);	}#else /* !NO_RSA */# if PEDANTICstatic void *dummy=&dummy;# endif#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久亚洲高清| 国产精品视频观看| 99精品久久只有精品| 午夜视频久久久久久| 国产精品欧美一区二区三区| 91精品在线麻豆| 91年精品国产| 国产成人在线电影| 黄页网站大全一区二区| 天天亚洲美女在线视频| 一区二区三区.www| 国产精品美女久久久久aⅴ| 欧美sm美女调教| 91精品国产欧美一区二区18 | 亚洲一二三区在线观看| 国产偷v国产偷v亚洲高清| 91精品国产一区二区三区| 精品视频1区2区| 在线观看视频一区二区| 成人精品国产一区二区4080| 免费在线观看视频一区| 亚洲成人免费看| 亚洲成在线观看| 亚洲精品高清在线| 国产精品福利影院| 久久精品夜色噜噜亚洲a∨| 欧美成人伊人久久综合网| 3d成人动漫网站| 欧美日韩国产片| 欧美体内she精高潮| 欧亚一区二区三区| 欧洲国内综合视频| 在线精品视频免费播放| 色婷婷久久久综合中文字幕| av在线播放成人| 91亚洲精品一区二区乱码| 成人污污视频在线观看| 成人激情图片网| 99久久精品免费看国产免费软件| 成熟亚洲日本毛茸茸凸凹| 成人午夜看片网址| av不卡在线观看| 91在线无精精品入口| 一本大道久久a久久精品综合| 99综合电影在线视频| 91亚洲永久精品| 欧美探花视频资源| 日韩一级高清毛片| 欧美xxxxxxxx| 国产欧美一区二区精品性色| 国产精品女上位| 亚洲你懂的在线视频| 亚洲一区二区三区在线播放| 视频一区在线播放| 久久精品国产第一区二区三区| 蜜臀va亚洲va欧美va天堂| 韩国女主播成人在线| 成人免费看黄yyy456| 色哟哟国产精品| 3d动漫精品啪啪| 久久精品视频在线免费观看 | 亚洲精品欧美二区三区中文字幕| 亚洲制服欧美中文字幕中文字幕| 午夜av一区二区| 激情图片小说一区| 91浏览器在线视频| 337p亚洲精品色噜噜噜| 久久综合九色综合欧美就去吻| 国产精品素人视频| 亚洲国产毛片aaaaa无费看| 蜜臀av亚洲一区中文字幕| 国产一本一道久久香蕉| 91浏览器打开| 日韩精品一区二| 自拍偷拍亚洲综合| 蜜桃视频在线一区| 91日韩一区二区三区| 欧美一二三区在线观看| 国产精品区一区二区三区| 亚洲福利一二三区| 国产成人免费视频| 欧美人妖巨大在线| 国产精品午夜春色av| 日韩不卡一二三区| 99在线精品视频| 欧美一级电影网站| 亚洲女厕所小便bbb| 国产在线播放一区二区三区| 欧美午夜在线观看| 中文字幕欧美国产| 蜜臀av性久久久久蜜臀av麻豆| 97精品久久久久中文字幕| 日韩一二三区不卡| 一区二区三区四区在线播放 | 激情综合色播激情啊| 色综合中文字幕国产| 精品少妇一区二区三区日产乱码 | 国产精品电影一区二区三区| 美女视频黄a大片欧美| 色综合网站在线| 久久精品在这里| 奇米综合一区二区三区精品视频| youjizz国产精品| 精品88久久久久88久久久| 亚洲成人7777| 日本韩国一区二区| 国产欧美一区二区精品婷婷| 日本成人中文字幕| 欧美日韩一区不卡| 亚洲欧美一区二区三区极速播放| 韩国精品一区二区| 日韩欧美在线1卡| 五月天网站亚洲| 在线一区二区观看| 中文字幕一区二区三区不卡在线| 久久国产欧美日韩精品| 欧美乱熟臀69xxxxxx| 樱花影视一区二区| 91麻豆国产自产在线观看| 中文字幕日韩精品一区| 成人免费高清在线观看| 久久看人人爽人人| 国产一区二区在线观看免费| 欧美一区二区高清| 日韩av电影天堂| 884aa四虎影成人精品一区| 亚洲综合免费观看高清完整版| 91网站在线观看视频| 中文字幕一区二区在线观看| 国产成人免费xxxxxxxx| 日本一区二区免费在线| 国产a久久麻豆| 国产欧美日韩三级| 成人午夜视频在线观看| 国产精品嫩草久久久久| av一区二区三区| 国产精品超碰97尤物18| 99麻豆久久久国产精品免费优播| 中文字幕一区在线| 日本精品一区二区三区四区的功能| 亚洲人xxxx| 欧美日韩一区二区三区不卡| 日精品一区二区| 欧美一级午夜免费电影| 日本不卡视频一二三区| 精品久久久久久久久久久久久久久久久 | 一色屋精品亚洲香蕉网站| 91视视频在线观看入口直接观看www | 欧美影视一区在线| 丝袜脚交一区二区| 欧美大胆人体bbbb| 国产精品77777竹菊影视小说| 国产清纯在线一区二区www| 成人国产免费视频| 亚洲免费av在线| 911精品国产一区二区在线| 蜜臂av日日欢夜夜爽一区| 国产午夜精品福利| 色综合视频一区二区三区高清| 亚洲午夜精品在线| 日韩欧美成人一区| bt欧美亚洲午夜电影天堂| 一区二区三区国产精品| 在线播放91灌醉迷j高跟美女| 久久99精品一区二区三区三区| 国产日韩欧美高清在线| 91麻豆成人久久精品二区三区| 日本中文字幕一区二区视频 | 91久久精品一区二区| 日韩激情一区二区| 国产精品三级在线观看| 欧美在线一区二区| 国产真实乱偷精品视频免| 亚洲欧洲精品一区二区三区不卡| 欧美三级日韩三级国产三级| 老汉av免费一区二区三区| 国产欧美日韩在线| 欧美精品aⅴ在线视频| 国产不卡视频一区二区三区| 一区二区三区欧美久久| 精品国免费一区二区三区| 91蜜桃视频在线| 精品午夜一区二区三区在线观看| 亚洲精品乱码久久久久久日本蜜臀| 宅男在线国产精品| 99re热这里只有精品免费视频| 日本伊人色综合网| 亚洲色图制服诱惑| 亚洲精品一区在线观看| 欧美影院一区二区三区| 国产白丝精品91爽爽久久| 香蕉久久夜色精品国产使用方法 | 国产精品第四页| 日韩精品一区二区三区在线观看 | 国产麻豆精品在线观看| 亚洲图片有声小说| 国产精品日日摸夜夜摸av| 欧美一区二区精品| 色就色 综合激情| 丁香啪啪综合成人亚洲小说|