• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ BIO_indent函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了BIO_indent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:gost_ameth.c


示例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,代码来源:gost_ameth.c


示例3: ASN1_bn_print

int
ASN1_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,代码来源:t_pkey.c


示例4: param_print_gost01

static int
param_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,代码来源:gostr341001_ameth.c


示例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,代码来源:evp.c


示例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,代码来源:asn1_par.c


示例7: pub_print_gost01

static int
pub_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,代码来源:gostr341001_ameth.c


示例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,代码来源:gost_ameth.c


示例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,代码来源:dsa_ameth.c


示例10: KA_CTX_print_private

static int
KA_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,代码来源:eac_print.c


示例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,代码来源:t1_trce.c


示例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,代码来源:p_dsa_asn1.c


示例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,代码来源:t1_trce.c


示例14: PACE_SEC_print_private

int
PACE_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,代码来源:eac_print.c


示例15: CA_CTX_print_private

static int
CA_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,代码来源:eac_print.c


示例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,代码来源:t_pkey.c


示例17: BUF_MEM_print

int
BUF_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,代码来源:eac_print.c


示例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,代码来源:t1_trce.c


示例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,代码来源:t_pkey.c


示例20: EAC_CTX_print_private

int
EAC_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,代码来源:eac_print.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BIO_new函数代码示例发布时间:2022-05-30
下一篇:
C++ BIO_gets函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap