当前位置: 首页>>代码示例>>C++>>正文


C++ M_ASN1_OCTET_STRING_free函数代码示例

本文整理汇总了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函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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