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

C++ M_ASN1_OCTET_STRING_free函数代码示例

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

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



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

示例1: X509_EXTENSION_free

void X509_EXTENSION_free(X509_EXTENSION *a)
	{
	if (a == NULL) return;
	ASN1_OBJECT_free(a->object);
	M_ASN1_OCTET_STRING_free(a->value);
	OPENSSL_free(a);
	}
开发者ID:ahenroid,项目名称:ptptl-0.2,代码行数:7,代码来源:x_exten.c


示例2: X509_SIG_free

void X509_SIG_free(X509_SIG *a)
{
    if (a == NULL) return;
    X509_ALGOR_free(a->algor);
    M_ASN1_OCTET_STRING_free(a->digest);
    OPENSSL_free(a);
}
开发者ID:houzhenggang,项目名称:mt7688_mips_ecos,代码行数:7,代码来源:x_sig.c


示例3: X509_SIG_new

X509_SIG *PKCS8_encrypt_pbe(int pbe_nid,
                            const uint8_t *pass_raw, size_t pass_raw_len,
                            uint8_t *salt, size_t salt_len,
                            int iterations, PKCS8_PRIV_KEY_INFO *p8inf) {
  X509_SIG *pkcs8 = NULL;
  X509_ALGOR *pbe;

  pkcs8 = X509_SIG_new();
  if (pkcs8 == NULL) {
    OPENSSL_PUT_ERROR(PKCS8, PKCS8_encrypt_pbe, ERR_R_MALLOC_FAILURE);
    goto err;
  }

  pbe = PKCS5_pbe_set(pbe_nid, iterations, salt, salt_len);
  if (!pbe) {
    OPENSSL_PUT_ERROR(PKCS8, PKCS8_encrypt_pbe, ERR_R_ASN1_LIB);
    goto err;
  }

  X509_ALGOR_free(pkcs8->algor);
  pkcs8->algor = pbe;
  M_ASN1_OCTET_STRING_free(pkcs8->digest);
  pkcs8->digest = pkcs12_item_i2d_encrypt(
      pbe, ASN1_ITEM_rptr(PKCS8_PRIV_KEY_INFO), pass_raw, pass_raw_len, p8inf);
  if (!pkcs8->digest) {
    OPENSSL_PUT_ERROR(PKCS8, PKCS8_encrypt_pbe, PKCS8_R_ENCRYPT_ERROR);
    goto err;
  }

  return pkcs8;

err:
  X509_SIG_free(pkcs8);
  return NULL;
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:35,代码来源:pkcs8.c


示例4: GENERAL_NAME_free

void GENERAL_NAME_free(GENERAL_NAME *a)
{
	if (a == NULL) return;
	switch(a->type) {
		case GEN_X400:
		case GEN_EDIPARTY:
		ASN1_TYPE_free(a->d.other);
		break;

		case GEN_OTHERNAME:
		OTHERNAME_free(a->d.otherName);
		break;

		case GEN_EMAIL:
		case GEN_DNS:
		case GEN_URI:

		M_ASN1_IA5STRING_free(a->d.ia5);
		break;

		case GEN_DIRNAME:
		X509_NAME_free(a->d.dirn);
		break;

		case GEN_IPADD:
		M_ASN1_OCTET_STRING_free(a->d.ip);
		break;
	
		case GEN_RID:
		ASN1_OBJECT_free(a->d.rid);
		break;

	}
	OPENSSL_free (a);
}
开发者ID:jhbsz,项目名称:actiontec_opensource_mi424wr-rev-acd-56-0-10-14-4,代码行数:35,代码来源:v3_genn.c


示例5: X509_EXTENSION_create_by_NID

static X509_EXTENSION *do_ext_i2d(X509V3_EXT_METHOD *method, int ext_nid,
						 int crit, void *ext_struc)
{
	unsigned char *ext_der, *p;
	int ext_len;
	ASN1_OCTET_STRING *ext_oct;
	X509_EXTENSION *ext;
	/* Convert internal representation to DER */
	ext_len = method->i2d(ext_struc, NULL);
	if(!(ext_der = OPENSSL_malloc(ext_len))) goto merr;
	p = ext_der;
	method->i2d(ext_struc, &p);
	if(!(ext_oct = M_ASN1_OCTET_STRING_new())) goto merr;
	ext_oct->data = ext_der;
	ext_oct->length = ext_len;
	
	ext = X509_EXTENSION_create_by_NID(NULL, ext_nid, crit, ext_oct);
	if(!ext) goto merr;
	M_ASN1_OCTET_STRING_free(ext_oct);

	return ext;

	merr:
	X509V3err(X509V3_F_DO_EXT_I2D,ERR_R_MALLOC_FAILURE);
	return NULL;

}
开发者ID:ahenroid,项目名称:ptptl-0.2,代码行数:27,代码来源:v3_conf.c


示例6: PKCS12err

X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,
       const char *pass, int passlen,
       unsigned char *salt, int saltlen, int iter,
            PKCS8_PRIV_KEY_INFO *p8inf)
{
  X509_SIG *p8 = NULL;
  X509_ALGOR *pbe;

  if (!(p8 = X509_SIG_new())) {
    PKCS12err(PKCS12_F_PKCS8_ENCRYPT, ERR_R_MALLOC_FAILURE);
    goto err;
  }

  if(pbe_nid == -1) pbe = PKCS5_pbe2_set(cipher, iter, salt, saltlen);
  else pbe = PKCS5_pbe_set(pbe_nid, iter, salt, saltlen);
  if(!pbe) {
    PKCS12err(PKCS12_F_PKCS8_ENCRYPT, ERR_R_ASN1_LIB);
    goto err;
  }
  X509_ALGOR_free(p8->algor);
  p8->algor = pbe;
  M_ASN1_OCTET_STRING_free(p8->digest);
  p8->digest = PKCS12_item_i2d_encrypt(pbe, ASN1_ITEM_rptr(PKCS8_PRIV_KEY_INFO),
          pass, passlen, p8inf, 1);
  if(!p8->digest) {
    PKCS12err(PKCS12_F_PKCS8_ENCRYPT, PKCS12_R_ENCRYPT_ERROR);
    goto err;
  }

  return p8;

  err:
  X509_SIG_free(p8);
  return NULL;
}
开发者ID:yyyyyao,项目名称:Slicer3-lib-mirrors,代码行数:35,代码来源:p12_p8e.c


示例7: d2i_ocsp_nonce

static void *
d2i_ocsp_nonce(void *a, const unsigned char **pp, long length)
{
	ASN1_OCTET_STRING *os, **pos;

	pos = a;
	if (!pos || !*pos)
		os = ASN1_OCTET_STRING_new();
	else
		os = *pos;
	if (!ASN1_OCTET_STRING_set(os, *pp, length))
		goto err;

	*pp += length;

	if (pos)
		*pos = os;
	return os;

err:
	if (os && (!pos || (*pos != os)))
		M_ASN1_OCTET_STRING_free(os);
	OCSPerr(OCSP_F_D2I_OCSP_NONCE, ERR_R_MALLOC_FAILURE);
	return NULL;
}
开发者ID:awakecoding,项目名称:libressl,代码行数:25,代码来源:v3_ocsp.c


示例8: PROXYPOLICY_free

/**
 * @ingroup proxypolicy
 *
 * Frees a PROXYPOLICY
 *
 * @param policy the proxy policy to free
 */
void PROXYPOLICY_free(
    PROXYPOLICY *                       policy)
{
    if(policy == NULL) return;
    ASN1_OBJECT_free(policy->policy_language);
    M_ASN1_OCTET_STRING_free(policy->policy);
    OPENSSL_free(policy);
}
开发者ID:bbockelm,项目名称:globus-toolkit,代码行数:15,代码来源:proxypolicy.c


示例9: PKCS12_MAC_DATA_free

void PKCS12_MAC_DATA_free (PKCS12_MAC_DATA *a)
{
	if (a == NULL) return;
	X509_SIG_free (a->dinfo);
	M_ASN1_OCTET_STRING_free(a->salt);
	M_ASN1_INTEGER_free(a->iter);
	OPENSSL_free (a);
}
开发者ID:ahenroid,项目名称:ptptl-0.2,代码行数:8,代码来源:p12_mac.c


示例10: ASN1_HEADER_free

void ASN1_HEADER_free(ASN1_HEADER *a)
	{
	if (a == NULL) return;
	M_ASN1_OCTET_STRING_free(a->header);
	if (a->meth != NULL)
		a->meth->destroy(a->data);
	OPENSSL_free(a);
	}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:8,代码来源:a_hdr.c


示例11: NETSCAPE_PKEY_free

static void NETSCAPE_PKEY_free(NETSCAPE_PKEY *a)
	{
	if (a == NULL) return;
	M_ASN1_INTEGER_free(a->version);
	X509_ALGOR_free(a->algor);
	M_ASN1_OCTET_STRING_free(a->private_key);
	OPENSSL_free(a);
	}
开发者ID:houzhenggang,项目名称:mt7688_mips_ecos,代码行数:8,代码来源:n_pkey.c


示例12: ASN1_TYPE_get_int_octetstring

/* int max_len:  for returned value    */
int
ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
    int max_len)
{
	int ret = -1, n;
	ASN1_INTEGER *ai = NULL;
	ASN1_OCTET_STRING *os = NULL;
	const unsigned char *p;
	long length;
	ASN1_const_CTX c;

	if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL)) {
		goto err;
	}
	p = M_ASN1_STRING_data(a->value.sequence);
	length = M_ASN1_STRING_length(a->value.sequence);

	c.pp = &p;
	c.p = p;
	c.max = p + length;
	c.error = ASN1_R_DATA_IS_WRONG;

	M_ASN1_D2I_start_sequence();
	c.q = c.p;
	if ((ai = d2i_ASN1_INTEGER(NULL, &c.p, c.slen)) == NULL)
		goto err;
	c.slen -= (c.p - c.q);
	c.q = c.p;
	if ((os = d2i_ASN1_OCTET_STRING(NULL, &c.p, c.slen)) == NULL)
		goto err;
	c.slen -= (c.p - c.q);
	if (!M_ASN1_D2I_end_sequence())
		goto err;

	if (num != NULL)
		*num = ASN1_INTEGER_get(ai);

	ret = M_ASN1_STRING_length(os);
	if (max_len > ret)
		n = ret;
	else
		n = max_len;

	if (data != NULL)
		memcpy(data, M_ASN1_STRING_data(os), n);
	if (0) {
err:
		ASN1err(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,
		    ASN1_R_DATA_IS_WRONG);
	}
	if (os != NULL)
		M_ASN1_OCTET_STRING_free(os);
	if (ai != NULL)
		M_ASN1_INTEGER_free(ai);
	return (ret);
}
开发者ID:DiamondLovesYou,项目名称:libressl-pnacl-sys,代码行数:57,代码来源:evp_asn1.c


示例13: X509_PKEY_free

void X509_PKEY_free(X509_PKEY *x)
	{
	if (x == NULL) return;

	if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor);
	if (x->enc_pkey != NULL) M_ASN1_OCTET_STRING_free(x->enc_pkey);
	if (x->dec_pkey != NULL)EVP_PKEY_free(x->dec_pkey);
	if ((x->key_data != NULL) && (x->key_free)) OPENSSL_free(x->key_data);
	OPENSSL_free(x);
	}
开发者ID:360ground,项目名称:Meda.et,代码行数:10,代码来源:x_pkey.c


示例14: ASN1_TYPE_set_octetstring

static int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len)
	{
	ASN1_STRING *os;

	if ((os=M_ASN1_OCTET_STRING_new()) == NULL) return(0);
	if (!M_ASN1_OCTET_STRING_set(os,data,len))
		{
		M_ASN1_OCTET_STRING_free(os);
		return 0;
		}
	ASN1_TYPE_set(a,V_ASN1_OCTET_STRING,os);
	return(1);
	}
开发者ID:360ground,项目名称:Meda.et,代码行数:13,代码来源:p5_pbev2.c


示例15: PKCS7_SIGNER_INFO_free

void PKCS7_SIGNER_INFO_free(PKCS7_SIGNER_INFO *a)
	{
	if (a == NULL) return;
	M_ASN1_INTEGER_free(a->version);
	PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial);
	X509_ALGOR_free(a->digest_alg);
	sk_X509_ATTRIBUTE_pop_free(a->auth_attr,X509_ATTRIBUTE_free);
	X509_ALGOR_free(a->digest_enc_alg);
	M_ASN1_OCTET_STRING_free(a->enc_digest);
	sk_X509_ATTRIBUTE_pop_free(a->unauth_attr,X509_ATTRIBUTE_free);
	if (a->pkey != NULL)
		EVP_PKEY_free(a->pkey);
	OPENSSL_free(a);
	}
开发者ID:ahenroid,项目名称:ptptl-0.2,代码行数:14,代码来源:p7_signi.c


示例16: s2i_ASN1_OCTET_STRING

static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method,
                                      X509V3_CTX *ctx, char *str)
{
    ASN1_OCTET_STRING *oct;
    ASN1_BIT_STRING *pk;
    unsigned char pkey_dig[EVP_MAX_MD_SIZE];
    unsigned int diglen;

    if (strcmp(str, "hash"))
        return s2i_ASN1_OCTET_STRING(method, ctx, str);

    if (!(oct = M_ASN1_OCTET_STRING_new())) {
        OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
        return NULL;
    }

    if (ctx && (ctx->flags == CTX_TEST))
        return oct;

    if (!ctx || (!ctx->subject_req && !ctx->subject_cert)) {
        OPENSSL_PUT_ERROR(X509V3, X509V3_R_NO_PUBLIC_KEY);
        goto err;
    }

    if (ctx->subject_req)
        pk = ctx->subject_req->req_info->pubkey->public_key;
    else
        pk = ctx->subject_cert->cert_info->key->public_key;

    if (!pk) {
        OPENSSL_PUT_ERROR(X509V3, X509V3_R_NO_PUBLIC_KEY);
        goto err;
    }

    if (!EVP_Digest
        (pk->data, pk->length, pkey_dig, &diglen, EVP_sha1(), NULL))
        goto err;

    if (!M_ASN1_OCTET_STRING_set(oct, pkey_dig, diglen)) {
        OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
        goto err;
    }

    return oct;

 err:
    M_ASN1_OCTET_STRING_free(oct);
    return NULL;
}
开发者ID:0x64616E69656C,项目名称:boringssl,代码行数:49,代码来源:v3_skey.c


示例17: X509V3err

/* Create a generic extension: for now just handle DER type */
static X509_EXTENSION *v3_generic_extension(const char *ext, char *value,
					    int crit, int gen_type,
					    X509V3_CTX *ctx)
	{
	unsigned char *ext_der=NULL;
	long ext_len;
	ASN1_OBJECT *obj=NULL;
	ASN1_OCTET_STRING *oct=NULL;
	X509_EXTENSION *extension=NULL;
	if (!(obj = OBJ_txt2obj(ext, 0)))
		{
		X509V3err(X509V3_F_V3_GENERIC_EXTENSION,X509V3_R_EXTENSION_NAME_ERROR);
		ERR_add_error_data(2, "name=", ext);
		goto err;
		}

	if (gen_type == 1)
		ext_der = string_to_hex(value, &ext_len);
	else if (gen_type == 2)
		ext_der = generic_asn1(value, ctx, &ext_len);

	if (ext_der == NULL)
		{
		X509V3err(X509V3_F_V3_GENERIC_EXTENSION,X509V3_R_EXTENSION_VALUE_ERROR);
		ERR_add_error_data(2, "value=", value);
		goto err;
		}

	if (!(oct = M_ASN1_OCTET_STRING_new()))
		{
		X509V3err(X509V3_F_V3_GENERIC_EXTENSION,ERR_R_MALLOC_FAILURE);
		goto err;
		}

	oct->data = ext_der;
	oct->length = ext_len;
	ext_der = NULL;

	extension = X509_EXTENSION_create_by_OBJ(NULL, obj, crit, oct);

	err:
	ASN1_OBJECT_free(obj);
	M_ASN1_OCTET_STRING_free(oct);
	if(ext_der) OPENSSL_free(ext_der);
	return extension;

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


示例18: RSA_verify_ASN1_OCTET_STRING

int RSA_verify_ASN1_OCTET_STRING(int dtype,
	const unsigned char *m,
	unsigned int m_len, unsigned char *sigbuf, unsigned int siglen,
	RSA *rsa)
	{
	int i,ret=0;
	unsigned char *s;
	const unsigned char *p;
	ASN1_OCTET_STRING *sig=NULL;

	if (siglen != (unsigned int)RSA_size(rsa))
		{
		RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,RSA_R_WRONG_SIGNATURE_LENGTH);
		return(0);
		}

	s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen);
	if (s == NULL)
		{
		RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE);
		goto err;
		}
	i=RSA_public_decrypt((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING);

	if (i <= 0) goto err;

	p=s;
	sig=d2i_ASN1_OCTET_STRING(NULL,&p,(long)i);
	if (sig == NULL) goto err;

	if (	((unsigned int)sig->length != m_len) ||
		(memcmp(m,sig->data,m_len) != 0))
		{
		RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,RSA_R_BAD_SIGNATURE);
		}
	else
		ret=1;
err:
	if (sig != NULL) M_ASN1_OCTET_STRING_free(sig);
	if (s != NULL)
		{
		OPENSSL_cleanse(s,(unsigned int)siglen);
		OPENSSL_free(s);
		}
	return(ret);
	}
开发者ID:LucidOne,项目名称:Rovio,代码行数:46,代码来源:rsa_saos.c


示例19: s2i_ASN1_OCTET_STRING

ASN1_OCTET_STRING *
s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str)
{
	ASN1_OCTET_STRING *oct;
	long length;

	if (!(oct = M_ASN1_OCTET_STRING_new())) {
		X509V3err(X509V3_F_S2I_ASN1_OCTET_STRING, ERR_R_MALLOC_FAILURE);
		return NULL;
	}

	if (!(oct->data = string_to_hex(str, &length))) {
		M_ASN1_OCTET_STRING_free(oct);
		return NULL;
	}

	oct->length = length;

	return oct;
}
开发者ID:randombit,项目名称:hacrypto,代码行数:20,代码来源:v3_skey.c


示例20: X509_PKEY_free

void
X509_PKEY_free(X509_PKEY *x)
{
	int i;

	if (x == NULL)
		return;

	i = CRYPTO_add(&x->references, -1, CRYPTO_LOCK_X509_PKEY);
	if (i > 0)
		return;

	if (x->enc_algor != NULL)
		X509_ALGOR_free(x->enc_algor);
	if (x->enc_pkey != NULL)
		M_ASN1_OCTET_STRING_free(x->enc_pkey);
	if (x->dec_pkey != NULL)
		EVP_PKEY_free(x->dec_pkey);
	if ((x->key_data != NULL) && (x->key_free))
		free(x->key_data);
	free(x);
}
开发者ID:DiamondLovesYou,项目名称:libressl-pnacl-sys,代码行数:22,代码来源:x_pkey.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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