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

行业垂直网站开发网站引流推广怎么做

行业垂直网站开发,网站引流推广怎么做,中小型网站服务器搭建方案,软件商店推荐文章目录 openssl3.2 - 官方demo学习 - encode - rsa_encode.c概述笔记END openssl3.2 - 官方demo学习 - encode - rsa_encode.c 概述 命令行参数 server_priv_key.pem client_priv_key.pem 这2个证书是前面certs目录里面做的 官方这个程序有bug, 给出2个证书, 还要从屏幕上输…

文章目录

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

openssl3.2 - 官方demo学习 - encode - rsa_encode.c

概述

命令行参数 server_priv_key.pem client_priv_key.pem
这2个证书是前面certs目录里面做的
官方这个程序有bug, 给出2个证书, 还要从屏幕上输入
if (OSSL_DECODER_from_fp(dctx, f) == 0) { /*< 在这里阻塞住了, 让在屏幕上输入东西, 让我输入啥啊 ?
关键是输入了, 回车也不返回程序.
先放这里, 等整明白了, 再来修正这个工程.

笔记

/*!
\file rsa_encode.c
\note openssl3.2 - 官方demo学习 - encode - rsa_encode.c
命令行参数 server_priv_key.pem client_priv_key.pem
这2个证书是前面certs目录里面做的
官方这个程序有bug, 给出2个证书, 还要从屏幕上输入
if (OSSL_DECODER_from_fp(dctx, f) == 0) { /*< 在这里阻塞住了, 让在屏幕上输入东西, 让我输入啥啊 ? 
关键是输入了, 回车也不返回程序.
先放这里, 等整明白了, 再来修正这个工程.
*//*-* Copyright 2022-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*/
#include <string.h>
#include <openssl/decoder.h>
#include <openssl/encoder.h>
#include <openssl/evp.h>#include "my_openSSL_lib.h"/** Example showing the encoding and decoding of RSA public and private keys. A* PEM-encoded RSA key is read in from stdin, decoded, and then re-encoded and* output for demonstration purposes. Both public and private keys are accepted.** This can be used to load RSA keys from a file or save RSA keys to a file.*//* A property query used for selecting algorithm implementations. */
static const char* propq = NULL;/** Load a PEM-encoded RSA key from a file, optionally decrypting it with a* supplied passphrase.*/
static EVP_PKEY* load_key(OSSL_LIB_CTX* libctx, FILE* f, const char* passphrase)
{int ret = 0;EVP_PKEY* pkey = NULL;OSSL_DECODER_CTX* dctx = NULL;int selection = 0;/** Create PEM decoder context expecting an RSA key.** For raw (non-PEM-encoded) keys, change "PEM" to "DER".** The selection argument here specifies whether we are willing to accept a* public key, private key, or either. If it is set to zero, either will be* accepted. If set to EVP_PKEY_KEYPAIR, a private key will be required, and* if set to EVP_PKEY_PUBLIC_KEY, a public key will be required.*/dctx = OSSL_DECODER_CTX_new_for_pkey(&pkey, "PEM", NULL, "RSA",selection,libctx, propq);if (dctx == NULL) {fprintf(stderr, "OSSL_DECODER_CTX_new_for_pkey() failed\n");goto cleanup;}/** Set passphrase if provided; needed to decrypt encrypted PEM files.* If the input is not encrypted, any passphrase provided is ignored.** Alternative methods for specifying passphrases exist, such as a callback* (see OSSL_DECODER_CTX_set_passphrase_cb(3)), which may be more useful for* interactive applications which do not know if a passphrase should be* prompted for in advance, or for GUI applications.*/if (passphrase != NULL) {if (OSSL_DECODER_CTX_set_passphrase(dctx,(const unsigned char*)passphrase,strlen(passphrase)) == 0) {fprintf(stderr, "OSSL_DECODER_CTX_set_passphrase() failed\n");goto cleanup;}}/* Do the decode, reading from file. */if (OSSL_DECODER_from_fp(dctx, f) == 0) { /*< 在这里阻塞住了, 让在屏幕上输入东西, 让我输入啥啊 ? */ fprintf(stderr, "OSSL_DECODER_from_fp() failed\n");goto cleanup;}ret = 1;
cleanup:OSSL_DECODER_CTX_free(dctx);/** pkey is created by OSSL_DECODER_CTX_new_for_pkey, but we* might fail subsequently, so ensure it's properly freed* in this case.*/if (ret == 0) {EVP_PKEY_free(pkey);pkey = NULL;}return pkey;
}/** Store an RSA public or private key to a file using PEM encoding.** If a passphrase is supplied, the file is encrypted, otherwise* it is unencrypted.*/
static int store_key(EVP_PKEY* pkey, FILE* f, const char* passphrase)
{int ret = 0;int selection;OSSL_ENCODER_CTX* ectx = NULL;/** Create a PEM encoder context.** For raw (non-PEM-encoded) output, change "PEM" to "DER".** The selection argument controls whether the private key is exported* (EVP_PKEY_KEYPAIR), or only the public key (EVP_PKEY_PUBLIC_KEY). The* former will fail if we only have a public key.** Note that unlike the decode API, you cannot specify zero here.** Purely for the sake of demonstration, here we choose to export the whole* key if a passphrase is provided and the public key otherwise.*/selection = (passphrase != NULL)? EVP_PKEY_KEYPAIR: EVP_PKEY_PUBLIC_KEY;ectx = OSSL_ENCODER_CTX_new_for_pkey(pkey, selection, "PEM", NULL, propq);if (ectx == NULL) {fprintf(stderr, "OSSL_ENCODER_CTX_new_for_pkey() failed\n");goto cleanup;}/** Set passphrase if provided; the encoded output will then be encrypted* using the passphrase.** Alternative methods for specifying passphrases exist, such as a callback* (see OSSL_ENCODER_CTX_set_passphrase_cb(3), just as for OSSL_DECODER_CTX;* however you are less likely to need them as you presumably know whether* encryption is desired in advance.** Note that specifying a passphrase alone is not enough to cause the* key to be encrypted. You must set both a cipher and a passphrase.*/if (passphrase != NULL) {/* Set cipher. AES-128-CBC is a reasonable default. */if (OSSL_ENCODER_CTX_set_cipher(ectx, "AES-128-CBC", propq) == 0) {fprintf(stderr, "OSSL_ENCODER_CTX_set_cipher() failed\n");goto cleanup;}/* Set passphrase. */if (OSSL_ENCODER_CTX_set_passphrase(ectx,(const unsigned char*)passphrase,strlen(passphrase)) == 0) {fprintf(stderr, "OSSL_ENCODER_CTX_set_passphrase() failed\n");goto cleanup;}}/* Do the encode, writing to the given file. */if (OSSL_ENCODER_to_fp(ectx, f) == 0) {fprintf(stderr, "OSSL_ENCODER_to_fp() failed\n");goto cleanup;}ret = 1;
cleanup:OSSL_ENCODER_CTX_free(ectx);return ret;
}int main(int argc, char** argv)
{int ret = EXIT_FAILURE;OSSL_LIB_CTX* _ossl_lib_ctx = NULL;EVP_PKEY* _evp_pkey = NULL;const char* passphrase_in = NULL, * passphrase_out = NULL;/* usage: rsa_encode <passphrase-in> <passphrase-out> */if (argc > 1 && argv[1][0])passphrase_in = argv[1];if (argc > 2 && argv[2][0])passphrase_out = argv[2];/* Decode PEM key from stdin and then PEM encode it to stdout. */_evp_pkey = load_key(_ossl_lib_ctx, stdin, passphrase_in);if (_evp_pkey == NULL) {fprintf(stderr, "Failed to decode key\n");goto cleanup;}if (store_key(_evp_pkey, stdout, passphrase_out) == 0) {fprintf(stderr, "Failed to encode key\n");goto cleanup;}ret = EXIT_SUCCESS;
cleanup:EVP_PKEY_free(_evp_pkey);OSSL_LIB_CTX_free(_ossl_lib_ctx);return ret;
}

END


文章转载自:
http://looking.pwmm.cn
http://helipad.pwmm.cn
http://gangleader.pwmm.cn
http://minacity.pwmm.cn
http://scylla.pwmm.cn
http://purpresture.pwmm.cn
http://jmb.pwmm.cn
http://taximan.pwmm.cn
http://unmarked.pwmm.cn
http://branchiate.pwmm.cn
http://donative.pwmm.cn
http://explosively.pwmm.cn
http://heartfelt.pwmm.cn
http://tissular.pwmm.cn
http://victimization.pwmm.cn
http://ethnocentrism.pwmm.cn
http://athanasian.pwmm.cn
http://hypoendocrinism.pwmm.cn
http://benthograph.pwmm.cn
http://troublemaker.pwmm.cn
http://abu.pwmm.cn
http://photophase.pwmm.cn
http://midair.pwmm.cn
http://verglas.pwmm.cn
http://fluridizer.pwmm.cn
http://parroquet.pwmm.cn
http://drug.pwmm.cn
http://extemporarily.pwmm.cn
http://immuration.pwmm.cn
http://westernmost.pwmm.cn
http://reflectible.pwmm.cn
http://impropriety.pwmm.cn
http://additivity.pwmm.cn
http://mantelshelf.pwmm.cn
http://dissimilation.pwmm.cn
http://imo.pwmm.cn
http://lunular.pwmm.cn
http://wean.pwmm.cn
http://venesector.pwmm.cn
http://faddle.pwmm.cn
http://episodic.pwmm.cn
http://miss.pwmm.cn
http://telega.pwmm.cn
http://fissile.pwmm.cn
http://unsalted.pwmm.cn
http://precontract.pwmm.cn
http://nucleogenesis.pwmm.cn
http://sinography.pwmm.cn
http://many.pwmm.cn
http://petrograph.pwmm.cn
http://dayglow.pwmm.cn
http://before.pwmm.cn
http://costae.pwmm.cn
http://carices.pwmm.cn
http://branny.pwmm.cn
http://unprotestantize.pwmm.cn
http://customarily.pwmm.cn
http://simplify.pwmm.cn
http://biome.pwmm.cn
http://gunboat.pwmm.cn
http://scud.pwmm.cn
http://effector.pwmm.cn
http://asper.pwmm.cn
http://retina.pwmm.cn
http://rhochrematician.pwmm.cn
http://retard.pwmm.cn
http://wiping.pwmm.cn
http://hurl.pwmm.cn
http://jargonise.pwmm.cn
http://cardiogenic.pwmm.cn
http://lemur.pwmm.cn
http://sylleptic.pwmm.cn
http://nameable.pwmm.cn
http://fugacity.pwmm.cn
http://abortus.pwmm.cn
http://discern.pwmm.cn
http://aftereffect.pwmm.cn
http://pernickety.pwmm.cn
http://irishwoman.pwmm.cn
http://macaroon.pwmm.cn
http://martlet.pwmm.cn
http://uplooking.pwmm.cn
http://electronics.pwmm.cn
http://sinkful.pwmm.cn
http://trustify.pwmm.cn
http://psychomimetic.pwmm.cn
http://weazen.pwmm.cn
http://surjection.pwmm.cn
http://predaceous.pwmm.cn
http://celebrant.pwmm.cn
http://luchuan.pwmm.cn
http://purposely.pwmm.cn
http://guffaw.pwmm.cn
http://marksman.pwmm.cn
http://damper.pwmm.cn
http://bersagliere.pwmm.cn
http://informationless.pwmm.cn
http://archivolt.pwmm.cn
http://pokey.pwmm.cn
http://pangola.pwmm.cn
http://www.dt0577.cn/news/80742.html

相关文章:

  • 郑州市做网站的电商网站设计论文
  • 网站建设店铺介绍怎么写河南网站建设报价
  • 网站怎么做谷歌推广最近三天的国际新闻大事
  • 信息空间网站好网站优化教程
  • 怎样做自己可以发布消息的网站windows优化大师卸载
  • 东营人力资源考试信息网官网厦门网站优化
  • 商城网站验收长沙企业关键词优化哪家好
  • php和java做网站哪个简单点seo的形式有哪些
  • e网站的图标怎么做知乎关键词排名优化
  • ps 怎么做网站网址提交入口
  • 路由器做网站80端口品牌运营推广方案
  • 做网站怎么盈利设计师培训班多少钱
  • 怎么看网站开发语言培训班线上优化
  • 有了页游源代码如何做网站长春网站建设公司
  • 做设计学什么英语比较好的网站销售培训课程一般有哪些
  • 门户网站建设目的长春免费网上推广
  • 可以做ps兼职的网站搜索大全
  • 医疗网站备案要怎么做 需要准备什么材料百度竞价排名公司
  • 河南最新新闻事件今天鄂尔多斯seo
  • 帮人做图挣外快的网站seo入门培训课程
  • 罗湖做网站房地产最新消息
  • html5高端酒水饮料企业网站模版刷百度关键词排名
  • 东营网站建设tt0546广告联盟全自动赚钱系统
  • 织梦网站301跳转怎么做江苏seo团队
  • 宁波外贸网站制作个人怎么开跨境电商店铺
  • 太平洋手机官方网站百度域名查询官网
  • 重庆电商平台网站建设网站热度查询
  • 全球包装设计网长春seo技术
  • 黄山网站优化青岛网站推广系统
  • 做网站需要买数据推广公司