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

C++ OBJ_nid2ln函数代码示例

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

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



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

示例1: NETSCAPE_SPKI_print

int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki)
{
	EVP_PKEY *pkey;
	ASN1_IA5STRING *chal;
	int i, n;
	char *s;
	BIO_printf(out, "Netscape SPKI:\n");
	i=OBJ_obj2nid(spki->spkac->pubkey->algor->algorithm);
	BIO_printf(out,"  Public Key Algorithm: %s\n",
				(i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i));
	pkey = X509_PUBKEY_get(spki->spkac->pubkey);
	if(!pkey) BIO_printf(out, "  Unable to load public key\n");
	else {
#ifndef OPENSSL_NO_RSA
		if (pkey->type == EVP_PKEY_RSA)
			{
			BIO_printf(out,"  RSA Public Key: (%d bit)\n",
				BN_num_bits(pkey->pkey.rsa->n));
			RSA_print(out,pkey->pkey.rsa,2);
			}
		else 
#endif
#ifndef OPENSSL_NO_DSA
		if (pkey->type == EVP_PKEY_DSA)
		{
		BIO_printf(out,"  DSA Public Key:\n");
		DSA_print(out,pkey->pkey.dsa,2);
		}
		else
#endif
#ifndef OPENSSL_NO_EC
		if (pkey->type == EVP_PKEY_EC)
		{
			BIO_printf(out, "  EC Public Key:\n");
			EC_KEY_print(out, pkey->pkey.ec,2);
		}
		else
#endif

			BIO_printf(out,"  Unknown Public Key:\n");
		EVP_PKEY_free(pkey);
	}
	chal = spki->spkac->challenge;
	if(chal->length)
		BIO_printf(out, "  Challenge String: %s\n", chal->data);
	i=OBJ_obj2nid(spki->sig_algor->algorithm);
	BIO_printf(out,"  Signature Algorithm: %s",
				(i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i));

	n=spki->signature->length;
	s=(char *)spki->signature->data;
	for (i=0; i<n; i++)
		{
		if ((i%18) == 0) BIO_write(out,"\n      ",7);
		BIO_printf(out,"%02x%s",(unsigned char)s[i],
						((i+1) == n)?"":":");
		}
	BIO_write(out,"\n",1);
	return 1;
}
开发者ID:RafaelRMachado,项目名称:MinnowBoard,代码行数:60,代码来源:t_spki.c


示例2: EVP_add_digest

int EVP_add_digest(const EVP_MD *md)
{
    int r;
    const char *name;
    OPENSSL_init();

    name = OBJ_nid2sn(md->type);
    r = OBJ_NAME_add(name, OBJ_NAME_TYPE_MD_METH, (const char *)md);
    if (r == 0)
        return (0);
    check_defer(md->type);
    r = OBJ_NAME_add(OBJ_nid2ln(md->type), OBJ_NAME_TYPE_MD_METH,
                     (const char *)md);
    if (r == 0)
        return (0);

    if (md->pkey_type && md->type != md->pkey_type) {
        r = OBJ_NAME_add(OBJ_nid2sn(md->pkey_type),
                         OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS, name);
        if (r == 0)
            return (0);
        check_defer(md->pkey_type);
        r = OBJ_NAME_add(OBJ_nid2ln(md->pkey_type),
                         OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS, name);
    }
    return (r);
}
开发者ID:03050903,项目名称:godot,代码行数:27,代码来源:names.c


示例3: check_nid

static int check_nid(const char *name, int expected_nid, int nid)
{
    if (expected_nid == 0 || expected_nid == nid)
        return 1;
    TEST_error("%s type mismatch, %s vs %s\n",
               name, OBJ_nid2ln(expected_nid),
               nid == NID_undef ? "absent" : OBJ_nid2ln(nid));
    return 0;
}
开发者ID:Lukasa,项目名称:openssl,代码行数:9,代码来源:ssl_test.c


示例4: check_tmp_key

static int check_tmp_key(HANDSHAKE_RESULT *result, SSL_TEST_CTX *test_ctx)
{
    if (test_ctx->expected_tmp_key_type == 0
            || test_ctx->expected_tmp_key_type == result->tmp_key_type)
        return 1;
    fprintf(stderr, "Tmp key type mismatch, %s vs %s\n",
            OBJ_nid2ln(test_ctx->expected_tmp_key_type),
            OBJ_nid2ln(result->tmp_key_type));
    return 0;
}
开发者ID:openssl,项目名称:openssl,代码行数:10,代码来源:ssl_test.c


示例5: dbheader

dbheaderList db_x509req::getHeaders()
{
	dbheaderList h = db_x509super::getHeaders();
	h <<	new dbheader(HD_req_signed, true, tr("Signed"),
			tr("whether the request is already signed or not")) <<
		new dbheader(HD_req_unstr_name, false, tr("Unstructured name"),
			QString(OBJ_nid2ln(NID_pkcs9_unstructuredName))) <<
		new dbheader(HD_req_chall_pass, false, tr("Challenge password"),
			 QString(OBJ_nid2ln(NID_pkcs9_challengePassword)));
	return h;
}
开发者ID:bizonix,项目名称:xca,代码行数:11,代码来源:db_x509req.cpp


示例6: dbheader

db_x509req::db_x509req(QString DBfile, MainWindow *mw)
	:db_x509super(DBfile, mw)
{
	allHeaders << new dbheader(HD_req_signed, true, tr("Signed"),
			tr("whether the request is already signed or not")) <<
		new dbheader(HD_req_unstr_name, false, tr("Unstructured name"),
			QString(OBJ_nid2ln(NID_pkcs9_unstructuredName))) <<
		new dbheader(HD_req_chall_pass, false, tr("Challenge password"),
			 QString(OBJ_nid2ln(NID_pkcs9_challengePassword)));
	class_name = "requests";
	pkitype << x509_req;
	loadContainer();
}
开发者ID:jbfavre,项目名称:xca,代码行数:13,代码来源:db_x509req.cpp


示例7: 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


示例8: 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


示例9: main

int main(int argc, char **argv) {
    ASN1_OBJECT *obj = NULL;
    int tmp_size = 0;
    int oid_len = 0;
    if (argc < 2) {
        usage(argv[0]);
        return 0;
    }
    char *oid = NULL;
    char *sn = NULL;
    char *ln = NULL;
    oid = (char *) malloc(STRSIZE + 1);
    if (oid == NULL) {
        printf("Error allocating %i bytes for oid string\n", STRSIZE + 1);
    }
    oid[STRSIZE] = '\0';
    int nid = atoi(argv[1]);
    printf("searching for nid shortname for %i\n", nid);
    sn = (char *) OBJ_nid2sn(nid);
    ln = (char *) OBJ_nid2ln(nid);
    obj = OBJ_nid2obj(nid);
    if (obj != NULL) {
        oid_len = OBJ_obj2txt(oid, STRSIZE, obj, 1);
        if (oid_len > 0) {
            oid[oid_len] = '\0';
        } else {
            strncpy(oid, "Unkown", STRSIZE);
        }
    } else {
        oid = strncpy(oid, "Unknown", STRSIZE);
    }
    printf("sb=\"%s\" ln=\"%s\" oid=\"%s\"\n", sn, ln, oid);
    free(oid);
    return 0;
}
开发者ID:crc32a,项目名称:test_sni,代码行数:35,代码来源:nid2sn.c


示例10: test_tbl_standard

static int test_tbl_standard(void)
{
    const ASN1_STRING_TABLE *tmp;
    int last_nid = -1;
    size_t i;

    for (tmp = tbl_standard, i = 0; i < OSSL_NELEM(tbl_standard); i++, tmp++) {
        if (tmp->nid < last_nid) {
            last_nid = 0;
            break;
        }
        last_nid = tmp->nid;
    }

    if (TEST_int_ne(last_nid, 0)) {
        TEST_info("asn1 tbl_standard: Table order OK");
        return 1;
    }

    TEST_info("asn1 tbl_standard: out of order");
    for (tmp = tbl_standard, i = 0; i < OSSL_NELEM(tbl_standard); i++, tmp++)
        TEST_note("asn1 tbl_standard: Index %zu, NID %d, Name=%s",
                  i, tmp->nid, OBJ_nid2ln(tmp->nid));

    return 0;
}
开发者ID:IIJ-NetBSD,项目名称:netbsd-src,代码行数:26,代码来源:asn1_internal_test.c


示例11: IoObject_new

IoObject *IoCertificate_attributes(IoCertificate *self, IoObject *locals, IoMessage *m)
{
	IoObject *map = IoObject_new(IoObject_state(self));
	const EVP_PKEY *pkey = X509_extract_key(X509(self));
	int i;
	for(i = 0; i < EVP_PKEY_get_attr_count(pkey); i++)
	{
		IoList *list = IoList_new(IoObject_state(self));
		X509_ATTRIBUTE *attr = EVP_PKEY_get_attr(pkey, i);
		const char *key = (const char *)OBJ_nid2ln(OBJ_obj2nid(X509_ATTRIBUTE_get0_object(attr)));
		int j;
		for(j = 0; j < X509_ATTRIBUTE_count(attr); j++)
		{
			ASN1_TYPE *attrType = X509_ATTRIBUTE_get0_type(attr, j);
			ASN1_OBJECT *attrData = X509_ATTRIBUTE_get0_data(attr, j, attrType->type, NULL);
			//consider switching on attrType instead; 
			//really, that would be wiser, so that dates, 
			//numbers, etc can be happy
			/*
			switch(attrType->type) {
				case V_ASN1_OCTET_STRING:
			...
			*/
			int len = i2t_ASN1_OBJECT(NULL, 0, attrData);
			char *value = calloc(len, sizeof(char));
			i2t_ASN1_OBJECT(value, len, attrData);
			IoList_rawAppend_(list, IoSeq_newWithCString_(IoObject_state(self), value));
		}
		IoObject_setSlot_to_(map, IOSYMBOL(key), list);
	}
	return map;
}
开发者ID:anthem,项目名称:io,代码行数:32,代码来源:IoCertificate.c


示例12: main

int main(int argc, char **argv)
{
	X509 *cert;
	FILE *inf;
	int i, count;
	X509_EXTENSION *ext;
	X509V3_add_standard_extensions();
	ERR_load_crypto_strings();
	if(!argv[1]) {
		fprintf(stderr, "Usage v3prin cert.pem\n");
		exit(1);
	}
	if(!(inf = fopen(argv[1], "r"))) {
		fprintf(stderr, "Can't open %s\n", argv[1]);
		exit(1);
	}
	if(!(cert = PEM_read_X509(inf, NULL, NULL))) {
		fprintf(stderr, "Can't read certificate %s\n", argv[1]);
		ERR_print_errors_fp(stderr);
		exit(1);
	}
	fclose(inf);
	count = X509_get_ext_count(cert);
	printf("%d extensions\n", count);
	for(i = 0; i < count; i++) {
		ext = X509_get_ext(cert, i);
		printf("%s\n", OBJ_nid2ln(OBJ_obj2nid(ext->object)));
		if(!X509V3_EXT_print_fp(stdout, ext, 0, 0)) ERR_print_errors_fp(stderr);
		printf("\n");
		
	}
	return 0;
}
开发者ID:0culus,项目名称:openssl,代码行数:33,代码来源:v3prin.c


示例13: main

main()
{
	ASN1_STRING_TABLE *tmp;
	int i, last_nid = -1;

	for (tmp = tbl_standard, i = 0;
		i < sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE); i++, tmp++)
		{
			if (tmp->nid < last_nid)
				{
				last_nid = 0;
				break;
				}
			last_nid = tmp->nid;
		}

	if (last_nid != 0)
		{
		printf("Table order OK\n");
		exit(0);
		}

	for (tmp = tbl_standard, i = 0;
		i < sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE); i++, tmp++)
			printf("Index %d, NID %d, Name=%s\n", i, tmp->nid,
							OBJ_nid2ln(tmp->nid));

}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:28,代码来源:a_strnid.c


示例14: test_pkey_meths

/* Test of EVP_PKEY_METHOD ordering */
static int test_pkey_meths(void)
{
    size_t i;
    int prev = -1;
    int good = 1;
    int pkey_id;
    const EVP_PKEY_METHOD *pmeth;

    for (i = 0; i < EVP_PKEY_meth_get_count(); i++) {
        pmeth = EVP_PKEY_meth_get0(i);
        EVP_PKEY_meth_get0_info(&pkey_id, NULL, pmeth);
        if (pkey_id < prev)
            good = 0;
        prev = pkey_id;

    }
    if (!good) {
        TEST_error("EVP_PKEY_METHOD table out of order");
        for (i = 0; i < EVP_PKEY_meth_get_count(); i++) {
            pmeth = EVP_PKEY_meth_get0(i);
            EVP_PKEY_meth_get0_info(&pkey_id, NULL, pmeth);
            TEST_note("%d : %s", pkey_id, OBJ_nid2ln(pkey_id));
        }
    }
    return good;
}
开发者ID:IIJ-NetBSD,项目名称:netbsd-src,代码行数:27,代码来源:pkey_meth_test.c


示例15: d2i_X509_PKEY

X509_PKEY *
d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp, long length)
{
	int i;
	M_ASN1_D2I_vars(a, X509_PKEY *, X509_PKEY_new);

	M_ASN1_D2I_Init();
	M_ASN1_D2I_start_sequence();
	M_ASN1_D2I_get_x(X509_ALGOR, ret->enc_algor, d2i_X509_ALGOR);
	M_ASN1_D2I_get_x(ASN1_OCTET_STRING, ret->enc_pkey,
	    d2i_ASN1_OCTET_STRING);

	ret->cipher.cipher = EVP_get_cipherbyname(
	    OBJ_nid2ln(OBJ_obj2nid(ret->enc_algor->algorithm)));
	if (ret->cipher.cipher == NULL) {
		c.error = ASN1_R_UNSUPPORTED_CIPHER;
		c.line = __LINE__;
		goto err;
	}
	if (ret->enc_algor->parameter->type == V_ASN1_OCTET_STRING) {
		i = ret->enc_algor->parameter->value.octet_string->length;
		if (i > EVP_MAX_IV_LENGTH) {
			c.error = ASN1_R_IV_TOO_LARGE;
			c.line = __LINE__;
			goto err;
		}
		memcpy(ret->cipher.iv,
		    ret->enc_algor->parameter->value.octet_string->data, i);
	} else
		memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH);
	M_ASN1_D2I_Finish(a, X509_PKEY_free, ASN1_F_D2I_X509_PKEY);
}
开发者ID:DiamondLovesYou,项目名称:libressl-pnacl-sys,代码行数:32,代码来源:x_pkey.c


示例16: test_tbl_standard

static int test_tbl_standard()
{
    const ASN1_STRING_TABLE *tmp;
    int last_nid = -1;
    size_t i;

    for (tmp = tbl_standard, i = 0; i < OSSL_NELEM(tbl_standard); i++, tmp++) {
        if (tmp->nid < last_nid) {
            last_nid = 0;
            break;
        }
        last_nid = tmp->nid;
    }

    if (last_nid != 0) {
        fprintf(stderr, "asn1 tbl_standard: Table order OK\n");
        return 1;
    }

    for (tmp = tbl_standard, i = 0; i < OSSL_NELEM(tbl_standard); i++, tmp++)
        fprintf(stderr, "asn1 tbl_standard: Index %" OSSLzu ", NID %d, Name=%s\n",
                i, tmp->nid, OBJ_nid2ln(tmp->nid));

    return 0;
}
开发者ID:quanah,项目名称:openssl,代码行数:25,代码来源:asn1_internal_test.c


示例17: test_asn1_meths

/* Test of EVP_PKEY_ASN1_METHOD ordering */
static int test_asn1_meths(void)
{
    int i;
    int prev = -1;
    int good = 1;
    int pkey_id;
    const EVP_PKEY_ASN1_METHOD *ameth;

    for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) {
        ameth = EVP_PKEY_asn1_get0(i);
        EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, NULL, NULL, ameth);
        if (pkey_id < prev)
            good = 0;
        prev = pkey_id;

    }
    if (!good) {
        TEST_error("EVP_PKEY_ASN1_METHOD table out of order");
        for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) {
            const char *info;

            ameth = EVP_PKEY_asn1_get0(i);
            EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, &info, NULL, ameth);
            if (info == NULL)
                info = "<NO NAME>";
            TEST_note("%d : %s : %s", pkey_id, OBJ_nid2ln(pkey_id), info);
        }
    }
    return good;
}
开发者ID:IIJ-NetBSD,项目名称:netbsd-src,代码行数:31,代码来源:pkey_meth_test.c


示例18: 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


示例19: 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


示例20: genAlgProperty

std::string genAlgProperty(const X509* cert) {
  int pub_key_alg_nid = OBJ_obj2nid(cert->cert_info->key->algor->algorithm);
  if (pub_key_alg_nid == NID_undef) {
    // Unknown algorithm OID.
    return "";
  }
  return std::string(OBJ_nid2ln(pub_key_alg_nid));
}
开发者ID:huamichaelchen,项目名称:osquery,代码行数:8,代码来源:keychain_utils.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ OBJ_nid2obj函数代码示例发布时间:2022-05-30
下一篇:
C++ OBJ_cmp函数代码示例发布时间: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