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

C++ sk_X509_pop_free函数代码示例

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

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



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

示例1: ssl_cert_clear_certs

void ssl_cert_clear_certs(CERT *c)
	{
	int i;
	if (c == NULL)
		return;
	for (i = 0; i<SSL_PKEY_NUM; i++)
		{
		CERT_PKEY *cpk = c->pkeys + i;
		if (cpk->x509)
			{
			X509_free(cpk->x509);
			cpk->x509 = NULL;
			}
		if (cpk->privatekey)
			{
			EVP_PKEY_free(cpk->privatekey);
			cpk->privatekey = NULL;
			}
		if (cpk->chain)
			{
			sk_X509_pop_free(cpk->chain, X509_free);
			cpk->chain = NULL;
			}
		}
	}
开发者ID:ZzeetteEZzOLARINventionZ,项目名称:libwebrtc,代码行数:25,代码来源:ssl_cert.c


示例2: ssl_sess_cert_free

void
ssl_sess_cert_free(SESS_CERT *sc)
{
	int i;

	if (sc == NULL)
		return;

	i = CRYPTO_add(&sc->references, -1, CRYPTO_LOCK_SSL_SESS_CERT);
	if (i > 0)
		return;

	/* i == 0 */
	if (sc->cert_chain != NULL)
		sk_X509_pop_free(sc->cert_chain, X509_free);
	for (i = 0; i < SSL_PKEY_NUM; i++) {
		if (sc->peer_pkeys[i].x509 != NULL)
			X509_free(sc->peer_pkeys[i].x509);
	}

	DH_free(sc->peer_dh_tmp);
	EC_KEY_free(sc->peer_ecdh_tmp);

	free(sc);
}
开发者ID:Heratom,项目名称:Firefly-project,代码行数:25,代码来源:ssl_cert.c


示例3: xmlSecOpenSSLX509StoreFinalize

static void
xmlSecOpenSSLX509StoreFinalize(xmlSecKeyDataStorePtr store) {
    xmlSecOpenSSLX509StoreCtxPtr ctx;
    xmlSecAssert(xmlSecKeyDataStoreCheckId(store, xmlSecOpenSSLX509StoreId));

    ctx = xmlSecOpenSSLX509StoreGetCtx(store);
    xmlSecAssert(ctx != NULL);


    if(ctx->xst != NULL) {
        X509_STORE_free(ctx->xst);
    }
    if(ctx->untrusted != NULL) {
        sk_X509_pop_free(ctx->untrusted, X509_free);
    }
    if(ctx->crls != NULL) {
        sk_X509_CRL_pop_free(ctx->crls, X509_CRL_free);
    }
#if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097)
    if(ctx->vpm != NULL) {
        X509_VERIFY_PARAM_free(ctx->vpm);
    }
#endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */

    memset(ctx, 0, sizeof(xmlSecOpenSSLX509StoreCtx));
}
开发者ID:dhyannataraj,项目名称:xmlsec-for-nataraj,代码行数:26,代码来源:x509vfy.c


示例4: ossl_x509stctx_initialize

static VALUE
ossl_x509stctx_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE store, cert, chain, t;
    X509_STORE_CTX *ctx;
    X509_STORE *x509st;
    X509 *x509 = NULL;
    STACK_OF(X509) *x509s = NULL;

    rb_scan_args(argc, argv, "12", &store, &cert, &chain);
    GetX509StCtx(self, ctx);
    SafeGetX509Store(store, x509st);
    if(!NIL_P(cert)) x509 = DupX509CertPtr(cert); /* NEED TO DUP */
    if(!NIL_P(chain)) x509s = ossl_x509_ary2sk(chain);
#if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
    if(X509_STORE_CTX_init(ctx, x509st, x509, x509s) != 1){
        sk_X509_pop_free(x509s, X509_free);
        ossl_raise(eX509StoreError, NULL);
    }
#else
    X509_STORE_CTX_init(ctx, x509st, x509, x509s);
    ossl_x509stctx_set_flags(self, rb_iv_get(store, "@flags"));
    ossl_x509stctx_set_purpose(self, rb_iv_get(store, "@purpose"));
    ossl_x509stctx_set_trust(self, rb_iv_get(store, "@trust"));
#endif
    if (!NIL_P(t = rb_iv_get(store, "@time")))
	ossl_x509stctx_set_time(self, t);
    rb_iv_set(self, "@verify_callback", rb_iv_get(store, "@verify_callback"));
    rb_iv_set(self, "@cert", cert);

    return self;
}
开发者ID:Shopify,项目名称:ruby,代码行数:32,代码来源:ossl_x509store.c


示例5: globus_gsi_callback_data_destroy

/**
 * This function destroys a globus_gsi_callback_data_t.
 * @ingroup globus_gsi_callback_data
 *
 * @param callback_data
 *        The structure to be destroyed
 *
 * @return
 *        GLOBUS_SUCCESS unless an error occurred, in which case, 
 *        a globus error object ID is returned
 */
globus_result_t
globus_gsi_callback_data_destroy(
    globus_gsi_callback_data_t          callback_data)
{
    globus_result_t                     result = GLOBUS_SUCCESS;
    static char *                       _function_name_ =
        "globus_gsi_callback_data_destroy";

    GLOBUS_I_GSI_CALLBACK_DEBUG_ENTER;

    if(!callback_data)
    {
        goto exit;
    }

    if(callback_data->cert_chain)
    { 
        sk_X509_pop_free(callback_data->cert_chain, X509_free); 
    } 
    
    if(callback_data->cert_dir)
    {
        globus_libc_free(callback_data->cert_dir);
    }

    /* extension_oids have to be free independantly */

    globus_object_free(globus_error_get(callback_data->error));

    globus_libc_free(callback_data);

 exit:
    GLOBUS_I_GSI_CALLBACK_DEBUG_EXIT;
    return result;
}   
开发者ID:bbockelm,项目名称:globus-toolkit,代码行数:46,代码来源:globus_gsi_callback_data.c


示例6: pemData

// success of certificates extraction
bool pemData(X509_STORE_CTX* ctx, ListHashSet<String>& certificates)
{
    bool ok = true;
    STACK_OF(X509)* certs = X509_STORE_CTX_get1_chain(ctx);
    for (int i = 0; i < sk_X509_num(certs); i++) {
        X509* uCert = sk_X509_value(certs, i);
        BIO* bio = BIO_new(BIO_s_mem());
        int res = PEM_write_bio_X509(bio, uCert);
        if (!res) {
            ok = false;
            BIO_free(bio);
            break;
        }

        unsigned char* certificateData;
        long length = BIO_get_mem_data(bio, &certificateData);
        if (length < 0) {
            ok = false;
            BIO_free(bio);
            break;
        }

        certificateData[length] = '\0';
        String certificate = certificateData;
        certificates.add(certificate);
        BIO_free(bio);
    }
        sk_X509_pop_free(certs, X509_free);
        return ok;
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:31,代码来源:SSLHandle.cpp


示例7: ossl_ocspreq_sign

static VALUE
ossl_ocspreq_sign(int argc, VALUE *argv, VALUE self)
{
    VALUE signer_cert, signer_key, certs, flags;
    OCSP_REQUEST *req;
    X509 *signer;
    EVP_PKEY *key;
    STACK_OF(X509) *x509s;
    unsigned long flg;
    int ret;

    rb_scan_args(argc, argv, "22", &signer_cert, &signer_key, &certs, &flags);
    signer = GetX509CertPtr(signer_cert);
    key = GetPrivPKeyPtr(signer_key);
    flg = NIL_P(flags) ? 0 : NUM2INT(flags);
    if(NIL_P(certs)){
	x509s = sk_X509_new_null();
	flags |= OCSP_NOCERTS;
    }
    else x509s = ossl_x509_ary2sk(certs);
    GetOCSPReq(self, req);
    ret = OCSP_request_sign(req, signer, key, EVP_sha1(), x509s, flg);
    sk_X509_pop_free(x509s, X509_free);
    if(!ret) ossl_raise(eOCSPError, NULL);

    return self;
}
开发者ID:agrimm,项目名称:ruby-benchmark-suite,代码行数:27,代码来源:ossl_ocsp.c


示例8: LUA_FUNCTION

static LUA_FUNCTION(openssl_pkcs7_sign)
{
  BIO *in  = load_bio_object(L, 1);
  X509 *cert = CHECK_OBJECT(2, X509, "openssl.x509");
  EVP_PKEY *privkey = CHECK_OBJECT(3, EVP_PKEY, "openssl.evp_pkey");
  STACK_OF(X509) *others = lua_isnoneornil(L, 4) ? 0 : openssl_sk_x509_fromtable(L, 4);
  long flags =  luaL_optint(L, 5, 0);
  PKCS7 *p7 = NULL;
  luaL_argcheck(L, openssl_pkey_is_private(privkey), 3, "must be private key");

  if (!X509_check_private_key(cert, privkey))
    luaL_error(L, "sigcert and private key not match");
  p7 = PKCS7_sign(cert, privkey, others, in, flags);
  BIO_free(in);
  if (others)
    sk_X509_pop_free(others, X509_free);
  if (p7)
  {
    PUSH_OBJECT(p7, "openssl.pkcs7");
    return 1;
  }
  else
  {
    luaL_error(L, "error creating PKCS7 structure!");
  }

  return 0;
}
开发者ID:chk-jxcn,项目名称:lua-openssl,代码行数:28,代码来源:pkcs7.c


示例9: ossl_ocspbres_sign

static VALUE
ossl_ocspbres_sign(int argc, VALUE *argv, VALUE self)
{
    VALUE signer_cert, signer_key, certs, flags;
    OCSP_BASICRESP *bs;
    X509 *signer;
    EVP_PKEY *key;
    STACK_OF(X509) *x509s;
    unsigned long flg;
    int ret;

    rb_scan_args(argc, argv, "22", &signer_cert, &signer_key, &certs, &flags);
    signer = GetX509CertPtr(signer_cert);
    key = GetPrivPKeyPtr(signer_key);
    flg = NIL_P(flags) ? 0 : NUM2INT(flags);
    if(NIL_P(certs)){
	x509s = sk_X509_new_null();
	flg |= OCSP_NOCERTS;
    }
    else{
	x509s = ossl_x509_ary2sk(certs);
    }
    GetOCSPBasicRes(self, bs);
    ret = OCSP_basic_sign(bs, signer, key, EVP_sha1(), x509s, flg);
    sk_X509_pop_free(x509s, X509_free);
    if(!ret) ossl_raise(eOCSPError, NULL);

    return self;
}
开发者ID:agrimm,项目名称:ruby-benchmark-suite,代码行数:29,代码来源:ossl_ocsp.c


示例10: ssl_cert_clear_certs

void ssl_cert_clear_certs(CERT *c)
	{
	int i;
	if (c == NULL)
		return;
	for (i = 0; i<SSL_PKEY_NUM; i++)
		{
		CERT_PKEY *cpk = c->pkeys + i;
		if (cpk->x509)
			{
			X509_free(cpk->x509);
			cpk->x509 = NULL;
			}
		if (cpk->privatekey)
			{
			EVP_PKEY_free(cpk->privatekey);
			cpk->privatekey = NULL;
			}
		if (cpk->chain)
			{
			sk_X509_pop_free(cpk->chain, X509_free);
			cpk->chain = NULL;
			}
#ifndef OPENSSL_NO_TLSEXT
		if (cpk->serverinfo)
			{
			OPENSSL_free(cpk->serverinfo);
			cpk->serverinfo = NULL;
			cpk->serverinfo_length = 0;
			}
#endif
		/* Clear all flags apart from explicit sign */
		cpk->valid_flags &= CERT_PKEY_EXPLICIT_SIGN;
		}
	}
开发者ID:Zhao-Rainy,项目名称:openssl,代码行数:35,代码来源:ssl_cert.c


示例11: STACK_OF

STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms)
	{
	STACK_OF(X509) *certs = NULL;
	CMS_CertificateChoices *cch;
	STACK_OF(CMS_CertificateChoices) **pcerts;
	int i;
	pcerts = cms_get0_certificate_choices(cms);
	if (!pcerts)
		return NULL;
	for (i = 0; i < sk_CMS_CertificateChoices_num(*pcerts); i++)
		{
		cch = sk_CMS_CertificateChoices_value(*pcerts, i);
		if (cch->type == 0)
			{
			if (!certs)
				{
				certs = sk_X509_new_null();
				if (!certs)
					return NULL;
				}
			if (!sk_X509_push(certs, cch->d.certificate))
				{
				sk_X509_pop_free(certs, X509_free);
				return NULL;
				}
			CRYPTO_add(&cch->d.certificate->references,
						1, CRYPTO_LOCK_X509);
			}
		}
	return certs;

	}
开发者ID:Chenhx,项目名称:moai-dev,代码行数:32,代码来源:cms_lib.c


示例12: AC_CERTS_free

void AC_CERTS_free(AC_CERTS *a)
{
  if (a==NULL) return;

  sk_X509_pop_free(a->stackcert, X509_free);
  OPENSSL_free(a);
}
开发者ID:andreaceccanti,项目名称:voms,代码行数:7,代码来源:extensions.c


示例13: check_signer_name

static int check_signer_name(CMS_ContentInfo *cms, const char *name)
{
	STACK_OF(CMS_SignerInfo) *infos = CMS_get0_SignerInfos(cms);
	STACK_OF(X509) *crts;
	int i, ret = 1;

	if ((name == NULL) || (name[0] == '\0'))
		return 0;

	crts = CMS_get1_certs(cms);
	for (i = 0; i < sk_CMS_SignerInfo_num(infos); ++i) {
		CMS_SignerInfo *si = sk_CMS_SignerInfo_value(infos, i);
		int j;

		for (j = 0; j < sk_X509_num(crts); ++j) {
			X509 *crt = sk_X509_value(crts, j);

			if (CMS_SignerInfo_cert_cmp(si, crt) == 0) {
				ret = check_common_name(
					X509_get_subject_name(crt), name);
			}
		}
	}
	sk_X509_pop_free(crts, X509_free);

	return ret;
}
开发者ID:sbabic,项目名称:swupdate,代码行数:27,代码来源:swupdate_cms_verify.c


示例14: ossl_pkcs12_s_create

static VALUE
ossl_pkcs12_s_create(int argc, VALUE *argv, VALUE self)
{
    VALUE pass, name, pkey, cert, ca;
    VALUE obj;
    char *passphrase, *friendlyname;
    EVP_PKEY *key;
    X509 *x509;
    STACK_OF(X509) *x509s;
    PKCS12 *p12;
    
    rb_scan_args(argc, argv, "41", &pass, &name, &pkey, &cert, &ca);
    passphrase = NIL_P(pass) ? NULL : StringValuePtr(pass);
    friendlyname = NIL_P(name) ? NULL : StringValuePtr(name);
    key = GetPKeyPtr(pkey);
    x509 = GetX509CertPtr(cert);
    x509s = NIL_P(ca) ? NULL : ossl_x509_ary2sk(ca);
    p12 = PKCS12_create(passphrase, friendlyname, key, x509, x509s,
                        0, 0, 0, 0, 0);
    sk_X509_pop_free(x509s, X509_free);
    if(!p12) ossl_raise(ePKCS12Error, NULL);
    WrapPKCS12(cPKCS12, obj, p12);

    return obj;
}
开发者ID:TheTypoMaster,项目名称:instantrails,代码行数:25,代码来源:ossl_pkcs12.c


示例15: ossl_pkcs7_s_encrypt

/*
 * call-seq:
 *    PKCS7.encrypt(certs, data, [, cipher [, flags]]) => pkcs7
 */
static VALUE
ossl_pkcs7_s_encrypt(int argc, VALUE *argv, VALUE klass)
{
    VALUE certs, data, cipher, flags;
    STACK_OF(X509) *x509s;
    BIO *in;
    const EVP_CIPHER *ciph;
    int flg, status = 0;
    VALUE ret;
    PKCS7 *p7;

    rb_scan_args(argc, argv, "22", &certs, &data, &cipher, &flags);
    if(NIL_P(cipher)){
#if !defined(OPENSSL_NO_RC2)
	ciph = EVP_rc2_40_cbc();
#elif !defined(OPENSSL_NO_DES)
	ciph = EVP_des_ede3_cbc();
#elif !defined(OPENSSL_NO_RC2)
	ciph = EVP_rc2_40_cbc();
#elif !defined(OPENSSL_NO_AES)
	ciph = EVP_EVP_aes_128_cbc();
#else
	ossl_raise(ePKCS7Error, "Must specify cipher");
#endif

    }
    else ciph = GetCipherPtr(cipher); /* NO NEED TO DUP */
    flg = NIL_P(flags) ? 0 : NUM2INT(flags);
    ret = NewPKCS7(cPKCS7);
    in = ossl_obj2bio(data);
    x509s = ossl_protect_x509_ary2sk(certs, &status);
    if(status){
	BIO_free(in);
	rb_jump_tag(status);
    }
    if(!(p7 = PKCS7_encrypt(x509s, in, (EVP_CIPHER*)ciph, flg))){
	BIO_free(in);
	sk_X509_pop_free(x509s, X509_free);
	ossl_raise(ePKCS7Error, NULL);
    }
    BIO_free(in);
    SetPKCS7(ret, p7);
    ossl_pkcs7_set_data(ret, data);
    sk_X509_pop_free(x509s, X509_free);

    return ret;
}
开发者ID:Capcah,项目名称:openssl,代码行数:51,代码来源:ossl_pkcs7.c


示例16: NETSCAPE_CERT_SEQUENCE_free

void NETSCAPE_CERT_SEQUENCE_free (NETSCAPE_CERT_SEQUENCE *a)
{
	if (a == NULL) return;
	ASN1_OBJECT_free(a->type);
	if(a->certs)
	    sk_X509_pop_free(a->certs, X509_free);
	OPENSSL_free (a);
}
开发者ID:ahenroid,项目名称:ptptl-0.2,代码行数:8,代码来源:nsseq.c


示例17: s2n_x509_validator_wipe

void s2n_x509_validator_wipe(struct s2n_x509_validator *validator) {
    if (validator->cert_chain) {
        sk_X509_pop_free(validator->cert_chain, X509_free);
        validator->cert_chain = NULL;
    }

    validator->trust_store = NULL;
    validator->skip_cert_validation = 0;
}
开发者ID:gibson-compsci,项目名称:s2n,代码行数:9,代码来源:s2n_x509_validator.c


示例18: ossl_x509stctx_free

/*
 * Private functions
 */
static void
ossl_x509stctx_free(X509_STORE_CTX *ctx)
{
    if(ctx->untrusted)
	sk_X509_pop_free(ctx->untrusted, X509_free);
    if(ctx->cert)
	X509_free(ctx->cert);
    X509_STORE_CTX_free(ctx);
}
开发者ID:DCarper,项目名称:rubinius,代码行数:12,代码来源:ossl_x509store.c


示例19: z_certificate_chain_free_method

static void
z_certificate_chain_free_method(ZObject *s)
{
  ZCertificateChain *self = Z_CAST(s, ZCertificateChain);
  if (self->cert)
    X509_free(self->cert);
  sk_X509_pop_free(self->chain, X509_free);
  z_object_free_method(s);
}
开发者ID:VPetyaa,项目名称:zorp,代码行数:9,代码来源:certchain.c


示例20: sk_X509_pop_free

bdoc::SignatureValidator::~SignatureValidator()
{
    if (_ocspCerts) {
        sk_X509_pop_free(_ocspCerts, X509_free);
    }
    if (_issuerX509) {
        X509_free(_issuerX509);
    }
}
开发者ID:nomadiccreature,项目名称:evalimine,代码行数:9,代码来源:Signature.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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