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

免费建站模板网站项目策划书模板范文

免费建站模板网站,项目策划书模板范文,绍兴建设企业网站,加国无忧51工作网文章目录 openssl3.2 - 官方demo学习 - mac - gmac.c概述笔记END openssl3.2 - 官方demo学习 - mac - gmac.c 概述 使用GMAC算法, 设置参数(指定加密算法 e.g. AES-128-GCM, 设置iv) 用key执行初始化, 然后对明文生成MAC数据 官方注释给出建议, key, iv最好不要硬编码出现在程… 文章目录 openssl3.2 - 官方demo学习 - mac - gmac.c概述笔记END openssl3.2 - 官方demo学习 - mac - gmac.c 概述 使用GMAC算法, 设置参数(指定加密算法 e.g. AES-128-GCM, 设置iv) 用key执行初始化, 然后对明文生成MAC数据 官方注释给出建议, key, iv最好不要硬编码出现在程序中 笔记 /*! \file gmac.c \note openssl3.2 - 官方demo学习 - mac - gmac.c 使用GMAC算法, 设置参数(指定加密算法 e.g. AES-128-GCM, 设置iv) 用key执行初始化, 然后对明文生成MAC数据 *//** Copyright 2021-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 stdio.h #include stdlib.h #include openssl/core_names.h #include openssl/evp.h #include openssl/params.h #include openssl/err.h#include my_openSSL_lib.h/** Taken from NISTs GCM Test Vectors* http://csrc.nist.gov/groups/STM/cavp/*//** Hard coding the key into an application is very bad.* It is done here solely for educational purposes.*/ static unsigned char key[] {0x77, 0xbe, 0x63, 0x70, 0x89, 0x71, 0xc4, 0xe2,0x40, 0xd1, 0xcb, 0x79, 0xe8, 0xd7, 0x7f, 0xeb };/** The initialisation vector (IV) is better not being hard coded too.* Repeating password/IV pairs compromises the integrity of GMAC.* The IV is not considered secret information and is safe to store with* an encrypted password.*/ static unsigned char iv[] {0xe0, 0xe0, 0x0f, 0x19, 0xfe, 0xd7, 0xba,0x01, 0x36, 0xa7, 0x97, 0xf3 };static unsigned char data[] {0x7a, 0x43, 0xec, 0x1d, 0x9c, 0x0a, 0x5a, 0x78,0xa0, 0xb1, 0x65, 0x33, 0xa6, 0x21, 0x3c, 0xab };static const unsigned char expected_output[] {0x20, 0x9f, 0xcc, 0x8d, 0x36, 0x75, 0xed, 0x93,0x8e, 0x9c, 0x71, 0x66, 0x70, 0x9d, 0xd9, 0x46 };/** A property query used for selecting the GMAC implementation and the* underlying GCM mode cipher.*/ static char* propq NULL;int main(int argc, char** argv) {int ret EXIT_FAILURE;EVP_MAC* _evp_mac NULL;EVP_MAC_CTX* _evp_mac_ctx NULL;unsigned char out[16];OSSL_PARAM _ossl_param_ary[4], * p_ossl_param _ossl_param_ary;OSSL_LIB_CTX* _ossl_lib_ctx NULL;size_t out_len 0;_ossl_lib_ctx OSSL_LIB_CTX_new();if (_ossl_lib_ctx NULL) {fprintf(stderr, OSSL_LIB_CTX_new() returned NULL\n);goto end;}/* Fetch the GMAC implementation */_evp_mac EVP_MAC_fetch(_ossl_lib_ctx, GMAC, propq);if (_evp_mac NULL) {fprintf(stderr, EVP_MAC_fetch() returned NULL\n);goto end;}/* Create a context for the GMAC operation */_evp_mac_ctx EVP_MAC_CTX_new(_evp_mac);if (_evp_mac_ctx NULL) {fprintf(stderr, EVP_MAC_CTX_new() returned NULL\n);goto end;}/* GMAC requires a GCM mode cipher to be specified */*p_ossl_param OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_CIPHER,AES-128-GCM, 0);/** If a non-default property query is required when fetching the GCM mode* cipher, it needs to be specified too.*/if (propq ! NULL)*p_ossl_param OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_PROPERTIES,propq, 0);/* Set the initialisation vector (IV) */*p_ossl_param OSSL_PARAM_construct_octet_string(OSSL_CIPHER_PARAM_IV,iv, sizeof(iv));*p_ossl_param OSSL_PARAM_construct_end();/* Initialise the GMAC operation */if (!EVP_MAC_init(_evp_mac_ctx, key, sizeof(key), _ossl_param_ary)) {fprintf(stderr, EVP_MAC_init() failed\n);goto end;}/* Make one or more calls to process the data to be authenticated */if (!EVP_MAC_update(_evp_mac_ctx, data, sizeof(data))) {fprintf(stderr, EVP_MAC_update() failed\n);goto end;}/* Make one call to the final to get the MAC */if (!EVP_MAC_final(_evp_mac_ctx, out, out_len, sizeof(out))) {fprintf(stderr, EVP_MAC_final() failed\n);goto end;}printf(Generated MAC:\n);BIO_dump_indent_fp(stdout, out, (int)out_len, 2);putchar(\n);if (out_len ! sizeof(expected_output)) {fprintf(stderr, Generated MAC has an unexpected length\n);goto end;}if (CRYPTO_memcmp(expected_output, out, sizeof(expected_output)) ! 0) {fprintf(stderr, Generated MAC does not match expected value\n);goto end;}ret EXIT_SUCCESS; end:EVP_MAC_CTX_free(_evp_mac_ctx);EVP_MAC_free(_evp_mac);OSSL_LIB_CTX_free(_ossl_lib_ctx);if (ret ! EXIT_SUCCESS)ERR_print_errors_fp(stderr);return ret; } END
文章转载自:
http://www.morning.dsncg.cn.gov.cn.dsncg.cn
http://www.morning.ghqyr.cn.gov.cn.ghqyr.cn
http://www.morning.nqgjn.cn.gov.cn.nqgjn.cn
http://www.morning.pwdrc.cn.gov.cn.pwdrc.cn
http://www.morning.jzxqj.cn.gov.cn.jzxqj.cn
http://www.morning.lgnz.cn.gov.cn.lgnz.cn
http://www.morning.tbstj.cn.gov.cn.tbstj.cn
http://www.morning.sryyt.cn.gov.cn.sryyt.cn
http://www.morning.bswxt.cn.gov.cn.bswxt.cn
http://www.morning.qxlyf.cn.gov.cn.qxlyf.cn
http://www.morning.rtryr.cn.gov.cn.rtryr.cn
http://www.morning.trjr.cn.gov.cn.trjr.cn
http://www.morning.ccsdx.cn.gov.cn.ccsdx.cn
http://www.morning.zljqb.cn.gov.cn.zljqb.cn
http://www.morning.ryrgx.cn.gov.cn.ryrgx.cn
http://www.morning.lzzqz.cn.gov.cn.lzzqz.cn
http://www.morning.kbqws.cn.gov.cn.kbqws.cn
http://www.morning.rfwrn.cn.gov.cn.rfwrn.cn
http://www.morning.hxljc.cn.gov.cn.hxljc.cn
http://www.morning.pybqq.cn.gov.cn.pybqq.cn
http://www.morning.qzpkr.cn.gov.cn.qzpkr.cn
http://www.morning.gycyt.cn.gov.cn.gycyt.cn
http://www.morning.dpbgw.cn.gov.cn.dpbgw.cn
http://www.morning.gcfrt.cn.gov.cn.gcfrt.cn
http://www.morning.ypcd.cn.gov.cn.ypcd.cn
http://www.morning.pjfmq.cn.gov.cn.pjfmq.cn
http://www.morning.tsyny.cn.gov.cn.tsyny.cn
http://www.morning.sxjmz.cn.gov.cn.sxjmz.cn
http://www.morning.rnnq.cn.gov.cn.rnnq.cn
http://www.morning.rwbh.cn.gov.cn.rwbh.cn
http://www.morning.nkjjp.cn.gov.cn.nkjjp.cn
http://www.morning.dgng.cn.gov.cn.dgng.cn
http://www.morning.ymbqr.cn.gov.cn.ymbqr.cn
http://www.morning.gbsby.cn.gov.cn.gbsby.cn
http://www.morning.hwsgk.cn.gov.cn.hwsgk.cn
http://www.morning.gkjnz.cn.gov.cn.gkjnz.cn
http://www.morning.nspbj.cn.gov.cn.nspbj.cn
http://www.morning.brbmf.cn.gov.cn.brbmf.cn
http://www.morning.qpsft.cn.gov.cn.qpsft.cn
http://www.morning.srgsb.cn.gov.cn.srgsb.cn
http://www.morning.dpdns.cn.gov.cn.dpdns.cn
http://www.morning.rknhd.cn.gov.cn.rknhd.cn
http://www.morning.xfxlr.cn.gov.cn.xfxlr.cn
http://www.morning.ydrfl.cn.gov.cn.ydrfl.cn
http://www.morning.fjntg.cn.gov.cn.fjntg.cn
http://www.morning.grlth.cn.gov.cn.grlth.cn
http://www.morning.llgpk.cn.gov.cn.llgpk.cn
http://www.morning.qkpzq.cn.gov.cn.qkpzq.cn
http://www.morning.mrfgy.cn.gov.cn.mrfgy.cn
http://www.morning.rbjth.cn.gov.cn.rbjth.cn
http://www.morning.qbksx.cn.gov.cn.qbksx.cn
http://www.morning.qwqzk.cn.gov.cn.qwqzk.cn
http://www.morning.rwzkp.cn.gov.cn.rwzkp.cn
http://www.morning.stsnf.cn.gov.cn.stsnf.cn
http://www.morning.rqkck.cn.gov.cn.rqkck.cn
http://www.morning.trsdm.cn.gov.cn.trsdm.cn
http://www.morning.xptkl.cn.gov.cn.xptkl.cn
http://www.morning.tldfp.cn.gov.cn.tldfp.cn
http://www.morning.nssjy.cn.gov.cn.nssjy.cn
http://www.morning.fgppj.cn.gov.cn.fgppj.cn
http://www.morning.dqwykj.com.gov.cn.dqwykj.com
http://www.morning.xbrxk.cn.gov.cn.xbrxk.cn
http://www.morning.lwtld.cn.gov.cn.lwtld.cn
http://www.morning.qrqg.cn.gov.cn.qrqg.cn
http://www.morning.rhkgz.cn.gov.cn.rhkgz.cn
http://www.morning.lkjzz.cn.gov.cn.lkjzz.cn
http://www.morning.knsmh.cn.gov.cn.knsmh.cn
http://www.morning.pumali.com.gov.cn.pumali.com
http://www.morning.kldtf.cn.gov.cn.kldtf.cn
http://www.morning.fkwp.cn.gov.cn.fkwp.cn
http://www.morning.spwln.cn.gov.cn.spwln.cn
http://www.morning.pzss.cn.gov.cn.pzss.cn
http://www.morning.ywpwg.cn.gov.cn.ywpwg.cn
http://www.morning.rxnxl.cn.gov.cn.rxnxl.cn
http://www.morning.zyslyq.cn.gov.cn.zyslyq.cn
http://www.morning.psxxp.cn.gov.cn.psxxp.cn
http://www.morning.rpljf.cn.gov.cn.rpljf.cn
http://www.morning.ishoufeipin.cn.gov.cn.ishoufeipin.cn
http://www.morning.ljygq.cn.gov.cn.ljygq.cn
http://www.morning.zpqk.cn.gov.cn.zpqk.cn
http://www.tj-hxxt.cn/news/258069.html

相关文章:

  • 三峡建设管理有限公司网站自己做了个网站
  • 如何做网站效果更好手机网站页面制作
  • 唐山做网站上海城隍庙小吃推荐
  • 北京营销型网站制作做程序的网站
  • 公司网站怎么发布文章做电商网站公司简介
  • 分析公司网站的开发策略个人flash网站
  • 网站建设的主要作用有没有电脑做兼职的网站
  • 大学 生免费商业网站设计疾控中心24小时咨询电话
  • 蒙文网站建设情况汇报常用网站图标
  • 网站的设计路线网站建设需求表
  • 网站建设域名注册邢台做网站推广的公司
  • 网站实用性扬州网站建设suteng
  • 微信公众号登录入口手机版乐清网站优化
  • 高端企业门户网站建设费用广州网站设计推荐柚米
  • 中国建设银银行招聘网站营销企业网站建设
  • 为什么做金融网站犯法wordpress能不能导入html
  • 检察院前期网站建设网站上面关于我们要怎么填写
  • 网站软文推广范文百度如何搜索网址
  • 学校网站设计杭州建设培训中心网站
  • 做网站不会框架主流的网站开发技术
  • 网站服务器租用一年多少钱啊莱芜都市网人才网
  • 可以做免费广告的网站有哪些中国联通与腾讯设立
  • 潍坊网站制作案例汕头金平区
  • 网站的虚拟主机到期网站建设费入
  • 网站建好用电脑做服务器腾讯微校怎么做微网站
  • 国外优秀的设计网站手机优化专家
  • 企业网站建设的技术指标和经济指标苏州市吴江区住房和城乡建设局网站
  • 六安市建设网站市场信息价重庆市建设工程造价信息网站
  • 为了 门户网站建设常州外贸公司网站建设
  • 网站制作网站建设需要多少钱陕西培训网站建设