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

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

51自学网 2021-06-01 19:50:04
  C++
这篇教程C++ BIO_indent函数代码示例写得很实用,希望能帮到您。

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

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

示例1: print_gost_94

/* --------- printing keys --------------------------------*/static int print_gost_94(BIO *out, const EVP_PKEY *pkey, int indent,	ASN1_PCTX *pctx, int type) 	{	int param_nid = NID_undef;	if (type == 2) 		{		BIGNUM *key;		if (!BIO_indent(out,indent,128)) return 0;		BIO_printf(out,"Private key: ");		key = gost_get0_priv_key(pkey);		if (!key) 			BIO_printf(out,"<undefined>");		else 			BN_print(out,key);		BIO_printf(out,"/n");		}	if (type >= 1)		{		BIGNUM *pubkey;				pubkey = ((DSA *)EVP_PKEY_get0((EVP_PKEY *)pkey))->pub_key;		BIO_indent(out,indent,128);		BIO_printf(out,"Public key: ");		BN_print(out,pubkey);		BIO_printf(out,"/n");	}		param_nid = gost94_nid_by_params(EVP_PKEY_get0((EVP_PKEY *)pkey));	BIO_indent(out,indent,128);	BIO_printf(out, "Parameter set: %s/n",OBJ_nid2ln(param_nid));	return 1;}
开发者ID:0culus,项目名称:openssl,代码行数:35,


示例2: print_gost_01

static int print_gost_01(BIO *out, const EVP_PKEY *pkey, int indent,	ASN1_PCTX *pctx, int type)	{	int param_nid = NID_undef;	if (type == 2) 		{		BIGNUM *key;		if (!BIO_indent(out,indent,128)) return 0;		BIO_printf(out,"Private key: ");		key = gost_get0_priv_key(pkey);		if (!key) 			BIO_printf(out,"<undefined)");		else 			BN_print(out,key);		BIO_printf(out,"/n");		}	if (type >= 1) 		{		BN_CTX *ctx = BN_CTX_new();		BIGNUM *X,*Y;		const EC_POINT *pubkey;		const EC_GROUP *group;		if (!ctx) 			{			GOSTerr(GOST_F_PRINT_GOST_01,ERR_R_MALLOC_FAILURE);			return 0;			}		BN_CTX_start(ctx);		X = BN_CTX_get(ctx);		Y = BN_CTX_get(ctx);		pubkey = EC_KEY_get0_public_key((EC_KEY *)EVP_PKEY_get0((EVP_PKEY *)pkey));		group = EC_KEY_get0_group((EC_KEY *)EVP_PKEY_get0((EVP_PKEY *)pkey));		if (!EC_POINT_get_affine_coordinates_GFp(group,pubkey,X,Y,ctx)) 			{			GOSTerr(GOST_F_PRINT_GOST_01,ERR_R_EC_LIB);			BN_CTX_free(ctx);			return 0;			}		if (!BIO_indent(out,indent,128)) return 0;		BIO_printf(out,"Public key:/n");		if (!BIO_indent(out,indent+3,128)) return 0;		BIO_printf(out,"X:");		BN_print(out,X);		BIO_printf(out,"/n");		BIO_indent(out,indent+3,128);		BIO_printf(out,"Y:");		BN_print(out,Y);		BIO_printf(out,"/n");		BN_CTX_end(ctx);		BN_CTX_free(ctx);		}	param_nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(EVP_PKEY_get0((EVP_PKEY *)pkey)));	if (!BIO_indent(out,indent,128)) return 0;	BIO_printf(out,"Parameter set: %s/n",OBJ_nid2ln(param_nid));	return 1;}
开发者ID:0culus,项目名称:openssl,代码行数:59,


示例3: ASN1_bn_print

intASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,    unsigned char *buf, int off){	int n, i;	const char *neg;	if (num == NULL)		return (1);	neg = (BN_is_negative(num)) ? "-" : "";	if (!BIO_indent(bp, off, 128))		return 0;	if (BN_is_zero(num)) {		if (BIO_printf(bp, "%s 0/n", number) <= 0)			return 0;		return 1;	}	if (BN_num_bytes(num) <= BN_BYTES) {		if (BIO_printf(bp, "%s %s%lu (%s0x%lx)/n", number, neg,		    (unsigned long)num->d[0], neg,		    (unsigned long)num->d[0]) <= 0)			return (0);	} else {		buf[0] = 0;		if (BIO_printf(bp, "%s%s", number,		    (neg[0] == '-') ? " (Negative)" : "") <= 0)			return (0);		n = BN_bn2bin(num, &buf[1]);		if (buf[1] & 0x80)			n++;		else			buf++;		for (i = 0; i < n; i++) {			if ((i % 15) == 0) {				if (BIO_puts(bp, "/n") <= 0 ||				    !BIO_indent(bp, off + 4, 128))					return 0;			}			if (BIO_printf(bp, "%02x%s", buf[i],			    ((i + 1) == n) ? "" : ":") <= 0)				return (0);		}		if (BIO_write(bp, "/n", 1) <= 0)			return (0);	}	return (1);}
开发者ID:2trill2spill,项目名称:nextgen,代码行数:50,


示例4: param_print_gost01

static intparam_print_gost01(BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx){	int param_nid =	    EC_GROUP_get_curve_name(GOST_KEY_get0_group(pkey->pkey.gost));	if (BIO_indent(out, indent, 128) == 0)		return 0;	BIO_printf(out, "Parameter set: %s/n", OBJ_nid2ln(param_nid));	if (BIO_indent(out, indent, 128) == 0)		return 0;	BIO_printf(out, "Digest Algorithm: %s/n",	    OBJ_nid2ln(GOST_KEY_get_digest(pkey->pkey.gost)));	return 1;}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:15,


示例5: print_unsupported

static int print_unsupported(BIO *out, const EVP_PKEY *pkey, int indent,                             const char *kstr) {  BIO_indent(out, indent, 128);  BIO_printf(out, "%s algorithm /"%s/" unsupported/n", kstr,             OBJ_nid2ln(pkey->type));  return 1;}
开发者ID:friends110110,项目名称:boringssl,代码行数:7,


示例6: asn1_print_info

static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,                           int indent){    static const char fmt[] = "%-18s";    char str[128];    const char *p;    if (constructed & V_ASN1_CONSTRUCTED)        p = "cons: ";    else        p = "prim: ";    if (BIO_write(bp, p, 6) < 6)        goto err;    BIO_indent(bp, indent, 128);    p = str;    if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE)        BIO_snprintf(str, sizeof str, "priv [ %d ] ", tag);    else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC)        BIO_snprintf(str, sizeof str, "cont [ %d ]", tag);    else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION)        BIO_snprintf(str, sizeof str, "appl [ %d ]", tag);    else if (tag > 30)        BIO_snprintf(str, sizeof str, "<ASN1 %d>", tag);    else        p = ASN1_tag2str(tag);    if (BIO_printf(bp, fmt, p) <= 0)        goto err;    return (1); err:    return (0);}
开发者ID:2007750219,项目名称:openssl,代码行数:33,


示例7: pub_print_gost01

static intpub_print_gost01(BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx){	BN_CTX *ctx = BN_CTX_new();	BIGNUM *X, *Y;	const EC_POINT *pubkey;	const EC_GROUP *group;	if (ctx == NULL) {		GOSTerr(GOST_F_PUB_PRINT_GOST01, ERR_R_MALLOC_FAILURE);		return 0;	}	BN_CTX_start(ctx);	if ((X = BN_CTX_get(ctx)) == NULL)		goto err;	if ((Y = BN_CTX_get(ctx)) == NULL)		goto err;	pubkey = GOST_KEY_get0_public_key(pkey->pkey.gost);	group = GOST_KEY_get0_group(pkey->pkey.gost);	if (EC_POINT_get_affine_coordinates_GFp(group, pubkey, X, Y,	    ctx) == 0) {		GOSTerr(GOST_F_PUB_PRINT_GOST01, ERR_R_EC_LIB);		goto err;	}	if (BIO_indent(out, indent, 128) == 0)		goto err;	BIO_printf(out, "Public key:/n");	if (BIO_indent(out, indent + 3, 128) == 0)		goto err;	BIO_printf(out, "X:");	BN_print(out, X);	BIO_printf(out, "/n");	BIO_indent(out, indent + 3, 128);	BIO_printf(out, "Y:");	BN_print(out, Y);	BIO_printf(out, "/n");	BN_CTX_end(ctx);	BN_CTX_free(ctx);	return param_print_gost01(out, pkey, indent, pctx);err:	BN_CTX_end(ctx);	BN_CTX_free(ctx);	return 0;}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:47,


示例8: print_gost_ec_pub

static int print_gost_ec_pub(BIO *out, const EVP_PKEY *pkey, int indent){    BN_CTX *ctx;    BIGNUM *X, *Y;    const EC_POINT *pubkey;    const EC_GROUP *group;    EC_KEY *key = (EC_KEY *)EVP_PKEY_get0((EVP_PKEY *)pkey);    int ok = 0;    ctx = BN_CTX_new();    if (!ctx) {        GOSTerr(GOST_F_PRINT_GOST_EC_PUB, ERR_R_MALLOC_FAILURE);        return 0;    }    BN_CTX_start(ctx);    X = BN_CTX_get(ctx);    Y = BN_CTX_get(ctx);    pubkey = (key) ? EC_KEY_get0_public_key(key) : NULL;    group = (key) ? EC_KEY_get0_group(key) : NULL;    if (!pubkey || !group)        goto err;    if (!EC_POINT_get_affine_coordinates_GFp(group, pubkey, X, Y, ctx)) {        GOSTerr(GOST_F_PRINT_GOST_EC_PUB, ERR_R_EC_LIB);        goto err;    }    if (!BIO_indent(out, indent, 128))        goto err;    BIO_printf(out, "Public key:/n");    if (!BIO_indent(out, indent + 3, 128))        goto err;    BIO_printf(out, "X:");    BN_print(out, X);    BIO_printf(out, "/n");    if (!BIO_indent(out, indent + 3, 128))        goto err;    BIO_printf(out, "Y:");    BN_print(out, Y);    BIO_printf(out, "/n");    ok = 1; err:    BN_CTX_end(ctx);    BN_CTX_free(ctx);    return ok;}
开发者ID:andbortnik,项目名称:engine,代码行数:47,


示例9: do_dsa_print

static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype){    unsigned char *m=NULL;    int ret=0;    size_t buf_len=0;    const char *ktype = NULL;    const BIGNUM *priv_key, *pub_key;    if (ptype == 2)        priv_key = x->priv_key;    else        priv_key = NULL;    if (ptype > 0)        pub_key = x->pub_key;    else        pub_key = NULL;    if (ptype == 2)        ktype = "Private-Key";    else if (ptype == 1)        ktype = "Public-Key";    else        ktype = "DSA-Parameters";    update_buflen(x->p, &buf_len);    update_buflen(x->q, &buf_len);    update_buflen(x->g, &buf_len);    update_buflen(priv_key, &buf_len);    update_buflen(pub_key, &buf_len);    m=(unsigned char *)OPENSSL_malloc(buf_len+10);    if (m == NULL)    {        DSAerr(DSA_F_DO_DSA_PRINT,ERR_R_MALLOC_FAILURE);        goto err;    }    if (priv_key)    {        if(!BIO_indent(bp,off,128))            goto err;        if (BIO_printf(bp,"%s: (%d bit)/n",ktype, BN_num_bits(x->p))                <= 0) goto err;    }    if (!ASN1_bn_print(bp,"priv:",priv_key,m,off))        goto err;    if (!ASN1_bn_print(bp,"pub: ",pub_key,m,off))        goto err;    if (!ASN1_bn_print(bp,"P:   ",x->p,m,off)) goto err;    if (!ASN1_bn_print(bp,"Q:   ",x->q,m,off)) goto err;    if (!ASN1_bn_print(bp,"G:   ",x->g,m,off)) goto err;    ret=1;err:    if (m != NULL) OPENSSL_free(m);    return(ret);}
开发者ID:Ashod,项目名称:openssl,代码行数:59,


示例10: KA_CTX_print_private

static intKA_CTX_print_private(BIO *out, const KA_CTX *ctx, int indent){    if (ctx) {        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "Key Agreement Parameters:/n"))            return 0;        if (ctx->key)            if (ctx->shared_secret) {                /* If we have a shared secret, we also must have a private key                 * which we can print. This is a bit clumsy but unfortunately                 * OpenSSL doesn't offer a function to check whether or not an                 * EVP_PKEY contains a private key. */                if (!EVP_PKEY_print_private(out, ctx->key, indent+4, NULL))                    return 0;            } else {                if (!EVP_PKEY_print_params(out, ctx->key, indent+4, NULL))                    return 0;            }            else {                if (!BIO_indent(out, indent+4, 80)                        || !BIO_printf(out, "<ABSENT>/n"))                    return 0;            }        if (!BIO_indent(out, indent, 80))            return 0;        if (ctx->cipher) {            if (!BIO_printf(out, "Cipher: %s/n", EVP_CIPHER_name(ctx->cipher)))                return 0;        } else if (!BIO_printf(out, "Cipher: %s/n", "<ABSENT>"))            return 0;        if (!BIO_indent(out, indent, 80))            return 0;        if (ctx->md) {            if (!BIO_printf(out, "Message Digest: %s/n", EVP_MD_name(ctx->md)))                return 0;        } else if (!BIO_printf(out, "Message Digest: %s/n", "<ABSENT>"))                    return 0;        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "Shared Secret:/n")                || !BUF_MEM_print(out, ctx->shared_secret, indent+4)                || !BIO_indent(out, indent, 80)                || !BIO_printf(out, "K_enc:/n")                || !BUF_MEM_print(out, ctx->k_enc, indent+4)                || !BIO_indent(out, indent, 80)                || !BIO_printf(out, "K_mac:/n")                || !BUF_MEM_print(out, ctx->k_mac, indent+4))            return 0;    } else {        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "<ABSENT>/n"))            return 0;    }    return 1;}
开发者ID:d0,项目名称:openpace,代码行数:55,


示例11: ssl_print_random

static int ssl_print_random(BIO *bio, int indent,				const unsigned char **pmsg, size_t *pmsglen)	{	unsigned int tm;	const unsigned char *p = *pmsg;	if (*pmsglen < 32)		return 0;	tm = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];	p += 4;	BIO_indent(bio, indent, 80);	BIO_puts(bio, "Random:/n");	BIO_indent(bio, indent + 2, 80);	BIO_printf(bio, "gmt_unix_time=0x%08X/n", tm);	ssl_print_hex(bio, indent + 2, "random_bytes", p, 28);	*pmsg += 32;	*pmsglen -= 32;	return 1;	}
开发者ID:bsnote,项目名称:openssl,代码行数:18,


示例12: do_dsa_print

static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype) {  uint8_t *m = NULL;  int ret = 0;  size_t buf_len = 0;  const char *ktype = NULL;  const BIGNUM *priv_key, *pub_key;  priv_key = NULL;  if (ptype == 2) {    priv_key = x->priv_key;  }  pub_key = NULL;  if (ptype > 0) {    pub_key = x->pub_key;  }  ktype = "DSA-Parameters";  if (ptype == 2) {    ktype = "Private-Key";  } else if (ptype == 1) {    ktype = "Public-Key";  }  update_buflen(x->p, &buf_len);  update_buflen(x->q, &buf_len);  update_buflen(x->g, &buf_len);  update_buflen(priv_key, &buf_len);  update_buflen(pub_key, &buf_len);  m = (uint8_t *)OPENSSL_malloc(buf_len + 10);  if (m == NULL) {    OPENSSL_PUT_ERROR(EVP, ERR_R_MALLOC_FAILURE);    goto err;  }  if (priv_key) {    if (!BIO_indent(bp, off, 128) ||        BIO_printf(bp, "%s: (%d bit)/n", ktype, BN_num_bits(x->p)) <= 0) {      goto err;    }  }  if (!ASN1_bn_print(bp, "priv:", priv_key, m, off) ||      !ASN1_bn_print(bp, "pub: ", pub_key, m, off) ||      !ASN1_bn_print(bp, "P:   ", x->p, m, off) ||      !ASN1_bn_print(bp, "Q:   ", x->q, m, off) ||      !ASN1_bn_print(bp, "G:   ", x->g, m, off)) {    goto err;  }  ret = 1;err:  OPENSSL_free(m);  return ret;}
开发者ID:bheesham,项目名称:boringssl,代码行数:57,


示例13: ssl_print_hex

static void ssl_print_hex(BIO *bio, int indent, const char *name,				const unsigned char *msg, size_t msglen)	{	size_t i;	BIO_indent(bio, indent, 80);	BIO_printf(bio, "%s (len=%d): ", name, (int)msglen);	for (i = 0; i < msglen; i++)		BIO_printf(bio, "%02X", msg[i]);	BIO_puts(bio, "/n");	}
开发者ID:bsnote,项目名称:openssl,代码行数:10,


示例14: PACE_SEC_print_private

intPACE_SEC_print_private(BIO *out, const PACE_SEC *sec, int indent){    const char *s;    if (sec) {        switch (sec->type) {            case PACE_RAW:                s = raw_str;                break;            case PACE_PIN:                s = pin_str;                break;            case PACE_PUK:                s = puk_str;                break;            case PACE_CAN:                s = can_str;                break;            case PACE_MRZ:                s = mrz_str;                break;            case PACE_SEC_UNDEF:                /* fall through */            default:                s = undef_str;                break;        }        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "%s/n", s)                || !BIO_indent(out, indent, 80)                || !BIO_printf(out, "Secret:/n")                || !BUF_MEM_print(out, sec->mem, indent)                || !BIO_indent(out, indent, 80)                || !BIO_printf(out, "Encoded Secret:/n")                || !BUF_MEM_print(out, sec->encoded, indent))            return 0;    } else {        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "<ABSENT>/n"))            return 0;    }    return 1;}
开发者ID:d0,项目名称:openpace,代码行数:43,


示例15: CA_CTX_print_private

static intCA_CTX_print_private(BIO *out, const CA_CTX *ctx, int indent){    if (ctx) {        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "keyID: 0x%02X/n", ctx->id)                || !BIO_indent(out, indent, 80)                || !BIO_printf(out, "OID: %s/n", OBJ_nid2sn(ctx->protocol))                || !BIO_indent(out, indent, 80)                || !BIO_printf(out, "Version: %d/n", ctx->version)                || !BIO_indent(out, indent, 80)                || !BIO_printf(out, "PICC's Static Domain Parameters:/n")                || !KA_CTX_print_private(out, ctx->ka_ctx, indent+4))            return 0;    } else {        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "<ABSENT>/n"))            return 0;    }    return 1;}
开发者ID:d0,项目名称:openpace,代码行数:21,


示例16: DSA_print

int DSA_print(BIO *bp, const DSA *x, int off)	{	unsigned char *m=NULL;	int ret=0;	size_t buf_len=0,i;	if (x->p)		buf_len = (size_t)BN_num_bytes(x->p);	else		{		DSAerr(DSA_F_DSA_PRINT,DSA_R_MISSING_PARAMETERS);		goto err;		}	if (x->q)		if (buf_len < (i = (size_t)BN_num_bytes(x->q)))			buf_len = i;	if (x->g)		if (buf_len < (i = (size_t)BN_num_bytes(x->g)))			buf_len = i;	if (x->priv_key)		if (buf_len < (i = (size_t)BN_num_bytes(x->priv_key)))			buf_len = i;	if (x->pub_key)		if (buf_len < (i = (size_t)BN_num_bytes(x->pub_key)))			buf_len = i;	m=(unsigned char *)OPENSSL_malloc(buf_len+10);	if (m == NULL)		{		DSAerr(DSA_F_DSA_PRINT,ERR_R_MALLOC_FAILURE);		goto err;		}	if (x->priv_key != NULL)		{		if(!BIO_indent(bp,off,128))		   goto err;		if (BIO_printf(bp,"Private-Key: (%d bit)/n",BN_num_bits(x->p))			<= 0) goto err;		}	if ((x->priv_key != NULL) && !print(bp,"priv:",x->priv_key,m,off))		goto err;	if ((x->pub_key  != NULL) && !print(bp,"pub: ",x->pub_key,m,off))		goto err;	if ((x->p != NULL) && !print(bp,"P:   ",x->p,m,off)) goto err;	if ((x->q != NULL) && !print(bp,"Q:   ",x->q,m,off)) goto err;	if ((x->g != NULL) && !print(bp,"G:   ",x->g,m,off)) goto err;	ret=1;err:	if (m != NULL) OPENSSL_free(m);	return(ret);	}
开发者ID:imgits,项目名称:rkanalyzer,代码行数:53,


示例17: BUF_MEM_print

intBUF_MEM_print(BIO *out, const BUF_MEM *buf, int indent){    if (buf) {        if (!BIO_dump_indent(out, buf->data, buf->length, indent))            return 0;    } else {        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "<ABSENT>/n"))            return 0;    }    return 1;}
开发者ID:d0,项目名称:openpace,代码行数:13,


示例18: ssl_print_version

static int ssl_print_version(BIO *bio, int indent, const char *name,                             const unsigned char **pmsg, size_t *pmsglen){    int vers;    if (*pmsglen < 2)        return 0;    vers = ((*pmsg)[0] << 8) | (*pmsg)[1];    BIO_indent(bio, indent, 80);    BIO_printf(bio, "%s=0x%x (%s)/n",               name, vers, ssl_trace_str(vers, ssl_version_tbl));    *pmsg += 2;    *pmsglen -= 2;    return 1;}
开发者ID:ZuyingWo,项目名称:openssl,代码行数:14,


示例19: ASN1_bn_print

int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,                  unsigned char *ign, int indent){    int n, rv = 0;    const char *neg;    unsigned char *buf = NULL, *tmp = NULL;    int buflen;    if (num == NULL)        return 1;    neg = BN_is_negative(num) ? "-" : "";    if (!BIO_indent(bp, indent, ASN1_PRINT_MAX_INDENT))        return 0;    if (BN_is_zero(num)) {        if (BIO_printf(bp, "%s 0/n", number) <= 0)            return 0;        return 1;    }    if (BN_num_bytes(num) <= BN_BYTES) {        if (BIO_printf(bp, "%s %s%lu (%s0x%lx)/n", number, neg,                       (unsigned long)bn_get_words(num)[0], neg,                       (unsigned long)bn_get_words(num)[0]) <= 0)            return 0;        return 1;    }    buflen = BN_num_bytes(num) + 1;    buf = tmp = OPENSSL_malloc(buflen);    if (buf == NULL)        goto err;    buf[0] = 0;    if (BIO_printf(bp, "%s%s/n", number,                   (neg[0] == '-') ? " (Negative)" : "") <= 0)        goto err;    n = BN_bn2bin(num, buf + 1);    if (buf[1] & 0x80)        n++;    else        tmp++;    if (ASN1_buf_print(bp, tmp, n, indent + 4) == 0)        goto err;    rv = 1;err:    OPENSSL_clear_free(buf, buflen);    return rv;}
开发者ID:mtrojnar,项目名称:openssl,代码行数:49,


示例20: EAC_CTX_print_private

intEAC_CTX_print_private(BIO *out, const EAC_CTX *ctx, int indent){    if (ctx) {        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "%d Context%s for PACE (default has parameterID 0x%02X)/n",                    sk_num((_STACK*) ctx->pace_ctxs),                    sk_num((_STACK*) ctx->pace_ctxs) > 1 ? "s" : "",                    ctx->pace_ctx ? ctx->pace_ctx->id : -1))            return 0;        stack_print_private(PACE_CTX, out, ctx->pace_ctxs, indent+4);        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "Context for TA/n")                || !TA_CTX_print_private(out, ctx->ta_ctx, indent+4)                || !BIO_indent(out, indent, 80)                || !BIO_printf(out, "%d Context%s for CA (default has keyID 0x%02X)/n",                    sk_num((_STACK*) ctx->ca_ctxs),                    sk_num((_STACK*) ctx->ca_ctxs) > 1 ? "s" : "",                    ctx->ca_ctx ? ctx->ca_ctx->id : -1))            return 0;        stack_print_private(CA_CTX, out, ctx->ca_ctxs, indent+4);        if (!BIO_indent(out, indent, 80)                /* FIXME segfaults for me */                || !BIO_printf(out, "%d Context%s for RI (default has keyID 0x%02X)/n",                    sk_num((_STACK*) ctx->ri_ctxs),                    sk_num((_STACK*) ctx->ri_ctxs) > 1 ? "s" : "",                    ctx->ri_ctx ? ctx->ri_ctx->id : -1))            return 0;        stack_print_private(RI_CTX, out, ctx->ri_ctxs, indent);    } else {        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "<ABSENT>/n"))            return 0;    }    return 1;}
开发者ID:d0,项目名称:openpace,代码行数:36,


示例21: print_gost_ec_param

static int print_gost_ec_param(BIO *out, const EVP_PKEY *pkey, int indent){    EC_KEY *ec = EVP_PKEY_get0((EVP_PKEY *)pkey);    const EC_GROUP *group = (ec) ? EC_KEY_get0_group(ec) : NULL;    int param_nid;    if (!group)        return 0;    param_nid = EC_GROUP_get_curve_name(group);    if (!BIO_indent(out, indent, 128))        return 0;    BIO_printf(out, "Parameter set: %s/n", OBJ_nid2ln(param_nid));    return 1;}
开发者ID:andbortnik,项目名称:engine,代码行数:16,


示例22: print_gost_priv

/* --------- printing keys --------------------------------*/static int print_gost_priv(BIO *out, const EVP_PKEY *pkey, int indent){    BIGNUM *key;    if (!BIO_indent(out, indent, 128))        return 0;    BIO_printf(out, "Private key: ");    key = gost_get0_priv_key(pkey);    if (!key)        BIO_printf(out, "<undefined>");    else        BN_print(out, key);    BIO_printf(out, "/n");    return 1;}
开发者ID:andbortnik,项目名称:engine,代码行数:17,


示例23: ssl_print_signature

static int ssl_print_signature(BIO *bio, int indent, SSL *s,                               const unsigned char **pmsg, size_t *pmsglen){    if (*pmsglen < 2)        return 0;    if (SSL_USE_SIGALGS(s)) {        const unsigned char *p = *pmsg;        BIO_indent(bio, indent, 80);        BIO_printf(bio, "Signature Algorithm %s+%s (%d+%d)/n",                   ssl_trace_str(p[0], ssl_md_tbl),                   ssl_trace_str(p[1], ssl_sig_tbl), p[0], p[1]);        *pmsg += 2;        *pmsglen -= 2;    }    return ssl_print_hexbuf(bio, indent, "Signature", 2, pmsg, pmsglen);}
开发者ID:ZuyingWo,项目名称:openssl,代码行数:16,


示例24: priv_print_gost01

static intpriv_print_gost01(BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx){	const BIGNUM *key;	if (BIO_indent(out, indent, 128) == 0)		return 0;	BIO_printf(out, "Private key: ");	key = GOST_KEY_get0_private_key(pkey->pkey.gost);	if (key == NULL)		BIO_printf(out, "<undefined)");	else		BN_print(out, key);	BIO_printf(out, "/n");	return pub_print_gost01(out, pkey, indent, pctx);}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:17,


示例25: do_dsa_print

static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype){    int ret = 0;    const char *ktype = NULL;    const BIGNUM *priv_key, *pub_key;    if (ptype == 2)        priv_key = x->priv_key;    else        priv_key = NULL;    if (ptype > 0)        pub_key = x->pub_key;    else        pub_key = NULL;    if (ptype == 2)        ktype = "Private-Key";    else if (ptype == 1)        ktype = "Public-Key";    else        ktype = "DSA-Parameters";    if (priv_key) {        if (!BIO_indent(bp, off, 128))            goto err;        if (BIO_printf(bp, "%s: (%d bit)/n", ktype, BN_num_bits(x->p))            <= 0)            goto err;    }    if (!ASN1_bn_print(bp, "priv:", priv_key, NULL, off))        goto err;    if (!ASN1_bn_print(bp, "pub: ", pub_key, NULL, off))        goto err;    if (!ASN1_bn_print(bp, "P:   ", x->p, NULL, off))        goto err;    if (!ASN1_bn_print(bp, "Q:   ", x->q, NULL, off))        goto err;    if (!ASN1_bn_print(bp, "G:   ", x->g, NULL, off))        goto err;    ret = 1; err:    return ret;}
开发者ID:akamai,项目名称:openssl,代码行数:45,


示例26: do_rsa_print

static int do_rsa_print(BIO *bp, const RSA *x, int off, int priv){    char *str;    const char *s;    int ret = 0, mod_len = 0;    if (x->n != NULL)        mod_len = BN_num_bits(x->n);    if (!BIO_indent(bp, off, 128))        goto err;    if (priv && x->d) {        if (BIO_printf(bp, "Private-Key: (%d bit)/n", mod_len) <= 0)            goto err;        str = "modulus:";        s = "publicExponent:";    } else {        if (BIO_printf(bp, "Public-Key: (%d bit)/n", mod_len) <= 0)            goto err;        str = "Modulus:";        s = "Exponent:";    }    if (!ASN1_bn_print(bp, str, x->n, NULL, off))        goto err;    if (!ASN1_bn_print(bp, s, x->e, NULL, off))        goto err;    if (priv) {        if (!ASN1_bn_print(bp, "privateExponent:", x->d, NULL, off))            goto err;        if (!ASN1_bn_print(bp, "prime1:", x->p, NULL, off))            goto err;        if (!ASN1_bn_print(bp, "prime2:", x->q, NULL, off))            goto err;        if (!ASN1_bn_print(bp, "exponent1:", x->dmp1, NULL, off))            goto err;        if (!ASN1_bn_print(bp, "exponent2:", x->dmq1, NULL, off))            goto err;        if (!ASN1_bn_print(bp, "coefficient:", x->iqmp, NULL, off))            goto err;    }    ret = 1; err:    return (ret);}
开发者ID:Astel,项目名称:openssl,代码行数:45,


示例27: do_ssl_trace_list

static int do_ssl_trace_list(BIO *bio, int indent,                             const unsigned char *msg, size_t msglen,                             size_t vlen, ssl_trace_tbl *tbl, size_t ntbl){    int val;    if (msglen % vlen)        return 0;    while (msglen) {        val = msg[0];        if (vlen == 2)            val = (val << 8) | msg[1];        BIO_indent(bio, indent, 80);        BIO_printf(bio, "%s (%d)/n", do_ssl_trace_str(val, tbl, ntbl), val);        msg += vlen;        msglen -= vlen;    }    return 1;}
开发者ID:ZuyingWo,项目名称:openssl,代码行数:18,


示例28: X509_signature_dump

int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent){	const unsigned char *s;	int i, n;	n=sig->length;	s=sig->data;	for (i=0; i<n; i++)		{		if ((i%18) == 0)			{			if (BIO_write(bp,"/n",1) <= 0) return 0;			if (BIO_indent(bp, indent, indent) <= 0) return 0;			}			if (BIO_printf(bp,"%02x%s",s[i],				((i+1) == n)?"":":") <= 0) return 0;		}	if (BIO_write(bp,"/n",1) != 1) return 0;	return 1;}
开发者ID:piaoasd123,项目名称:ServerTest,代码行数:21,


示例29: PACE_CTX_print_private

static intPACE_CTX_print_private(BIO *out, const PACE_CTX *ctx, int indent){    if (ctx) {        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "parameterID: 0x%02X/n", ctx->id)                || !BIO_indent(out, indent, 80)                || !BIO_printf(out, "OID: %s/n", OBJ_nid2sn(ctx->protocol))                || !BIO_indent(out, indent, 80)                || !BIO_printf(out, "Version: %d/n", ctx->version)                || !BIO_indent(out, indent, 80)                || !BIO_printf(out, "PICC's Static Domain Parameters:/n"))            return 0;        if (ctx->static_key) {            if (!EVP_PKEY_print_params(out, ctx->static_key, indent+4, NULL))                return 0;            else {                if (!BIO_indent(out, indent+4, 80)                        || !BIO_printf(out, "<ABSENT>/n"))                    return 0;            }        }        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "Nonce:/n")                || !BUF_MEM_print(out, ctx->nonce, indent+4)                || !BIO_indent(out, indent, 80)                || !BIO_printf(out, "Ephemeral Domain Parameters:/n")                || !KA_CTX_print_private(out, ctx->ka_ctx, indent+4))            return 0;    } else {        if (!BIO_indent(out, indent, 80)                || !BIO_printf(out, "<ABSENT>/n"))            return 0;    }    return 1;}
开发者ID:d0,项目名称:openpace,代码行数:36,



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


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