当前位置: 首页 > news >正文

沈阳网络推广建站如何自己做收费的视频网站

沈阳网络推广建站,如何自己做收费的视频网站,推广网络营销外包,茂名免费做网站文章目录 openssl3.2 - 官方demo学习 - smime - smenc.c概述笔记END openssl3.2 - 官方demo学习 - smime - smenc.c 概述 读取X509证书, 用PKCS7加密明文(证书 明文 3DES_CBC), 保存为MIME格式的密文 openssl API的命名含义 BIO_new_file “new” a “file”, return a “…

文章目录

    • openssl3.2 - 官方demo学习 - smime - smenc.c
    • 概述
    • 笔记
    • END

openssl3.2 - 官方demo学习 - smime - smenc.c

概述

读取X509证书, 用PKCS7加密明文(证书 + 明文 + 3DES_CBC), 保存为MIME格式的密文

openssl API的命名含义

BIO_new_file
“new” a “file”, return a “BIO” object

PEM_read_bio_X509() Read a certificate in PEM format from a BIO
data format is “PEM”, “read” from “bio”, return a object type is “X509”

笔记

/*!
\file smenc.c
\note
openssl3.2 - 官方demo学习 - smime - smenc.c
读取X509证书, 用PKCS7加密明文(证书 + 明文 + 3DES_CBC), 保存为MIME格式的密文openssl API的命名含义BIO_new_file
"new" a "file", return a "BIO" objectPEM_read_bio_X509() Read a certificate in PEM format from a BIO
data format is "PEM", "read" from "bio", return a object type is "X509"
*//** Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.** Licensed under the Apache License 2.0 (the "License").  You may not use* this file except in compliance with the License.  You can obtain a copy* in the file LICENSE in the source distribution or at* https://www.openssl.org/source/license.html*//* Simple S/MIME encrypt example */
#include <openssl/pem.h>
#include <openssl/pkcs7.h>
#include <openssl/err.h>#include "my_openSSL_lib.h"int main(int argc, char** argv)
{BIO* _bio_in = NULL, * _bio_out = NULL, * _bio_t = NULL;X509* _x509_r = NULL;STACK_OF(X509)* _sk_x509 = NULL;PKCS7* _pkcs7 = NULL;int ret = EXIT_FAILURE;/** On OpenSSL 0.9.9 only:* for streaming set PKCS7_STREAM*/int flags_encrypt = PKCS7_STREAM;OpenSSL_add_all_algorithms();ERR_load_crypto_strings();/* Read in recipient certificate */_bio_t = BIO_new_file("signer.pem", "r");if (!_bio_t)goto err;_x509_r = PEM_read_bio_X509(_bio_t, NULL, 0, NULL);if (!_x509_r)goto err;/* Create recipient STACK and add recipient cert to it */_sk_x509 = sk_X509_new_null();if (!_sk_x509 || !sk_X509_push(_sk_x509, _x509_r))goto err;/** OSSL_STACK_OF_X509_free() will free up recipient STACK and its contents* so set rcert to NULL so it isn't freed up twice.*/_x509_r = NULL;/* Open content being encrypted */_bio_in = BIO_new_file("encr.txt", "r");if (!_bio_in)goto err;/* encrypt content */_pkcs7 = PKCS7_encrypt(_sk_x509, _bio_in, EVP_des_ede3_cbc(), flags_encrypt);if (!_pkcs7)goto err;_bio_out = BIO_new_file("smencr.txt", "w");if (!_bio_out)goto err;/* Write out S/MIME message */if (!SMIME_write_PKCS7(_bio_out, _pkcs7, _bio_in, flags_encrypt))goto err;ret = EXIT_SUCCESS;err:if (ret != EXIT_SUCCESS) {fprintf(stderr, "Error Encrypting Data\n");ERR_print_errors_fp(stderr);}PKCS7_free(_pkcs7);X509_free(_x509_r);OSSL_STACK_OF_X509_free(_sk_x509);BIO_free(_bio_in);BIO_free(_bio_out);BIO_free(_bio_t);return ret;}

END

http://www.yayakq.cn/news/648581/

相关文章:

  • 南京 微网站 建站餐饮分销系统开发
  • 创建网站的工具wordpress 百度收录
  • 山西网站建设报价单html5网站带后台
  • 13个优质平面设计网站推荐帝国cms做中英文网站
  • 网站域名过期后续费多长时间生效公司网站开发的核心技术
  • 粉红色网站asp新浪sae 搭建wordpress
  • 网站制作谁家好企业查询app
  • 广东网站设计粮食门户网站建设方案
  • 网站营销外包如何做泉州建站模板搭建
  • wordpress设置会员下载北京seo优化诊断
  • 直接IP做访问我服务器的网站摄影网站建站
  • 网站建设佛山乐趣浏览器app下载
  • 高校后勤网站建设要求网站备案填写电话号码
  • 免费自助创建网站像wordpress一样的网站
  • com域名和网站域名注册网站便宜
  • 寿光网站制作深圳做网站什么公司好
  • 正规网站备案信息表wordpress 换域名 403
  • 做得比较好的公司网站棋牌软件开发平台
  • 阿里云建wordpress站自己做软件 做网站需要学会哪些
  • 番禺做网站设计做学校网站
  • 网站域名备案后公示百度应用商店
  • 跟网站开发有关的内容百度seo教程视频
  • win8风格网站开发实例哈尔滨网站建设哪家好
  • 做团购网站需要什么资质开发平台教程
  • 网站建设最便宜多少钱网站建设构成
  • 网站图片 优化凡科互动官网登录入口官方
  • 金华市建设监理协会网站大型淘宝客返利网站建设
  • 加强机构编制网站建设力度个人网站申请备案
  • 网站怎样备案常德做网站多少钱
  • 做炭化料的网站济南网站建设seo优化