您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ str2fmt函数代码示例

51自学网 2021-06-03 08:25:10
  C++
这篇教程C++ str2fmt函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中str2fmt函数的典型用法代码示例。如果您正苦于以下问题:C++ str2fmt函数的具体用法?C++ str2fmt怎么用?C++ str2fmt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了str2fmt函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: handle_params

static int handle_params(struct cli_state *s, int argc, char **argv, bool is_tx){    int i, status;    char *val;    char file_mode[3];    struct common_cfg *common;    if (is_tx) {        strcpy(file_mode, "r");        common = &s->rxtx_data->tx.common;    } else {        strcpy(file_mode, "w");        common = &s->rxtx_data->rx.common;    }    for(i = 2; i < argc; i++) {        val = strchr(argv[i], '=');        if (!val) {            cli_err(s, argv[0],                    "No value provided for parameter /"%s/"", argv[i]);            return CMD_RET_INVPARAM;        }        *val++ = '/0';        if (!strcasecmp(RXTX_PARAM_FILE, argv[i])) {            status = set_sample_file_path(common, val);        } else if (!strcasecmp(RXTX_PARAM_FILEFORMAT, argv[i])) {            common->file_fmt = str2fmt(val);            if (common->file_fmt == RXTX_FMT_INVALID) {                cli_err(s, argv[0], "Invalid format provided (%s)", val);                return CMD_RET_INVPARAM;            }        } else {            if (is_tx) {                status = handle_tx_param(s, argv[i], val);                if (status)                    return status;            } else {                status = handle_rx_param(s, argv[i], val);                if (status)                    return status;            }        }    }    return 0;}
开发者ID:lunixbochs,项目名称:bladeRF,代码行数:50,


示例2: FUNC_DSC_SET_FORMAT

static int FUNC_DSC_SET_FORMAT(struct cmd_data *data){	struct dev_fd *p = search_dev_fd(data->idx);	int fmt = str2fmt(data->format);	if (fmt < 0)		return EINVAL;	if (fmt < 0)		return EINVAL;	if (!p)		return EFAULT;	fmt |= data->flags;	if (ioctl(p->fd, CA_SET_FORMAT, &fmt) < 0) {		int ret = errno;		ERROR("CA_SET_FORMAT failed : %s", strerror(errno));		return ret;	}	return 0;}
开发者ID:rayzh85,项目名称:rayzh85.github.io,代码行数:21,


示例3: smime_main

//.........这里部分代码省略.........			if (!args[1])				goto argerr;			recipfile = *++args;		} else if (!strcmp(*args, "-md")) {			if (!args[1])				goto argerr;			sign_md = EVP_get_digestbyname(*++args);			if (sign_md == NULL) {				BIO_printf(bio_err, "Unknown digest %s/n",				    *args);				goto argerr;			}		} else if (!strcmp(*args, "-inkey")) {			if (!args[1])				goto argerr;			/* If previous -inkey arument add signer to list */			if (keyfile) {				if (!signerfile) {					BIO_puts(bio_err, "Illegal -inkey without -signer/n");					goto argerr;				}				if (!sksigners)					sksigners = sk_OPENSSL_STRING_new_null();				sk_OPENSSL_STRING_push(sksigners, signerfile);				signerfile = NULL;				if (!skkeys)					skkeys = sk_OPENSSL_STRING_new_null();				sk_OPENSSL_STRING_push(skkeys, keyfile);			}			keyfile = *++args;		} else if (!strcmp(*args, "-keyform")) {			if (!args[1])				goto argerr;			keyform = str2fmt(*++args);		} else if (!strcmp(*args, "-certfile")) {			if (!args[1])				goto argerr;			certfile = *++args;		} else if (!strcmp(*args, "-CAfile")) {			if (!args[1])				goto argerr;			CAfile = *++args;		} else if (!strcmp(*args, "-CApath")) {			if (!args[1])				goto argerr;			CApath = *++args;		} else if (!strcmp(*args, "-in")) {			if (!args[1])				goto argerr;			infile = *++args;		} else if (!strcmp(*args, "-inform")) {			if (!args[1])				goto argerr;			informat = str2fmt(*++args);		} else if (!strcmp(*args, "-outform")) {			if (!args[1])				goto argerr;			outformat = str2fmt(*++args);		} else if (!strcmp(*args, "-out")) {			if (!args[1])				goto argerr;			outfile = *++args;		} else if (!strcmp(*args, "-content")) {			if (!args[1])				goto argerr;			contfile = *++args;
开发者ID:Heratom,项目名称:Firefly-project,代码行数:67,


示例4: pkeyutl_main

intpkeyutl_main(int argc, char **argv){	BIO *in = NULL, *out = NULL;	char *infile = NULL, *outfile = NULL, *sigfile = NULL;	int pkey_op = EVP_PKEY_OP_SIGN, key_type = KEY_PRIVKEY;	int keyform = FORMAT_PEM, peerform = FORMAT_PEM;	char badarg = 0, rev = 0;	char hexdump = 0, asn1parse = 0;	EVP_PKEY_CTX *ctx = NULL;	char *passargin = NULL;	int keysize = -1;	unsigned char *buf_in = NULL, *buf_out = NULL, *sig = NULL;	size_t buf_outlen = 0;	int buf_inlen = 0, siglen = -1;	int ret = 1, rv = -1;	if (single_execution) {		if (pledge("stdio cpath wpath rpath tty", NULL) == -1) {			perror("pledge");			exit(1);		}	}	argc--;	argv++;	while (argc >= 1) {		if (!strcmp(*argv, "-in")) {			if (--argc < 1)				badarg = 1;			else				infile = *(++argv);		} else if (!strcmp(*argv, "-out")) {			if (--argc < 1)				badarg = 1;			else				outfile = *(++argv);		} else if (!strcmp(*argv, "-sigfile")) {			if (--argc < 1)				badarg = 1;			else				sigfile = *(++argv);		} else if (!strcmp(*argv, "-inkey")) {			if (--argc < 1)				badarg = 1;			else {				ctx = init_ctx(&keysize,				    *(++argv), keyform, key_type,				    passargin, pkey_op);				if (!ctx) {					BIO_puts(bio_err,					    "Error initializing context/n");					ERR_print_errors(bio_err);					badarg = 1;				}			}		} else if (!strcmp(*argv, "-peerkey")) {			if (--argc < 1)				badarg = 1;			else if (!setup_peer(bio_err, ctx, peerform, *(++argv)))				badarg = 1;		} else if (!strcmp(*argv, "-passin")) {			if (--argc < 1)				badarg = 1;			else				passargin = *(++argv);		} else if (strcmp(*argv, "-peerform") == 0) {			if (--argc < 1)				badarg = 1;			else				peerform = str2fmt(*(++argv));		} else if (strcmp(*argv, "-keyform") == 0) {			if (--argc < 1)				badarg = 1;			else				keyform = str2fmt(*(++argv));		}		else if (!strcmp(*argv, "-pubin"))			key_type = KEY_PUBKEY;		else if (!strcmp(*argv, "-certin"))			key_type = KEY_CERT;		else if (!strcmp(*argv, "-asn1parse"))			asn1parse = 1;		else if (!strcmp(*argv, "-hexdump"))			hexdump = 1;		else if (!strcmp(*argv, "-sign"))			pkey_op = EVP_PKEY_OP_SIGN;		else if (!strcmp(*argv, "-verify"))			pkey_op = EVP_PKEY_OP_VERIFY;		else if (!strcmp(*argv, "-verifyrecover"))			pkey_op = EVP_PKEY_OP_VERIFYRECOVER;		else if (!strcmp(*argv, "-rev"))			rev = 1;		else if (!strcmp(*argv, "-encrypt"))			pkey_op = EVP_PKEY_OP_ENCRYPT;		else if (!strcmp(*argv, "-decrypt"))			pkey_op = EVP_PKEY_OP_DECRYPT;//.........这里部分代码省略.........
开发者ID:bbbrumley,项目名称:openbsd,代码行数:101,


示例5: MAIN

//.........这里部分代码省略.........    {        if	(strcmp(*argv,"-host") == 0)        {            if (--argc < 1) goto bad;            host= *(++argv);        }        else if	(strcmp(*argv,"-port") == 0)        {            if (--argc < 1) goto bad;            port=atoi(*(++argv));            if (port == 0) goto bad;        }        else if (strcmp(*argv,"-connect") == 0)        {            if (--argc < 1) goto bad;            if (!extract_host_port(*(++argv),&host,NULL,&port))                goto bad;        }        else if	(strcmp(*argv,"-verify") == 0)        {            verify=SSL_VERIFY_PEER;            if (--argc < 1) goto bad;            verify_depth=atoi(*(++argv));            BIO_printf(bio_err,"verify depth is %d/n",verify_depth);        }        else if	(strcmp(*argv,"-cert") == 0)        {            if (--argc < 1) goto bad;            cert_file= *(++argv);        }        else if	(strcmp(*argv,"-certform") == 0)        {            if (--argc < 1) goto bad;            cert_format = str2fmt(*(++argv));        }        else if	(strcmp(*argv,"-crl_check") == 0)            vflags |= X509_V_FLAG_CRL_CHECK;        else if	(strcmp(*argv,"-crl_check_all") == 0)            vflags |= X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL;        else if	(strcmp(*argv,"-prexit") == 0)            prexit=1;        else if	(strcmp(*argv,"-crlf") == 0)            crlf=1;        else if	(strcmp(*argv,"-quiet") == 0)        {            c_quiet=1;            c_ign_eof=1;        }        else if	(strcmp(*argv,"-ign_eof") == 0)            c_ign_eof=1;        else if	(strcmp(*argv,"-pause") == 0)            c_Pause=1;        else if	(strcmp(*argv,"-debug") == 0)            c_debug=1;#ifdef WATT32        else if (strcmp(*argv,"-wdebug") == 0)            dbug_init();#endif        else if	(strcmp(*argv,"-msg") == 0)            c_msg=1;        else if	(strcmp(*argv,"-showcerts") == 0)            c_showcerts=1;        else if	(strcmp(*argv,"-nbio_test") == 0)            nbio_test=1;        else if	(strcmp(*argv,"-state") == 0)            state=1;
开发者ID:peterlingoal,项目名称:openssl,代码行数:67,


示例6: MAIN

int MAIN(int argc, char **argv)	{	SSL_SESSION *x=NULL;	int ret=1,i,num,badops=0;	BIO *out=NULL;	int informat,outformat;	char *infile=NULL,*outfile=NULL,*context=NULL;	int cert=0,noout=0,text=0;	char **pp;	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);	informat=FORMAT_PEM;	outformat=FORMAT_PEM;	argc--;	argv++;	num=0;	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,"-text") == 0)			text= ++num;		else if (strcmp(*argv,"-cert") == 0)			cert= ++num;		else if (strcmp(*argv,"-noout") == 0)			noout= ++num;		else if (strcmp(*argv,"-context") == 0)		    {		    if(--argc < 1) goto bad;		    context=*++argv;		    }		else			{			BIO_printf(bio_err,"unknown option %s/n",*argv);			badops=1;			break;			}		argc--;		argv++;		}	if (badops)		{bad:		for (pp=sess_id_usage; (*pp != NULL); pp++)			BIO_printf(bio_err,*pp);		goto end;		}	ERR_load_crypto_strings();	x=load_sess_id(infile,informat);	if (x == NULL) { goto end; }	if(context)	    {	    x->sid_ctx_length=strlen(context);	    if(x->sid_ctx_length > SSL_MAX_SID_CTX_LENGTH)		{		BIO_printf(bio_err,"Context too long/n");		goto end;		}	    memcpy(x->sid_ctx,context,x->sid_ctx_length);	    }#ifdef undef	/* just testing for memory leaks :-) */	{	SSL_SESSION *s;	char buf[1024*10],*p;	int i;	s=SSL_SESSION_new();	p= &buf;	i=i2d_SSL_SESSION(x,&p);	p= &buf;//.........这里部分代码省略.........
开发者ID:ahenroid,项目名称:ptptl-0.2,代码行数:101,


示例7: MAIN

int MAIN(int argc, char **argv)	{#ifndef OPENSSL_NO_ENGINE	ENGINE *e = NULL;#endif	DSA *dsa=NULL;	int i,badops=0,text=0;	BIO *in=NULL,*out=NULL;	int informat,outformat,noout=0,C=0,ret=1;	char *infile,*outfile,*prog,*inrand=NULL;	int numbits= -1,num,genkey=0;	int need_rand=0;#ifndef OPENSSL_NO_ENGINE	char *engine=NULL;#endif#ifdef GENCB_TEST	int timebomb=0;#endif	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);	if (!load_config(bio_err, NULL))		goto end;	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);			}#ifndef OPENSSL_NO_ENGINE		else if(strcmp(*argv, "-engine") == 0)			{			if (--argc < 1) goto bad;			engine = *(++argv);			}#endif#ifdef GENCB_TEST		else if(strcmp(*argv, "-timebomb") == 0)			{			if (--argc < 1) goto bad;			timebomb = atoi(*(++argv));			}#endif		else if (strcmp(*argv,"-text") == 0)			text=1;		else if (strcmp(*argv,"-C") == 0)			C=1;		else if (strcmp(*argv,"-genkey") == 0)			{			genkey=1;			need_rand=1;			}		else if (strcmp(*argv,"-rand") == 0)			{			if (--argc < 1) goto bad;			inrand= *(++argv);			need_rand=1;			}		else if (strcmp(*argv,"-noout") == 0)			noout=1;		else if (sscanf(*argv,"%d",&num) == 1)			{			/* generate a key */			numbits=num;			need_rand=1;			}		else			{			BIO_printf(bio_err,"unknown option %s/n",*argv);			badops=1;			break;//.........这里部分代码省略.........
开发者ID:LucidOne,项目名称:Rovio,代码行数:101,


示例8: MAIN

int MAIN(int argc, char **argv){    int i, badops = 0;    BIO *in = NULL, *out = NULL;    int informat, outformat;    char *infile, *outfile, *prog, *certfile;    PKCS7 *p7 = NULL;    PKCS7_SIGNED *p7s = NULL;    X509_CRL *crl = NULL;    STACK_OF(OPENSSL_STRING) *certflst = NULL;    STACK_OF(X509_CRL) *crl_stack = NULL;    STACK_OF(X509) *cert_stack = NULL;    int ret = 1, nocrl = 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, "-nocrl") == 0) {            nocrl = 1;        } else if (strcmp(*argv, "-out") == 0) {            if (--argc < 1)                goto bad;            outfile = *(++argv);        } else if (strcmp(*argv, "-certfile") == 0) {            if (--argc < 1)                goto bad;            if (!certflst)                certflst = sk_OPENSSL_STRING_new_null();            if (!certflst)                goto end;            if (!sk_OPENSSL_STRING_push(certflst, *(++argv))) {                sk_OPENSSL_STRING_free(certflst);                goto end;            }        } else {            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 - DER or PEM/n");        BIO_printf(bio_err, " -outform arg   output format - DER or PEM/n");        BIO_printf(bio_err, " -in arg        input file/n");        BIO_printf(bio_err, " -out arg       output file/n");        BIO_printf(bio_err,                   " -certfile arg  certificates file of chain to a trusted CA/n");        BIO_printf(bio_err, "                (can be used more than once)/n");        BIO_printf(bio_err,                   " -nocrl         no crl to load, just certs from '-certfile'/n");        ret = 1;        goto end;    }    ERR_load_crypto_strings();    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 (!nocrl) {        if (infile == NULL)            BIO_set_fp(in, stdin, BIO_NOCLOSE);        else {            if (BIO_read_filename(in, infile) <= 0) {                perror(infile);                goto end;//.........这里部分代码省略.........
开发者ID:1Project,项目名称:SafeBoardMessenger,代码行数:101,


示例9: MAIN

int MAIN(int argc, char **argv){    int i, badops = 0, offset = 0, ret = 1, j;    unsigned int length = 0;    long num, tmplen;    BIO *in = NULL, *out = NULL, *b64 = NULL, *derout = NULL;    int informat, indent = 0, noout = 0, dump = 0, strictpem = 0;    char *infile = NULL, *str = NULL, *prog, *oidfile = NULL, *derfile =        NULL, *name = NULL, *header = NULL;    char *genstr = NULL, *genconf = NULL;    unsigned char *tmpbuf;    const unsigned char *ctmpbuf;    BUF_MEM *buf = NULL;    STACK_OF(OPENSSL_STRING) *osk = NULL;    ASN1_TYPE *at = NULL;    informat = FORMAT_PEM;    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);    if (!load_config(bio_err, NULL))        goto end;    prog = argv[0];    argc--;    argv++;    if ((osk = sk_OPENSSL_STRING_new_null()) == NULL) {        BIO_printf(bio_err, "Memory allocation failure/n");        goto end;    }    while (argc >= 1) {        if (strcmp(*argv, "-inform") == 0) {            if (--argc < 1)                goto bad;            informat = 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;            derfile = *(++argv);        } else if (strcmp(*argv, "-i") == 0) {            indent = 1;        } else if (strcmp(*argv, "-noout") == 0)            noout = 1;        else if (strcmp(*argv, "-oid") == 0) {            if (--argc < 1)                goto bad;            oidfile = *(++argv);        } else if (strcmp(*argv, "-offset") == 0) {            if (--argc < 1)                goto bad;            offset = atoi(*(++argv));        } else if (strcmp(*argv, "-length") == 0) {            if (--argc < 1)                goto bad;            length = atoi(*(++argv));            if (length == 0)                goto bad;        } else if (strcmp(*argv, "-dump") == 0) {            dump = -1;        } else if (strcmp(*argv, "-dlimit") == 0) {            if (--argc < 1)                goto bad;            dump = atoi(*(++argv));            if (dump <= 0)                goto bad;        } else if (strcmp(*argv, "-strparse") == 0) {            if (--argc < 1)                goto bad;            sk_OPENSSL_STRING_push(osk, *(++argv));        } else if (strcmp(*argv, "-genstr") == 0) {            if (--argc < 1)                goto bad;            genstr = *(++argv);        } else if (strcmp(*argv, "-genconf") == 0) {            if (--argc < 1)                goto bad;            genconf = *(++argv);        } else if (strcmp(*argv, "-strictpem") == 0) {            strictpem = 1;            informat = FORMAT_PEM;        } else {            BIO_printf(bio_err, "unknown option %s/n", *argv);            badops = 1;            break;        }        argc--;        argv++;    }    if (badops) { bad:        BIO_printf(bio_err, "%s [options] <infile/n", prog);//.........这里部分代码省略.........
开发者ID:Adallom,项目名称:openssl,代码行数:101,


示例10: MAIN

int MAIN(int argc, char **argv)	{	ENGINE *e = NULL;	int ret=1;	RSA *rsa=NULL;	int i,badops=0, sgckey=0;	const EVP_CIPHER *enc=NULL;	BIO *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;#ifndef OPENSSL_NO_ENGINE	char *engine=NULL;#endif	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);	if (!load_config(bio_err, NULL))		goto end;	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);			}#ifndef OPENSSL_NO_ENGINE		else if (strcmp(*argv,"-engine") == 0)			{			if (--argc < 1) goto bad;			engine= *(++argv);			}#endif		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)		{//.........这里部分代码省略.........
开发者ID:aosm,项目名称:OpenSSL098,代码行数:101,


示例11: MAIN

int MAIN(int argc, char **argv)	{	ENGINE *e = NULL;	unsigned char *buf=NULL;	int i,err=0;	const EVP_MD *md=NULL,*m;	BIO *in=NULL,*inp;	BIO *bmd=NULL;	BIO *out = NULL;	const char *name;#define PROG_NAME_SIZE  39	char pname[PROG_NAME_SIZE+1];	int separator=0;	int debug=0;	int keyform=FORMAT_PEM;	const char *outfile = NULL, *keyfile = NULL;	const char *sigfile = NULL, *randfile = NULL;	int out_bin = -1, want_pub = 0, do_verify = 0;	EVP_PKEY *sigkey = NULL;	unsigned char *sigbuf = NULL;	int siglen = 0;	char *passargin = NULL, *passin = NULL;#ifndef OPENSSL_NO_ENGINE	char *engine=NULL;#endif	apps_startup();	if ((buf=(unsigned char *)OPENSSL_malloc(BUFSIZE)) == NULL)		{		BIO_printf(bio_err,"out of memory/n");		goto end;		}	if (bio_err == NULL)		if ((bio_err=BIO_new(BIO_s_file())) != NULL)			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);				if (!load_config(bio_err, NULL))		goto end;	/* first check the program name */	program_name(argv[0],pname,sizeof pname);	md=EVP_get_digestbyname(pname);	argc--;	argv++;	while (argc > 0)		{		if ((*argv)[0] != '-') break;		if (strcmp(*argv,"-c") == 0)			separator=1;		else if (strcmp(*argv,"-rand") == 0)			{			if (--argc < 1) break;			randfile=*(++argv);			}		else if (strcmp(*argv,"-out") == 0)			{			if (--argc < 1) break;			outfile=*(++argv);			}		else if (strcmp(*argv,"-sign") == 0)			{			if (--argc < 1) break;			keyfile=*(++argv);			}		else if (!strcmp(*argv,"-passin"))			{			if (--argc < 1)				break;			passargin=*++argv;			}		else if (strcmp(*argv,"-verify") == 0)			{			if (--argc < 1) break;			keyfile=*(++argv);			want_pub = 1;			do_verify = 1;			}		else if (strcmp(*argv,"-prverify") == 0)			{			if (--argc < 1) break;			keyfile=*(++argv);			do_verify = 1;			}		else if (strcmp(*argv,"-signature") == 0)			{			if (--argc < 1) break;			sigfile=*(++argv);			}		else if (strcmp(*argv,"-keyform") == 0)			{			if (--argc < 1) break;			keyform=str2fmt(*(++argv));			}#ifndef OPENSSL_NO_ENGINE		else if (strcmp(*argv,"-engine") == 0)//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:101,


示例12: file_load

static int file_load(char *fn_in, char *infmt, char *outfmt){    char buf_in[BUFLEN], buf_out[BUFLEN];    FILE *fp_in, *fp_out;    BZFILE *bzf_in, *bzf_out;    gzFile gzf_in, gzf_out;    lzma_stream lzma_str = LZMA_STREAM_INIT;	struct timeval tv_start, tv_stop;    int ret, err, fmt_in, fmt_out, sl, buf_in_pos, buf_in_len, buf_out_len;    uint64_t bytes, usec;    fp_in = fp_out = bzf_in = bzf_out = gzf_in = gzf_out = NULL;    fmt_in = str2fmt(infmt);    fmt_out = str2fmt(outfmt);    //printf("fmt_in %u fmt_out %u/n", fmt_in, fmt_out);    if(fmt_in == fmt_out)    {    	fprintf(stderr, "fmt_in %d == fmt_out %d. not supported./n", fmt_in, fmt_out);    	return -1;    }    ret = gettimeofday(&tv_start, NULL);    if(ret != 0)    {    	fprintf(stderr, "gettimeofday failed/n");    }    if(fmt_in == FMT_GZIP)    {        gzf_in = gzopen(fn_in, "rb");        if(!gzf_in)        {            printf("file_load: gzopen failed/n");            return -1;        }    }    else    {    	fp_in = fopen(fn_in, "rb");    	if(!fp_in)        {        	printf("file_load: fopen failed/n");        	return -1;        }        if(fmt_in == FMT_BZIP2)        {            bzf_in = BZ2_bzReadOpen(&err, fp_in, 0, 0, NULL, 0);            if(!bzf_in)            {                fprintf(stderr, "bzReadOpen bzerr %d/n", err);                fclose(fp_in);                return -1;            }        }        else if(fmt_in == FMT_XZ)        {        	ret = xz_dec_init(&lzma_str);        	if(ret != LZMA_OK)            {            	printf("xz_enc_init failed %d/n", ret);            	fclose(fp_out);            	return -1;            }        }    }    sl = strlen(fn_in);    fn_in[sl-strlen(infmt)-1] = 0;    snprintf(buf_out, FILENAME_MAX, "%s.%s", fn_in, outfmt);    buf_out[FILENAME_MAX-1] = 0;    fn_in[sl-strlen(infmt)-1] = '.';    printf("%s -> %s", fn_in, buf_out);    if(fmt_out == FMT_GZIP)    {        gzf_out = gzopen(buf_out, "wb9");        if(gzf_out == NULL)        {            printf("file_load: gzopen failed/n");            return -1;        }    }    else    {        fp_out = fopen(buf_out, "wb");        if(!fp_out)        {        	printf("fp_out fopen failed/n");            return 1;        }        if(fmt_out == FMT_BZIP2)        {            bzf_out = BZ2_bzWriteOpen(&err, fp_out, 9, 0, 0);            if(!bzf_out)            {                printf("bzerr %d/n", err);//.........这里部分代码省略.........
开发者ID:bryanr,项目名称:transpress,代码行数:101,


示例13: rsautl_main

intrsautl_main(int argc, char **argv){	ENGINE *e = NULL;	BIO *in = NULL, *out = NULL;	char *infile = NULL, *outfile = NULL;#ifndef OPENSSL_NO_ENGINE	char *engine = NULL;#endif	char *keyfile = NULL;	char rsa_mode = RSA_VERIFY, key_type = KEY_PRIVKEY;	int keyform = FORMAT_PEM;	char need_priv = 0, badarg = 0, rev = 0;	char hexdump = 0, asn1parse = 0;	X509 *x;	EVP_PKEY *pkey = NULL;	RSA *rsa = NULL;	unsigned char *rsa_in = NULL, *rsa_out = NULL, pad;	char *passargin = NULL, *passin = NULL;	int rsa_inlen, rsa_outlen = 0;	int keysize;	int ret = 1;	argc--;	argv++;	pad = RSA_PKCS1_PADDING;	while (argc >= 1) {		if (!strcmp(*argv, "-in")) {			if (--argc < 1)				badarg = 1;			else				infile = *(++argv);		} else if (!strcmp(*argv, "-out")) {			if (--argc < 1)				badarg = 1;			else				outfile = *(++argv);		} else if (!strcmp(*argv, "-inkey")) {			if (--argc < 1)				badarg = 1;			else				keyfile = *(++argv);		} else if (!strcmp(*argv, "-passin")) {			if (--argc < 1)				badarg = 1;			else				passargin = *(++argv);		} else if (strcmp(*argv, "-keyform") == 0) {			if (--argc < 1)				badarg = 1;			else				keyform = str2fmt(*(++argv));#ifndef OPENSSL_NO_ENGINE		} else if (!strcmp(*argv, "-engine")) {			if (--argc < 1)				badarg = 1;			else				engine = *(++argv);#endif		} else if (!strcmp(*argv, "-pubin")) {			key_type = KEY_PUBKEY;		} else if (!strcmp(*argv, "-certin")) {			key_type = KEY_CERT;		} else if (!strcmp(*argv, "-asn1parse"))			asn1parse = 1;		else if (!strcmp(*argv, "-hexdump"))			hexdump = 1;		else if (!strcmp(*argv, "-raw"))			pad = RSA_NO_PADDING;		else if (!strcmp(*argv, "-oaep"))			pad = RSA_PKCS1_OAEP_PADDING;		else if (!strcmp(*argv, "-ssl"))			pad = RSA_SSLV23_PADDING;		else if (!strcmp(*argv, "-pkcs"))			pad = RSA_PKCS1_PADDING;		else if (!strcmp(*argv, "-x931"))			pad = RSA_X931_PADDING;		else if (!strcmp(*argv, "-sign")) {			rsa_mode = RSA_SIGN;			need_priv = 1;		} else if (!strcmp(*argv, "-verify"))			rsa_mode = RSA_VERIFY;		else if (!strcmp(*argv, "-rev"))			rev = 1;		else if (!strcmp(*argv, "-encrypt"))			rsa_mode = RSA_ENCRYPT;		else if (!strcmp(*argv, "-decrypt")) {			rsa_mode = RSA_DECRYPT;			need_priv = 1;		} else			badarg = 1;		if (badarg) {			usage();			goto end;		}		argc--;		argv++;//.........这里部分代码省略.........
开发者ID:Basskrapfen,项目名称:openbsd,代码行数:101,


示例14: MAIN

int MAIN(int argc, char **argv){#ifndef OPENSSL_NO_ENGINE    ENGINE *e = NULL;#endif    int ret=1;    DSA *dsa=NULL;    int i,badops=0;    const EVP_CIPHER *enc=NULL;    BIO *in=NULL,*out=NULL;    int informat,outformat,text=0,noout=0;    int pubin = 0, pubout = 0;    char *infile,*outfile,*prog;#ifndef OPENSSL_NO_ENGINE    char *engine;#endif    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);    if (!load_config(bio_err, NULL))        goto end;#ifndef OPENSSL_NO_ENGINE    engine=NULL;#endif    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);        }#ifndef OPENSSL_NO_ENGINE        else if (strcmp(*argv,"-engine") == 0)        {            if (--argc < 1) goto bad;            engine= *(++argv);        }#endif        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,"-pubin") == 0)            pubin=1;        else if (strcmp(*argv,"-pubout") == 0)            pubout=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)//.........这里部分代码省略.........
开发者ID:neominds,项目名称:JPN-IWE14057,代码行数:101,


示例15: s_client_main

//.........这里部分代码省略.........			if (--argc < 1)				goto bad;			port = *(++argv);			if (port == NULL || *port == '/0')				goto bad;		} else if (strcmp(*argv, "-connect") == 0) {			if (--argc < 1)				goto bad;			if (!extract_host_port(*(++argv), &host, NULL, &port))				goto bad;		} else if (strcmp(*argv, "-verify") == 0) {			verify = SSL_VERIFY_PEER;			if (--argc < 1)				goto bad;			verify_depth = strtonum(*(++argv), 0, INT_MAX, &errstr);			if (errstr)				goto bad;			BIO_printf(bio_err, "verify depth is %d/n", verify_depth);		} else if (strcmp(*argv, "-cert") == 0) {			if (--argc < 1)				goto bad;			cert_file = *(++argv);		} else if (strcmp(*argv, "-sess_out") == 0) {			if (--argc < 1)				goto bad;			sess_out = *(++argv);		} else if (strcmp(*argv, "-sess_in") == 0) {			if (--argc < 1)				goto bad;			sess_in = *(++argv);		} else if (strcmp(*argv, "-certform") == 0) {			if (--argc < 1)				goto bad;			cert_format = str2fmt(*(++argv));		} else if (args_verify(&argv, &argc, &badarg, bio_err, &vpm)) {			if (badarg)				goto bad;			continue;		} else if (strcmp(*argv, "-verify_return_error") == 0)			verify_return_error = 1;		else if (strcmp(*argv, "-prexit") == 0)			prexit = 1;		else if (strcmp(*argv, "-crlf") == 0)			crlf = 1;		else if (strcmp(*argv, "-quiet") == 0) {			c_quiet = 1;			c_ign_eof = 1;		} else if (strcmp(*argv, "-ign_eof") == 0)			c_ign_eof = 1;		else if (strcmp(*argv, "-no_ign_eof") == 0)			c_ign_eof = 0;		else if (strcmp(*argv, "-pause") == 0)			c_Pause = 1;		else if (strcmp(*argv, "-debug") == 0)			c_debug = 1;#ifndef OPENSSL_NO_TLSEXT		else if (strcmp(*argv, "-tlsextdebug") == 0)			c_tlsextdebug = 1;		else if (strcmp(*argv, "-status") == 0)			c_status_req = 1;#endif		else if (strcmp(*argv, "-msg") == 0)			c_msg = 1;		else if (strcmp(*argv, "-showcerts") == 0)			c_showcerts = 1;		else if (strcmp(*argv, "-nbio_test") == 0)
开发者ID:niamtokik,项目名称:openbsd,代码行数:67,


示例16: MAIN

int MAIN(int argc, char **argv){    ENGINE *e = NULL;    int ret=1;    DSA *dsa=NULL;    int i,badops=0;    const EVP_CIPHER *enc=NULL;    BIO *in=NULL,*out=NULL;    int informat,outformat,text=0,noout=0;    int pubin = 0, pubout = 0;    char *infile,*outfile,*prog;#ifndef OPENSSL_NO_ENGINE    char *engine;#endif    char *passargin = NULL, *passargout = NULL;    char *passin = NULL, *passout = NULL;    int modulus=0;    int pvk_encr = 2;    apps_startup();    if (bio_err == NULL)        if ((bio_err=BIO_new(BIO_s_file())) != NULL)            BIO_set_fp(bio_err,OPENSSL_TYPE__FILE_STDERR,BIO_NOCLOSE|BIO_FP_TEXT);    if (!load_config(bio_err, NULL))        goto end;#ifndef OPENSSL_NO_ENGINE    engine=NULL;#endif    infile=NULL;    outfile=NULL;    informat=FORMAT_PEM;    outformat=FORMAT_PEM;    prog=argv[0];    argc--;    argv++;    while (argc >= 1)    {        if 	(TINYCLR_SSL_STRCMP(*argv,"-inform") == 0)        {            if (--argc < 1) goto bad;            informat=str2fmt(*(++argv));        }        else if (TINYCLR_SSL_STRCMP(*argv,"-outform") == 0)        {            if (--argc < 1) goto bad;            outformat=str2fmt(*(++argv));        }        else if (TINYCLR_SSL_STRCMP(*argv,"-in") == 0)        {            if (--argc < 1) goto bad;            infile= *(++argv);        }        else if (TINYCLR_SSL_STRCMP(*argv,"-out") == 0)        {            if (--argc < 1) goto bad;            outfile= *(++argv);        }        else if (TINYCLR_SSL_STRCMP(*argv,"-passin") == 0)        {            if (--argc < 1) goto bad;            passargin= *(++argv);        }        else if (TINYCLR_SSL_STRCMP(*argv,"-passout") == 0)        {            if (--argc < 1) goto bad;            passargout= *(++argv);        }#ifndef OPENSSL_NO_ENGINE        else if (TINYCLR_SSL_STRCMP(*argv,"-engine") == 0)        {            if (--argc < 1) goto bad;            engine= *(++argv);        }#endif        else if (TINYCLR_SSL_STRCMP(*argv,"-pvk-strong") == 0)            pvk_encr=2;        else if (TINYCLR_SSL_STRCMP(*argv,"-pvk-weak") == 0)            pvk_encr=1;        else if (TINYCLR_SSL_STRCMP(*argv,"-pvk-none") == 0)            pvk_encr=0;        else if (TINYCLR_SSL_STRCMP(*argv,"-noout") == 0)            noout=1;        else if (TINYCLR_SSL_STRCMP(*argv,"-text") == 0)            text=1;        else if (TINYCLR_SSL_STRCMP(*argv,"-modulus") == 0)            modulus=1;        else if (TINYCLR_SSL_STRCMP(*argv,"-pubin") == 0)            pubin=1;        else if (TINYCLR_SSL_STRCMP(*argv,"-pubout") == 0)            pubout=1;        else if ((enc=EVP_get_cipherbyname(&(argv[0][1]))) == NULL)        {            BIO_printf(bio_err,"unknown option %s/n",*argv);            badops=1;            break;//.........这里部分代码省略.........
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:101,


示例17: MAIN

int MAIN(int argc, char **argv){    BIO *in = NULL, *out = NULL;    char *infile, *outfile, *prog;    char *inrand = NULL;    char *id = NULL;    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);    if (!load_config(bio_err, NULL))        goto end;    outfile = NULL;    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, "-check") == 0)            check = 1;        else if (strcmp(*argv, "-text") == 0)            text = 1;        else if (strcmp(*argv, "-dsaparam") == 0)            dsaparam = 1;        else if (strcmp(*argv, "-C") == 0)            C = 1;        else if (strcmp(*argv, "-noout") == 0)            noout = 1;        else if (strcmp(*argv, "-2") == 0)            g = 2;        else if (strcmp(*argv, "-5") == 0)            g = 5;        else if (strcmp(*argv, "-rand") == 0) {            if (--argc < 1)                goto bad;            inrand = *(++argv);        } else if (((sscanf(*argv, "%d", &num) == 0) || (num <= 0)))            goto bad;        argv++;        argc--;    }    if (badops) { bad:        BIO_printf(bio_err, "%s [options] [numbits]/n", prog);        BIO_printf(bio_err, "where options are/n");        BIO_printf(bio_err, " -inform arg   input format - one of DER PEM/n");        BIO_printf(bio_err,                   " -outform arg  output format - one of DER PEM/n");        BIO_printf(bio_err, " -in arg       input file/n");        BIO_printf(bio_err, " -out arg      output file/n");        BIO_printf(bio_err,                   " -dsaparam     read or generate DSA parameters, convert to DH/n");        BIO_printf(bio_err, " -check        check the DH parameters/n");        BIO_printf(bio_err,                   " -text         print a text form of the DH parameters/n");        BIO_printf(bio_err, " -C            Output C code/n");        BIO_printf(bio_err,                   " -2            generate parameters using  2 as the generator value/n");        BIO_printf(bio_err,                   " -5            generate parameters using  5 as the generator value/n");        BIO_printf(bio_err,                   " numbits       number of bits in to generate (default 2048)/n");        BIO_printf(bio_err, " -rand file%cfile%c.../n", LIST_SEPARATOR_CHAR,                   LIST_SEPARATOR_CHAR);        BIO_printf(bio_err,                   "               - load the file (or the files in the directory) into/n");        BIO_printf(bio_err, "               the random number generator/n");        BIO_printf(bio_err, " -noout        no output/n");        goto end;    }    ERR_load_crypto_strings();    if (g && !num)        num = DEFBITS;    if (dsaparam) {        if (g) {//.........这里部分代码省略.........
开发者ID:BeyondChallenge,项目名称:GmSSL,代码行数:101,


示例18: MAIN

int MAIN(int argc, char **argv){    X509_CRL *x=NULL;    char *CAfile = NULL, *CApath = NULL;    int ret=1,i,num,badops=0;    BIO *out=NULL;    int informat,outformat;    char *infile=NULL,*outfile=NULL;    int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0;    int fingerprint = 0;    char **pp,buf[256];    X509_STORE *store = NULL;    X509_STORE_CTX ctx;    X509_LOOKUP *lookup = NULL;    X509_OBJECT xobj;    EVP_PKEY *pkey;    int do_ver = 0;    const EVP_MD *md_alg,*digest=EVP_md5();    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);    if (bio_out == NULL)        if ((bio_out=BIO_new(BIO_s_file())) != NULL)        {            BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);#ifdef VMS            {                BIO *tmpbio = BIO_new(BIO_f_linebuffer());                bio_out = BIO_push(tmpbio, bio_out);            }#endif        }    informat=FORMAT_PEM;    outformat=FORMAT_PEM;    argc--;    argv++;    num=0;    while (argc >= 1)    {#ifdef undef        if	(strcmp(*argv,"-p") == 0)        {            if (--argc < 1) goto bad;            if (!args_from_file(++argv,Nargc,Nargv)) {                goto end;            }*/        }#endif        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,"-CApath") == 0)        {            if (--argc < 1) goto bad;            CApath = *(++argv);            do_ver = 1;        }        else if (strcmp(*argv,"-CAfile") == 0)        {            if (--argc < 1) goto bad;            CAfile = *(++argv);            do_ver = 1;        }        else if (strcmp(*argv,"-verify") == 0)            do_ver = 1;        else if (strcmp(*argv,"-text") == 0)            text = 1;        else if (strcmp(*argv,"-hash") == 0)            hash= ++num;        else if (strcmp(*argv,"-issuer") == 0)            issuer= ++num;        else if (strcmp(*argv,"-lastupdate") == 0)            lastupdate= ++num;        else if (strcmp(*argv,"-nextupdate") == 0)            nextupdate= ++num;        else if (strcmp(*argv,"-noout") == 0)            noout= ++num;//.........这里部分代码省略.........
开发者ID:jhbsz,项目名称:actiontec_opensource_mi424wr-rev-acd-56-0-10-14-4,代码行数:101,


示例19: ecparam_main

int ecparam_main(int argc, char **argv){	EC_GROUP *group = NULL;	point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED;	int new_form = 0;	int asn1_flag = OPENSSL_EC_NAMED_CURVE;	int new_asn1_flag = 0;	char *curve_name = NULL, *inrand = NULL;	int list_curves = 0, no_seed = 0, check = 0, badops = 0, text = 0,	 i, genkey = 0;	char *infile = NULL, *outfile = NULL, *prog;	BIO *in = NULL, *out = NULL;	int informat, outformat, noout = 0, C = 0, ret = 1;	char *engine = NULL;	BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL, *ec_gen = NULL,	*ec_order = NULL, *ec_cofactor = NULL;	unsigned char *buffer = NULL;	if (!load_config(bio_err, NULL))		goto end;	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, "-text") == 0)			text = 1;		else if (strcmp(*argv, "-C") == 0)			C = 1;		else if (strcmp(*argv, "-check") == 0)			check = 1;		else if (strcmp(*argv, "-name") == 0) {			if (--argc < 1)				goto bad;			curve_name = *(++argv);		} else if (strcmp(*argv, "-list_curves") == 0)			list_curves = 1;		else if (strcmp(*argv, "-conv_form") == 0) {			if (--argc < 1)				goto bad;			++argv;			new_form = 1;			if (strcmp(*argv, "compressed") == 0)				form = POINT_CONVERSION_COMPRESSED;			else if (strcmp(*argv, "uncompressed") == 0)				form = POINT_CONVERSION_UNCOMPRESSED;			else if (strcmp(*argv, "hybrid") == 0)				form = POINT_CONVERSION_HYBRID;			else				goto bad;		} else if (strcmp(*argv, "-param_enc") == 0) {			if (--argc < 1)				goto bad;			++argv;			new_asn1_flag = 1;			if (strcmp(*argv, "named_curve") == 0)				asn1_flag = OPENSSL_EC_NAMED_CURVE;			else if (strcmp(*argv, "explicit") == 0)				asn1_flag = 0;			else				goto bad;		} else if (strcmp(*argv, "-no_seed") == 0)			no_seed = 1;		else if (strcmp(*argv, "-noout") == 0)			noout = 1;		else if (strcmp(*argv, "-genkey") == 0) {			genkey = 1;		} else if (strcmp(*argv, "-rand") == 0) {			if (--argc < 1)				goto bad;			inrand = *(++argv);		} else if (strcmp(*argv, "-engine") == 0) {			if (--argc < 1)				goto bad;			engine = *(++argv);		} else {			BIO_printf(bio_err, "unknown option %s/n", *argv);			badops = 1;			break;//.........这里部分代码省略.........
开发者ID:benwh4,项目名称:libressl,代码行数:101,


示例20: MAIN

int MAIN(int argc, char **argv){    int ret = 1;    EC_KEY *eckey = NULL;    const EC_GROUP *group;    int i, badops = 0;    const EVP_CIPHER *enc = NULL;    BIO *in = NULL, *out = NULL;    int informat, outformat, text = 0, noout = 0;    int pubin = 0, pubout = 0, param_out = 0;    char *infile, *outfile, *prog, *engine;    char *passargin = NULL, *passargout = NULL;    char *passin = NULL, *passout = NULL;    point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED;    int new_form = 0;    int asn1_flag = OPENSSL_EC_NAMED_CURVE;    int new_asn1_flag = 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);    if (!load_config(bio_err, NULL))        goto end;    engine = NULL;    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, "-engine") == 0) {            if (--argc < 1)                goto bad;            engine = *(++argv);        } else if (strcmp(*argv, "-noout") == 0)            noout = 1;        else if (strcmp(*argv, "-text") == 0)            text = 1;        else if (strcmp(*argv, "-conv_form") == 0) {            if (--argc < 1)                goto bad;            ++argv;            new_form = 1;            if (strcmp(*argv, "compressed") == 0)                form = POINT_CONVERSION_COMPRESSED;            else if (strcmp(*argv, "uncompressed") == 0)                form = POINT_CONVERSION_UNCOMPRESSED;            else if (strcmp(*argv, "hybrid") == 0)                form = POINT_CONVERSION_HYBRID;            else                goto bad;        } else if (strcmp(*argv, "-param_enc") == 0) {            if (--argc < 1)                goto bad;            ++argv;            new_asn1_flag = 1;            if (strcmp(*argv, "named_curve") == 0)                asn1_flag = OPENSSL_EC_NAMED_CURVE;            else if (strcmp(*argv, "explicit") == 0)                asn1_flag = 0;            else                goto bad;        } else if (strcmp(*argv, "-param_out") == 0)            param_out = 1;        else if (strcmp(*argv, "-pubin") == 0)            pubin = 1;        else if (strcmp(*argv, "-pubout") == 0)            pubout = 1;        else if ((enc = EVP_get_cipherbyname(&(argv[0][1]))) == NULL) {//.........这里部分代码省略.........
开发者ID:GrayKing,项目名称:Leakfix-on-OpenSSL,代码行数:101,


示例21: dgst_main

intdgst_main(int argc, char **argv){	ENGINE *e = NULL;	unsigned char *buf = NULL;	int i, err = 1;	const EVP_MD *md = NULL, *m;	BIO *in = NULL, *inp;	BIO *bmd = NULL;	BIO *out = NULL;#define PROG_NAME_SIZE  39	char pname[PROG_NAME_SIZE + 1];	int separator = 0;	int debug = 0;	int keyform = FORMAT_PEM;	const char *outfile = NULL, *keyfile = NULL;	const char *sigfile = NULL;	int out_bin = -1, want_pub = 0, do_verify = 0;	EVP_PKEY *sigkey = NULL;	unsigned char *sigbuf = NULL;	int siglen = 0;	char *passargin = NULL, *passin = NULL;#ifndef OPENSSL_NO_ENGINE	char *engine = NULL;#endif	char *hmac_key = NULL;	char *mac_name = NULL;	STACK_OF(OPENSSL_STRING) * sigopts = NULL, *macopts = NULL;	if ((buf = malloc(BUFSIZE)) == NULL) {		BIO_printf(bio_err, "out of memory/n");		goto end;	}	/* first check the program name */	program_name(argv[0], pname, sizeof pname);	md = EVP_get_digestbyname(pname);	argc--;	argv++;	while (argc > 0) {		if ((*argv)[0] != '-')			break;		if (strcmp(*argv, "-c") == 0)			separator = 1;		else if (strcmp(*argv, "-r") == 0)			separator = 2;		else if (strcmp(*argv, "-out") == 0) {			if (--argc < 1)				break;			outfile = *(++argv);		} else if (strcmp(*argv, "-sign") == 0) {			if (--argc < 1)				break;			keyfile = *(++argv);		} else if (!strcmp(*argv, "-passin")) {			if (--argc < 1)				break;			passargin = *++argv;		} else if (strcmp(*argv, "-verify") == 0) {			if (--argc < 1)				break;			keyfile = *(++argv);			want_pub = 1;			do_verify = 1;		} else if (strcmp(*argv, "-prverify") == 0) {			if (--argc < 1)				break;			keyfile = *(++argv);			do_verify = 1;		} else if (strcmp(*argv, "-signature") == 0) {			if (--argc < 1)				break;			sigfile = *(++argv);		} else if (strcmp(*argv, "-keyform") == 0) {			if (--argc < 1)				break;			keyform = str2fmt(*(++argv));		}#ifndef OPENSSL_NO_ENGINE		else if (strcmp(*argv, "-engine") == 0) {			if (--argc < 1)				break;			engine = *(++argv);			e = setup_engine(bio_err, engine, 0);		}#endif		else if (strcmp(*argv, "-hex") == 0)			out_bin = 0;		else if (strcmp(*argv, "-binary") == 0)			out_bin = 1;		else if (strcmp(*argv, "-d") == 0)			debug = 1;		else if (!strcmp(*argv, "-hmac")) {			if (--argc < 1)				break;			hmac_key = *++argv;		} else if (!strcmp(*argv, "-mac")) {			if (--argc < 1)//.........这里部分代码省略.........
开发者ID:alan-mushi,项目名称:libressl-RSA-backdoor,代码行数:101,


示例22: MAIN

int MAIN(int argc, char **argv){    DH *dh = NULL;    int i, badops = 0, text = 0;    BIO *in = NULL, *out = NULL;    int informat, outformat, check = 0, noout = 0, C = 0, ret = 1;    char *infile, *outfile, *prog;# ifndef OPENSSL_NO_ENGINE    char *engine;# endif    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);    if (!load_config(bio_err, NULL))        goto end;# ifndef OPENSSL_NO_ENGINE    engine = NULL;# endif    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);        }# ifndef OPENSSL_NO_ENGINE        else if (strcmp(*argv, "-engine") == 0) {            if (--argc < 1)                goto bad;            engine = *(++argv);        }# endif        else if (strcmp(*argv, "-check") == 0)            check = 1;        else if (strcmp(*argv, "-text") == 0)            text = 1;        else if (strcmp(*argv, "-C") == 0)            C = 1;        else if (strcmp(*argv, "-noout") == 0)            noout = 1;        else {            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 PEM/n");        BIO_printf(bio_err,                   " -outform arg  output format - one of DER PEM/n");        BIO_printf(bio_err, " -in arg       input file/n");        BIO_printf(bio_err, " -out arg      output file/n");        BIO_printf(bio_err, " -check        check the DH parameters/n");        BIO_printf(bio_err,                   " -text         print a text form of the DH parameters/n");        BIO_printf(bio_err, " -C            Output C code/n");        BIO_printf(bio_err, " -noout        no output/n");# ifndef OPENSSL_NO_ENGINE        BIO_printf(bio_err,                   " -engine e     use engine e, possibly a hardware device./n");# endif        goto end;    }    ERR_load_crypto_strings();# ifndef OPENSSL_NO_ENGINE    setup_engine(bio_err, engine, 0);# endif//.........这里部分代码省略.........
开发者ID:119120119,项目名称:node,代码行数:101,


示例23: MAIN

//.........这里部分代码省略.........        } else if (!strcmp(*args, "-certsout")) {            if (!args[1])                goto argerr;            certsoutfile = *++args;        } else if (!strcmp(*args, "-md")) {            if (!args[1])                goto argerr;            sign_md = EVP_get_digestbyname(*++args);            if (sign_md == NULL) {                BIO_printf(bio_err, "Unknown digest %s/n", *args);                goto argerr;            }        } else if (!strcmp(*args, "-inkey")) {            if (!args[1])                goto argerr;            /* If previous -inkey arument add signer to list */            if (keyfile) {                if (!signerfile) {                    BIO_puts(bio_err, "Illegal -inkey without -signer/n");                    goto argerr;                }                if (!sksigners)                    sksigners = sk_OPENSSL_STRING_new_null();                sk_OPENSSL_STRING_push(sksigners, signerfile);                signerfile = NULL;                if (!skkeys)                    skkeys = sk_OPENSSL_STRING_new_null();                sk_OPENSSL_STRING_push(skkeys, keyfile);            }            keyfile = *++args;        } else if (!strcmp(*args, "-keyform")) {            if (!args[1])                goto argerr;            keyform = str2fmt(*++args);        } else if (!strcmp(*args, "-keyopt")) {            int keyidx = -1;            if (!args[1])                goto argerr;            if (operation == SMIME_ENCRYPT) {                if (encerts)                    keyidx += sk_X509_num(encerts);            } else {                if (keyfile || signerfile)                    keyidx++;                if (skkeys)                    keyidx += sk_OPENSSL_STRING_num(skkeys);            }            if (keyidx < 0) {                BIO_printf(bio_err, "No key specified/n");                goto argerr;            }            if (key_param == NULL || key_param->idx != keyidx) {                cms_key_param *nparam;                nparam = OPENSSL_malloc(sizeof(cms_key_param));                if (!nparam) {                    BIO_printf(bio_err, "Out of memory/n");                    goto argerr;                }                nparam->idx = keyidx;                nparam->param = sk_OPENSSL_STRING_new_null();                nparam->next = NULL;                if (key_first == NULL)                    key_first = nparam;                else                    key_param->next = nparam;                key_param = nparam;
开发者ID:davidlt,项目名称:openssl-fedora,代码行数:67,


示例24: MAIN

int MAIN(int argc, char **argv)	{	ENGINE *e = NULL;	char **args, *infile = NULL, *outfile = NULL;	char *passargin = NULL, *passargout = NULL;	BIO *in = NULL, *out = NULL;	int topk8 = 0;	int pbe_nid = -1;	const EVP_CIPHER *cipher = NULL;	int iter = PKCS12_DEFAULT_ITER;	int informat, outformat;	int p8_broken = PKCS8_OK;	int nocrypt = 0;	X509_SIG *p8 = NULL;	PKCS8_PRIV_KEY_INFO *p8inf = NULL;	EVP_PKEY *pkey=NULL;	char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL;	int badarg = 0;	int ret = 1;#ifndef OPENSSL_NO_ENGINE	char *engine=NULL;#endif	if (bio_err == NULL) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);	if (!load_config(bio_err, NULL))		goto end;	informat=FORMAT_PEM;	outformat=FORMAT_PEM;	ERR_load_crypto_strings();	OpenSSL_add_all_algorithms();	args = argv + 1;	while (!badarg && *args && *args[0] == '-')		{		if (!strcmp(*args,"-v2"))			{			if (args[1])				{				args++;				cipher=EVP_get_cipherbyname(*args);				if (!cipher)					{					BIO_printf(bio_err,						 "Unknown cipher %s/n", *args);					badarg = 1;					}				}			else				badarg = 1;			}		else if (!strcmp(*args,"-v1"))			{			if (args[1])				{				args++;				pbe_nid=OBJ_txt2nid(*args);				if (pbe_nid == NID_undef)					{					BIO_printf(bio_err,						 "Unknown PBE algorithm %s/n", *args);					badarg = 1;					}				}			else				badarg = 1;			}		else if (!strcmp(*args,"-v2prf"))			{			if (args[1])				{				args++;				pbe_nid=OBJ_txt2nid(*args);				if (!EVP_PBE_find(EVP_PBE_TYPE_PRF, pbe_nid, NULL, NULL, 0))					{					BIO_printf(bio_err,						 "Unknown PRF algorithm %s/n", *args);					badarg = 1;					}				}			else				badarg = 1;			}		else if (!strcmp(*args,"-inform"))			{			if (args[1])				{				args++;				informat=str2fmt(*args);				}			else badarg = 1;			}		else if (!strcmp(*args,"-outform"))			{			if (args[1])				{				args++;				outformat=str2fmt(*args);				}//.........这里部分代码省略.........
开发者ID:rfkrocktk,项目名称:openssl,代码行数:101,


示例25: MAIN

int MAIN(int argc, char **argv)	{	ENGINE *e = NULL;	int ret=1;	X509_REQ *req=NULL;	X509 *x=NULL,*xca=NULL;	ASN1_OBJECT *objtmp;	STACK_OF(OPENSSL_STRING) *sigopts = NULL;	EVP_PKEY *Upkey=NULL,*CApkey=NULL;	ASN1_INTEGER *sno = NULL;	int i,num,badops=0;	BIO *out=NULL;	BIO *STDout=NULL;	STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL;	int informat,outformat,keyformat,CAformat,CAkeyformat;	char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL;	char *CAkeyfile=NULL,*CAserial=NULL;	char *alias=NULL;	int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0;	int next_serial=0;	int subject_hash=0,issuer_hash=0,ocspid=0;#ifndef OPENSSL_NO_MD5	int subject_hash_old=0,issuer_hash_old=0;#endif	int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0;	int ocsp_uri=0;	int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;	int C=0;	int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0;	int pprint = 0;	const char **pp;	X509_STORE *ctx=NULL;	X509_REQ *rq=NULL;	int fingerprint=0;	char buf[256];	const EVP_MD *md_alg,*digest=NULL;	CONF *extconf = NULL;	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;	int need_rand = 0;	int checkend=0,checkoffset=0;	unsigned long nmflag = 0, certflag = 0;#ifndef OPENSSL_NO_ENGINE	char *engine=NULL;#endif	reqfile=0;	apps_startup();	if (bio_err == NULL)		bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);	if (!load_config(bio_err, NULL))		goto end;	STDout=BIO_new_fp(stdout,BIO_NOCLOSE);#ifdef OPENSSL_SYS_VMS	{	BIO *tmpbio = BIO_new(BIO_f_linebuffer());	STDout = BIO_push(tmpbio, STDout);	}#endif	informat=FORMAT_PEM;	outformat=FORMAT_PEM;	keyformat=FORMAT_PEM;	CAformat=FORMAT_PEM;	CAkeyformat=FORMAT_PEM;	ctx=X509_STORE_new();	if (ctx == NULL) goto end;	X509_STORE_set_verify_cb(ctx,callb);	argc--;	argv++;	num=0;	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,"-keyform") == 0)			{			if (--argc < 1) goto bad;			keyformat=str2fmt(*(++argv));			}		else if (strcmp(*argv,"-req") == 0)			{			reqfile=1;			need_rand = 1;			}		else if (strcmp(*argv,"-CAform") == 0)			{			if (--argc < 1) goto bad;//.........这里部分代码省略.........
开发者ID:0omega,项目名称:platform_external_openssl,代码行数:101,


示例26: MAIN

//.........这里部分代码省略.........			{			if (args[1])				{				args++;				signerfile = *args;				}			else				badarg = 1;			}		else if (!strcmp (*args, "-recip"))			{			if (args[1])				{				args++;				recipfile = *args;				}			else badarg = 1;			}		else if (!strcmp (*args, "-inkey"))			{			if (args[1])				{				args++;				keyfile = *args;				}			else				badarg = 1;		}		else if (!strcmp (*args, "-keyform"))			{			if (args[1])				{				args++;				keyform = str2fmt(*args);				}			else				badarg = 1;			}		else if (!strcmp (*args, "-certfile"))			{			if (args[1])				{				args++;				certfile = *args;				}			else				badarg = 1;			}		else if (!strcmp (*args, "-CAfile"))			{			if (args[1])				{				args++;				CAfile = *args;				}			else				badarg = 1;			}		else if (!strcmp (*args, "-CApath"))			{			if (args[1])				{				args++;				CApath = *args;				}			else
开发者ID:321543223,项目名称:kbengine,代码行数:67,


示例27: MAIN

int MAIN(int argc, char **argv)	{	int i,badops=0,offset=0,ret=1,j;	unsigned int length=0;	long num,tmplen;	BIO *in=NULL,*out=NULL,*b64=NULL, *derout = NULL;	int informat,indent=0, noout = 0, dump = 0;	char *infile=NULL,*str=NULL,*prog,*oidfile=NULL, *derfile=NULL;	unsigned char *tmpbuf;	BUF_MEM *buf=NULL;	STACK *osk=NULL;	ASN1_TYPE *at=NULL;	informat=FORMAT_PEM;	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);	prog=argv[0];	argc--;	argv++;	if ((osk=sk_new_null()) == NULL)		{		BIO_printf(bio_err,"Memory allocation failure/n");		goto end;		}	while (argc >= 1)		{		if 	(strcmp(*argv,"-inform") == 0)			{			if (--argc < 1) goto bad;			informat=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;			derfile= *(++argv);			}		else if (strcmp(*argv,"-i") == 0)			{			indent=1;			}		else if (strcmp(*argv,"-noout") == 0) noout = 1;		else if (strcmp(*argv,"-oid") == 0)			{			if (--argc < 1) goto bad;			oidfile= *(++argv);			}		else if (strcmp(*argv,"-offset") == 0)			{			if (--argc < 1) goto bad;			offset= atoi(*(++argv));			}		else if (strcmp(*argv,"-length") == 0)			{			if (--argc < 1) goto bad;			length= atoi(*(++argv));			if (length == 0) goto bad;			}		else if (strcmp(*argv,"-dump") == 0)			{			dump= -1;			}		else if (strcmp(*argv,"-dlimit") == 0)			{			if (--argc < 1) goto bad;			dump= atoi(*(++argv));			if (dump <= 0) goto bad;			}		else if (strcmp(*argv,"-strparse") == 0)			{			if (--argc < 1) goto bad;			sk_push(osk,*(++argv));			}		else			{			BIO_printf(bio_err,"unknown option %s/n",*argv);			badops=1;			break;			}		argc--;		argv++;		}	if (badops)		{bad:		BIO_printf(bio_err,"%s [options] <infile/n",prog);		BIO_printf(bio_err,"where options are/n");		BIO_printf(bio_err," -inform arg   input format - one of DER TXT PEM/n");		BIO_printf(bio_err," -in arg       input file/n");		BIO_printf(bio_err," -out arg      output file (output format is always DER/n");//.........这里部分代码省略.........
开发者ID:aosm,项目名称:OpenSSL096,代码行数:101,


示例28: MAIN

int MAIN(int argc, char **argv){    ENGINE *e = NULL;    char **args, *infile = NULL, *outfile = NULL;    char *passargin = NULL, *passargout = NULL;    BIO *in = NULL, *out = NULL;    const EVP_CIPHER *cipher = NULL;    int informat, outformat;    int pubin = 0, pubout = 0, pubtext = 0, text = 0, noout = 0;    EVP_PKEY *pkey = NULL;    char *passin = NULL, *passout = NULL;    int badarg = 0;#ifndef OPENSSL_NO_ENGINE    char *engine = NULL;#endif    int ret = 1;    if (bio_err == NULL)        bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);    if (!load_config(bio_err, NULL))        goto end;    informat = FORMAT_PEM;    outformat = FORMAT_PEM;    ERR_load_crypto_strings();    OpenSSL_add_all_algorithms();    args = argv + 1;    while (!badarg && *args && *args[0] == '-') {        if (!strcmp(*args, "-inform")) {            if (args[1]) {                args++;                informat = str2fmt(*args);            } else                badarg = 1;        } else if (!strcmp(*args, "-outform")) {            if (args[1]) {                args++;                outformat = str2fmt(*args);            } else                badarg = 1;        } else if (!strcmp(*args, "-passin")) {            if (!args[1])                goto bad;            passargin = *(++args);        } else if (!strcmp(*args, "-passout")) {            if (!args[1])                goto bad;            passargout = *(++args);        }#ifndef OPENSSL_NO_ENGINE        else if (strcmp(*args, "-engine") == 0) {            if (!args[1])                goto bad;            engine = *(++args);        }#endif        else if (!strcmp(*args, "-in")) {            if (args[1]) {                args++;                infile = *args;            } else                badarg = 1;        } else if (!strcmp(*args, "-out")) {            if (args[1]) {                args++;                outfile = *args;            } else                badarg = 1;        } else if (strcmp(*args, "-pubin") == 0) {            pubin = 1;            pubout = 1;            pubtext = 1;        } else if (strcmp(*args, "-pubout") == 0)            pubout = 1;        else if (strcmp(*args, "-text_pub") == 0) {            pubtext = 1;            text = 1;        } else if (strcmp(*args, "-text") == 0)            text = 1;        else if (strcmp(*args, "-noout") == 0)            noout = 1;        else {            cipher = EVP_get_cipherbyname(*args + 1);            if (!cipher) {                BIO_printf(bio_err, "Unknown cipher %s/n", *args + 1);                badarg = 1;            }        }        args++;    }    if (badarg) { bad:        BIO_printf(bio_err, "Usage pkey [options]/n");        BIO_printf(bio_err, "where options are/n");        BIO_printf(bio_err, "-in file        input file/n");        BIO_printf(bio_err, "-inform X       input format (DER or PEM)/n");        BIO_printf(bio_err,//.........这里部分代码省略.........
开发者ID:1Project,项目名称:SafeBoardMessenger,代码行数:101,


示例29: pkey_main

intpkey_main(int argc, char **argv){	char **args, *infile = NULL, *outfile = NULL;	char *passargin = NULL, *passargout = NULL;	BIO *in = NULL, *out = NULL;	const EVP_CIPHER *cipher = NULL;	int informat, outformat;	int pubin = 0, pubout = 0, pubtext = 0, text = 0, noout = 0;	EVP_PKEY *pkey = NULL;	char *passin = NULL, *passout = NULL;	int badarg = 0;	int ret = 1;	if (single_execution) {		if (pledge("stdio rpath wpath cpath tty", NULL) == -1) {			perror("pledge");			exit(1);		}	}	informat = FORMAT_PEM;	outformat = FORMAT_PEM;	args = argv + 1;	while (!badarg && *args && *args[0] == '-') {		if (!strcmp(*args, "-inform")) {			if (args[1]) {				args++;				informat = str2fmt(*args);			} else				badarg = 1;		} else if (!strcmp(*args, "-outform")) {			if (args[1]) {				args++;				outformat = str2fmt(*args);			} else				badarg = 1;		} else if (!strcmp(*args, "-passin")) {			if (!args[1])				goto bad;			passargin = *(++args);		} else if (!strcmp(*args, "-passout")) {			if (!args[1])				goto bad;			passargout = *(++args);		}		else if (!strcmp(*args, "-in")) {			if (args[1]) {				args++;				infile = *args;			} else				badarg = 1;		} else if (!strcmp(*args, "-out")) {			if (args[1]) {				args++;				outfile = *args;			} else				badarg = 1;		} else if (strcmp(*args, "-pubin") == 0) {			pubin = 1;			pubout = 1;			pubtext = 1;		} else if (strcmp(*args, "-pubout") == 0)			pubout = 1;		else if (strcmp(*args, "-text_pub") == 0) {			pubtext = 1;			text = 1;		} else if (strcmp(*args, "-text") == 0)			text = 1;		else if (strcmp(*args, "-noout") == 0)			noout = 1;		else {			cipher = EVP_get_cipherbyname(*args + 1);			if (!cipher) {				BIO_printf(bio_err, "Unknown cipher %s/n",				    *args + 1);				badarg = 1;			}		}		args++;	}	if (badarg) {bad:		BIO_printf(bio_err, "Usage pkey [options]/n");		BIO_printf(bio_err, "where options are/n");		BIO_printf(bio_err, "-in file        input file/n");		BIO_printf(bio_err, "-inform X       input format (DER or PEM)/n");		BIO_printf(bio_err, "-passin arg     input file pass phrase source/n");		BIO_printf(bio_err, "-outform X      output format (DER or PEM)/n");		BIO_printf(bio_err, "-out file       output file/n");		BIO_printf(bio_err, "-passout arg    output file pass phrase source/n");		return 1;	}	if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {		BIO_printf(bio_err, "Error getting passwords/n");		goto end;	}//.........这里部分代码省略.........
开发者ID:LucaBongiorni,项目名称:nextgen,代码行数:101,


示例30: genpkey_main

intgenpkey_main(int argc, char **argv){	ENGINE *e = NULL;	char **args, *outfile = NULL;	char *passarg = NULL;	BIO *in = NULL, *out = NULL;	const EVP_CIPHER *cipher = NULL;	int outformat;	int text = 0;	EVP_PKEY *pkey = NULL;	EVP_PKEY_CTX *ctx = NULL;	char *pass = NULL;	int badarg = 0;	int ret = 1, rv;	int do_param = 0;	outformat = FORMAT_PEM;	args = argv + 1;	while (!badarg && *args && *args[0] == '-') {		if (!strcmp(*args, "-outform")) {			if (args[1]) {				args++;				outformat = str2fmt(*args);			} else				badarg = 1;		} else if (!strcmp(*args, "-pass")) {			if (!args[1])				goto bad;			passarg = *(++args);		}#ifndef OPENSSL_NO_ENGINE		else if (strcmp(*args, "-engine") == 0) {			if (!args[1])				goto bad;			e = setup_engine(bio_err, *(++args), 0);		}#endif		else if (!strcmp(*args, "-paramfile")) {			if (!args[1])				goto bad;			args++;			if (do_param == 1)				goto bad;			if (!init_keygen_file(bio_err, &ctx, *args, e))				goto end;		} else if (!strcmp(*args, "-out")) {			if (args[1]) {				args++;				outfile = *args;			} else				badarg = 1;		} else if (strcmp(*args, "-algorithm") == 0) {			if (!args[1])				goto bad;			if (!init_gen_str(bio_err, &ctx, *(++args), e, do_param))				goto end;		} else if (strcmp(*args, "-pkeyopt") == 0) {			if (!args[1])				goto bad;			if (!ctx) {				BIO_puts(bio_err, "No keytype specified/n");				goto bad;			} else if (pkey_ctrl_string(ctx, *(++args)) <= 0) {				BIO_puts(bio_err, "parameter setting error/n");				ERR_print_errors(bio_err);				goto end;			}		} else if (strcmp(*args, "-genparam") == 0) {			if (ctx)				goto bad;			do_param = 1;		} else if (strcmp(*args, "-text") == 0)			text = 1;		else {			cipher = EVP_get_cipherbyname(*args + 1);			if (!cipher) {				BIO_printf(bio_err, "Unknown cipher %s/n",				    *args + 1);				badarg = 1;			}			if (do_param == 1)				badarg = 1;		}		args++;	}	if (!ctx)		badarg = 1;	if (badarg) {bad:		BIO_printf(bio_err, "Usage: genpkey [options]/n");		BIO_printf(bio_err, "where options may be/n");		BIO_printf(bio_err, "-out file          output file/n");		BIO_printf(bio_err, "-outform X         output format (DER or PEM)/n");		BIO_printf(bio_err, "-pass arg          output file pass phrase source/n");		BIO_printf(bio_err, "-<cipher>          use cipher <cipher> to encrypt the key/n");//.........这里部分代码省略.........
开发者ID:aburgh,项目名称:openbsd,代码行数:101,



注:本文中的str2fmt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ str2int函数代码示例
C++ str2ba函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。