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


C++ CMS_ContentInfo_free函数代码示例

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


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

示例1: openssl_cms_free

static int openssl_cms_free(lua_State *L)
{
  CMS_ContentInfo *cms = CHECK_OBJECT(1, CMS_ContentInfo, "openssl.cms");
  CMS_ContentInfo_free(cms);

  return 0;
}
开发者ID:witchu,项目名称:lua-openssl,代码行数:7,代码来源:cms.c

示例2: CMS_ContentInfo_new

CMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md)
	{
	CMS_ContentInfo *cms;
	CMS_DigestedData *dd;
	cms = CMS_ContentInfo_new();
	if (!cms)
		return NULL;

	dd = M_ASN1_new_of(CMS_DigestedData);

	if (!dd)
		goto err;

	cms->contentType = OBJ_nid2obj(NID_pkcs7_digest);
	cms->d.digestedData = dd;

	dd->version = 0;
	dd->encapContentInfo->eContentType = OBJ_nid2obj(NID_pkcs7_data);

	cms_DigestAlgorithm_set(dd->digestAlgorithm, md);

	return cms;

	err:

	if (cms)
		CMS_ContentInfo_free(cms);

	return NULL;
	}
开发者ID:EddieGarmon,项目名称:netduino-netmf,代码行数:30,代码来源:cms_dd.cpp

示例3: CMSerr

CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
					const unsigned char *key, size_t keylen,
					unsigned int flags)
	{
	CMS_ContentInfo *cms;
	if (!cipher)
		{
		CMSerr(CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT, CMS_R_NO_CIPHER);
		return NULL;
		}
	cms = CMS_ContentInfo_new();
	if (!cms)
		return NULL;
	if (!CMS_EncryptedData_set1_key(cms, cipher, key, keylen))
		return NULL;

	if(!(flags & CMS_DETACHED))
		CMS_set_detached(cms, 0);

	if ((flags & (CMS_STREAM|CMS_PARTIAL))
		|| CMS_final(cms, in, NULL, flags))
		return cms;

	CMS_ContentInfo_free(cms);
	return NULL;
	}
开发者ID:hlcherub,项目名称:src,代码行数:26,代码来源:cms_smime.c

示例4: ossl_cms_initialize

static VALUE
ossl_cms_initialize(int argc, VALUE *argv, VALUE self)
{
    CMS_ContentInfo *cms, *out = DATA_PTR(self);
    BIO *in;
    VALUE arg;

    if(rb_scan_args(argc, argv, "01", &arg) == 0)
        return self;

    arg = ossl_to_der_if_possible(arg);
    in = ossl_obj2bio(arg);

    cms = PEM_read_bio_CMS(in, &out, NULL, NULL);
    if (!cms) {
        OSSL_BIO_reset(in);
        cms = d2i_CMS_bio(in, &out);

        if (!cms) {
            BIO_free(in);
            CMS_ContentInfo_free(out);
            DATA_PTR(self) = NULL;
            ossl_raise(rb_eArgError, "Could not parse the CMS");
        }
    }

    DATA_PTR(self) = out;
    BIO_free(in);
    ossl_cms_set_data(self, Qnil);
    ossl_cms_set_err_string(self, Qnil);

    return self;
}
开发者ID:sustr4,项目名称:rCMS,代码行数:33,代码来源:ossl_cms.c

示例5: ossl_cms_s_read_cms

static VALUE
ossl_cms_s_read_cms(VALUE klass, VALUE arg)
{
    BIO *in;
    CMS_ContentInfo *cms, *out;
    VALUE ret;

    arg = ossl_to_der_if_possible(arg);
    in = ossl_obj2bio(arg);
    out = CMS_ContentInfo_new();
    cms = PEM_read_bio_CMS(in, &out, NULL, NULL);

    if (!cms) {
        OSSL_BIO_reset(in);
        cms = d2i_CMS_bio(in, &out);

        if (!cms) {
            BIO_free(in);
            CMS_ContentInfo_free(out);
            ossl_raise(rb_eArgError, "Could not parse the CMS");
        }
    }

    WrapCMS(cCMS, ret, cms);
    BIO_free(in);
    ossl_cms_set_data(ret, Qnil);
    ossl_cms_set_err_string(ret, Qnil);

    return ret;
}
开发者ID:sustr4,项目名称:rCMS,代码行数:30,代码来源:ossl_cms.c

示例6: main

int main(int argc, char **argv)
	{
	BIO *in = NULL, *out = NULL;
	CMS_ContentInfo *cms = NULL;
	int ret = 1;

	/*
	 * On OpenSSL 0.9.9 only:
	 * for streaming set CMS_STREAM
	 */
	int flags = CMS_STREAM;

	OpenSSL_add_all_algorithms();
	ERR_load_crypto_strings();

	/* Open content being compressed */

	in = BIO_new_file("comp.txt", "r");

	if (!in)
		goto err;

	/* compress content */
	cms = CMS_compress(in, NID_zlib_compression, flags);

	if (!cms)
		goto err;

	out = BIO_new_file("smcomp.txt", "w");
	if (!out)
		goto err;

	/* Write out S/MIME message */
	if (!SMIME_write_CMS(out, cms, in, flags))
		goto err;

	ret = 0;

	err:

	if (ret)
		{
		fprintf(stderr, "Error Compressing Data\n");
		ERR_print_errors_fp(stderr);
		}

	if (cms)
		CMS_ContentInfo_free(cms);
	if (in)
		BIO_free(in);
	if (out)
		BIO_free(out);

	return ret;

	}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:56,代码来源:cms_comp.c

示例7: main

int main(int argc, char **argv)
	{
	BIO *in = NULL, *out = NULL;
	CMS_ContentInfo *cms = NULL;
	int ret = 1;

	OpenSSL_add_all_algorithms();
	ERR_load_crypto_strings();

	/* Open compressed content */

	in = BIO_new_file("smcomp.txt", "r");

	if (!in)
		goto err;

	/* Sign content */
	cms = SMIME_read_CMS(in, NULL);

	if (!cms)
		goto err;

	out = BIO_new_file("smuncomp.txt", "w");
	if (!out)
		goto err;

	/* Uncompress S/MIME message */
	if (!CMS_uncompress(cms, out, NULL, 0))
		goto err;

	ret = 0;

	err:

	if (ret)
		{
		fprintf(stderr, "Error Uncompressing Data\n");
		ERR_print_errors_fp(stderr);
		}

	if (cms)
		CMS_ContentInfo_free(cms);

	if (in)
		BIO_free(in);
	if (out)
		BIO_free(out);

	return ret;

	}
开发者ID:0culus,项目名称:openssl,代码行数:51,代码来源:cms_uncomp.c

示例8: cms_Data_create

CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags)
	{
	CMS_ContentInfo *cms;
	cms = cms_Data_create();
	if (!cms)
		return NULL;

	if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags))
		return cms;

	CMS_ContentInfo_free(cms);

	return NULL;
	}
开发者ID:hlcherub,项目名称:src,代码行数:14,代码来源:cms_smime.c

示例9: EVP_sha1

CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
					unsigned int flags)
	{
	CMS_ContentInfo *cms;
	if (!md)
		md = EVP_sha1();
	cms = cms_DigestedData_create(md);
	if (!cms)
		return NULL;

	if(!(flags & CMS_DETACHED))
		CMS_set_detached(cms, 0);

	if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags))
		return cms;

	CMS_ContentInfo_free(cms);
	return NULL;
	}
开发者ID:hlcherub,项目名称:src,代码行数:19,代码来源:cms_smime.c

示例10: CMS_ContentInfo_new

CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher)
{
    CMS_ContentInfo *cms;
    CMS_EnvelopedData *env;
    cms = CMS_ContentInfo_new();
    if (!cms)
        goto merr;
    env = cms_enveloped_data_init(cms);
    if (!env)
        goto merr;
    if (!cms_EncryptedContent_init(env->encryptedContentInfo,
                                   cipher, NULL, 0))
        goto merr;
    return cms;
merr:
    CMS_ContentInfo_free(cms);
    CMSerr(CMS_F_CMS_ENVELOPEDDATA_CREATE, ERR_R_MALLOC_FAILURE);
    return NULL;
}
开发者ID:redshodan,项目名称:mosh-openssl,代码行数:19,代码来源:cms_env.c

示例11: CMSerr

CMS_ContentInfo *cms_CompressedData_create(int comp_nid)
	{
	CMS_ContentInfo *cms;
	CMS_CompressedData *cd;
	/* Will need something cleverer if there is ever more than one
	 * compression algorithm or parameters have some meaning...
	 */
	if (comp_nid != NID_zlib_compression)
		{
		CMSerr(CMS_F_CMS_COMPRESSEDDATA_CREATE,
				CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM);
		return NULL;
		}
	cms = CMS_ContentInfo_new();
	if (!cms)
		return NULL;

	cd = M_ASN1_new_of(CMS_CompressedData);

	if (!cd)
		goto err;

	cms->contentType = OBJ_nid2obj(NID_id_smime_ct_compressedData);
	cms->d.compressedData = cd;

	cd->version = 0;

	X509_ALGOR_set0(cd->compressionAlgorithm,
			OBJ_nid2obj(NID_zlib_compression),
			V_ASN1_UNDEF, NULL);

	cd->encapContentInfo->eContentType = OBJ_nid2obj(NID_pkcs7_data);

	return cms;

	err:

	if (cms)
		CMS_ContentInfo_free(cms);

	return NULL;
	}
开发者ID:002301,项目名称:node,代码行数:42,代码来源:cms_cd.c

示例12: ossl_cms_copy

static VALUE
ossl_cms_copy(VALUE self, VALUE other)
{
    CMS_ContentInfo *a, *b, *cms;

    rb_check_frozen(self);
    if (self == other) return self;

    GetCMS(self, a);
    SafeGetCMS(other, b);

    cms = CMS_ContentInfo_dup(b);
    if (!cms) {
        ossl_raise(eCMSError, NULL);
    }
    DATA_PTR(self) = cms;
    CMS_ContentInfo_free(a);

    return self;
}
开发者ID:sustr4,项目名称:rCMS,代码行数:20,代码来源:ossl_cms.c

示例13: FuzzerTestOneInput

int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
    CMS_ContentInfo *cms;
    BIO *in;

    if (len == 0)
        return 0;

    in = BIO_new(BIO_s_mem());
    OPENSSL_assert((size_t)BIO_write(in, buf, len) == len);
    cms = d2i_CMS_bio(in, NULL);
    if (cms != NULL) {
        BIO *out = BIO_new(BIO_s_null());

        i2d_CMS_bio(out, cms);
        BIO_free(out);
        CMS_ContentInfo_free(cms);
    }

    BIO_free(in);
    ERR_clear_error();

    return 0;
}
开发者ID:Ana06,项目名称:openssl,代码行数:24,代码来源:cms.c

示例14: swupdate_verify_file

int swupdate_verify_file(struct swupdate_digest *dgst, const char *sigfile,
		const char *file, const char *signer_name)
{
	int status = -EFAULT;
	CMS_ContentInfo *cms = NULL;
	BIO *content_bio = NULL;

	/* Open CMS blob that needs to be checked */
	BIO *sigfile_bio = BIO_new_file(sigfile, "rb");
	if (!sigfile_bio) {
		ERROR("%s cannot be opened", sigfile);
		status = -EBADF;
		goto out;
	}

	/* Parse the DER-encoded CMS message */
	cms = d2i_CMS_bio(sigfile_bio, NULL);
	if (!cms) {
		ERROR("%s cannot be parsed as DER-encoded CMS signature blob", sigfile);
		status = -EFAULT;
		goto out;
	}

	if (check_signer_name(cms, signer_name)) {
		ERROR("failed to verify signer name");
		status = -EFAULT;
		goto out;
	}

	/* Open the content file (data which was signed) */
	content_bio = BIO_new_file(file, "rb");
	if (!content_bio) {
		ERROR("%s cannot be opened", file);
		status = -EBADF;
		goto out;
	}

	/* Then try to verify signature */
	if (!CMS_verify(cms, NULL, dgst->certs, content_bio,
			NULL, CMS_BINARY)) {
		ERR_print_errors_fp(stderr);
		ERROR("Signature verification failed");
		status = -EBADMSG;
		goto out;
	}

	TRACE("Verified OK");

	/* Signature is valid */
	status = 0;
out:

	if (cms) {
		CMS_ContentInfo_free(cms);
	}
	if (content_bio) {
		BIO_free(content_bio);
	}
	if (sigfile_bio) {
		BIO_free(sigfile_bio);
	}
	return status;
}
开发者ID:3mdeb,项目名称:swupdate,代码行数:63,代码来源:verify_signature.c

示例15: MAIN


//.........这里部分代码省略.........
            /* NULL these because call absorbs them */
            secret_key = NULL;
            secret_keyid = NULL;
        }
        if (pwri_pass) {
            pwri_tmp = (unsigned char *)BUF_strdup((char *)pwri_pass);
            if (!pwri_tmp)
                goto end;
            if (!CMS_add0_recipient_password(cms,
                                             -1, NID_undef, NID_undef,
                                             pwri_tmp, -1, NULL))
                goto end;
            pwri_tmp = NULL;
        }
        if (!(flags & CMS_STREAM)) {
            if (!CMS_final(cms, in, NULL, flags))
                goto end;
        }
    } else if (operation == SMIME_ENCRYPTED_ENCRYPT) {
        cms = CMS_EncryptedData_encrypt(in, cipher,
                                        secret_key, secret_keylen, flags);

    } else if (operation == SMIME_SIGN_RECEIPT) {
        CMS_ContentInfo *srcms = NULL;
        STACK_OF(CMS_SignerInfo) *sis;
        CMS_SignerInfo *si;
        sis = CMS_get0_SignerInfos(cms);
        if (!sis)
            goto end;
        si = sk_CMS_SignerInfo_value(sis, 0);
        srcms = CMS_sign_receipt(si, signer, key, other, flags);
        if (!srcms)
            goto end;
        CMS_ContentInfo_free(cms);
        cms = srcms;
    } else if (operation & SMIME_SIGNERS) {
        int i;
        /*
         * If detached data content we enable streaming if S/MIME output
         * format.
         */
        if (operation == SMIME_SIGN) {

            if (flags & CMS_DETACHED) {
                if (outformat == FORMAT_SMIME)
                    flags |= CMS_STREAM;
            }
            flags |= CMS_PARTIAL;
            cms = CMS_sign(NULL, NULL, other, in, flags);
            if (!cms)
                goto end;
            if (econtent_type)
                CMS_set1_eContentType(cms, econtent_type);

            if (rr_to) {
                rr = make_receipt_request(rr_to, rr_allorfirst, rr_from);
                if (!rr) {
                    BIO_puts(bio_err,
                             "Signed Receipt Request Creation Error\n");
                    goto end;
                }
            }
        } else
            flags |= CMS_REUSE_DIGEST;
        for (i = 0; i < sk_OPENSSL_STRING_num(sksigners); i++) {
            CMS_SignerInfo *si;
开发者ID:davidlt,项目名称:openssl-fedora,代码行数:67,代码来源:cms.c


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