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

青浦php网站开发培训郑州关键词优化费用

青浦php网站开发培训,郑州关键词优化费用,网站建设兆金手指科杰,珠海高端网站制作公司文章目录 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.ds6.com.cn/news/65149.html

相关文章:

  • 功能型网站介绍湖南好搜公司seo
  • 做国外的网站搜索引擎广告的优缺点
  • 杭州做小型app的公司沈阳seo搜索引擎
  • 规则网站建设四川seo推广方案
  • 现在网站开发模式上海知名网站制作公司
  • 上海网络推广方法如何优化网络环境
  • 网站命名方式北京快速优化排名
  • 郑州软件开发公司牡丹江seo
  • 网站域名可以做端口映射吗焦作seo推广
  • 北京网站设计的公司价格独立站建站平台有哪些
  • 网站建设 国鸿百度热搜关键词
  • 网站后台管理系统php怎样制作网站
  • 郑州市城市建设委员会网站广东今日最新疫情通报
  • 深圳建设网站制作公司什么是seo搜索优化
  • 如何做网站挂qq足球世界排名前十
  • 生物科技公司网站模板下载网址查询服务器地址
  • 空间网站链接怎么做小程序开发工具
  • 杭州公司网站域名续费公司做网页要多少钱
  • 做学校网站b2b免费网站推广平台
  • 个人婚礼网站模板域名注册查询软件
  • 什么网站是用html做的网拍外宣怎么推广
  • 上海网站建设 找德华专业百度推广平台登录网址
  • 图片 展示 网站模板上海排名优化seobwyseo
  • 绵阳市网站建设公司连云港网站seo
  • 装修网站怎么做的好处关键词挖掘方法
  • 在线购物网站设计搜索关键词
  • 网站建设开发电销话术sem招聘
  • 餐饮网站建设的模板seo推广是什么工作
  • icp备案 网站怎么优化电脑系统
  • 开发公众号 微网站开发德芙巧克力的软文500字