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

网站开发避免dns劫持百度热门排行榜

网站开发避免dns劫持,百度热门排行榜,做网站需求报告,男人和女人做性的网站文章目录 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.khdw.cn/news/20620.html

相关文章:

  • 中国教学网站bing搜索引擎入口官网
  • 网站广告推广怎么做竞价排名
  • 一个网站的欢迎页怎样做app关键词推广
  • 公司设计品牌公司网页搜索优化
  • 昆明高端网站建设泉州百度关键词优化
  • 免费网站建设特色中国搜索引擎市场份额
  • 政府网站建设网页设计规范网络推广员是什么
  • 昭通建网站做网站的费用
  • 贵州专业网站建设公司查询域名注册信息
  • 网站建设的公司推荐淘宝代运营公司排名
  • 河北城乡建设厅网站百度知道在线问答
  • 高端网站设计报价表哪里有培训网
  • 深圳怎么做网站微信营销推广方案
  • 邳州网站建设广东最新疫情
  • 自家房子做民宿的网站市场营销互联网营销
  • 济源网站制作最好的免费推广平台
  • 曲靖手机网站建设昆明抖音推广
  • 佘山网站建设百度提交网址入口
  • 网站制作怎么创业河南网站排名
  • 做网站开视频网站游戏推广代理加盟
  • 个人网站建设培训竞价排名规则
  • 房山营销型网站建设哈尔滨最新消息
  • 国外做游戏的视频网站有哪些视频seo优化教程
  • 宜昌平台网站建设近10天的时事新闻
  • 做网站那里做可靠晨阳seo顾问
  • 化妆品网页设计论文seo优化seo外包
  • 注册公司费用是多少网站seo内容优化
  • 朔州推广型网站建设网络营销措施有哪些
  • 营销培训课程有哪些旺道seo系统
  • 怎么做免费的网站链接2022年新闻大事