openssl3.2 - exp - 选择最好的内建椭圆曲线

文章目录

    • openssl3.2 - exp - 选择最好的内建椭圆曲线
    • 概述
    • 笔记
    • 将 openssl ecparam -list_curves 实现迁移到自己的demo工程
    • 备注
    • END

openssl3.2 - exp - 选择最好的内建椭圆曲线

概述

在openssl中使用椭圆曲线, 只允许选择椭圆曲线的名字, 无法给定椭圆曲线的位数.
估计每种椭圆曲线都有固定的位数(bit prime field)
openssl.exe有命令可以列出全部的椭圆曲线列表

openssl ecparam -list_curves


D:\my_tmp>openssl ecparam -list_curvessecp112r1 : SECG/WTLS curve over a 112 bit prime fieldsecp112r2 : SECG curve over a 112 bit prime fieldsecp128r1 : SECG curve over a 128 bit prime fieldsecp128r2 : SECG curve over a 128 bit prime fieldsecp160k1 : SECG curve over a 160 bit prime fieldsecp160r1 : SECG curve over a 160 bit prime fieldsecp160r2 : SECG/WTLS curve over a 160 bit prime fieldsecp192k1 : SECG curve over a 192 bit prime fieldsecp224k1 : SECG curve over a 224 bit prime fieldsecp224r1 : NIST/SECG curve over a 224 bit prime fieldsecp256k1 : SECG curve over a 256 bit prime fieldsecp384r1 : NIST/SECG curve over a 384 bit prime fieldsecp521r1 : NIST/SECG curve over a 521 bit prime fieldprime192v1: NIST/X9.62/SECG curve over a 192 bit prime fieldprime192v2: X9.62 curve over a 192 bit prime fieldprime192v3: X9.62 curve over a 192 bit prime fieldprime239v1: X9.62 curve over a 239 bit prime fieldprime239v2: X9.62 curve over a 239 bit prime fieldprime239v3: X9.62 curve over a 239 bit prime fieldprime256v1: X9.62/SECG curve over a 256 bit prime fieldsect113r1 : SECG curve over a 113 bit binary fieldsect113r2 : SECG curve over a 113 bit binary fieldsect131r1 : SECG/WTLS curve over a 131 bit binary fieldsect131r2 : SECG curve over a 131 bit binary fieldsect163k1 : NIST/SECG/WTLS curve over a 163 bit binary fieldsect163r1 : SECG curve over a 163 bit binary fieldsect163r2 : NIST/SECG curve over a 163 bit binary fieldsect193r1 : SECG curve over a 193 bit binary fieldsect193r2 : SECG curve over a 193 bit binary fieldsect233k1 : NIST/SECG/WTLS curve over a 233 bit binary fieldsect233r1 : NIST/SECG/WTLS curve over a 233 bit binary fieldsect239k1 : SECG curve over a 239 bit binary fieldsect283k1 : NIST/SECG curve over a 283 bit binary fieldsect283r1 : NIST/SECG curve over a 283 bit binary fieldsect409k1 : NIST/SECG curve over a 409 bit binary fieldsect409r1 : NIST/SECG curve over a 409 bit binary fieldsect571k1 : NIST/SECG curve over a 571 bit binary fieldsect571r1 : NIST/SECG curve over a 571 bit binary fieldc2pnb163v1: X9.62 curve over a 163 bit binary fieldc2pnb163v2: X9.62 curve over a 163 bit binary fieldc2pnb163v3: X9.62 curve over a 163 bit binary fieldc2pnb176v1: X9.62 curve over a 176 bit binary fieldc2tnb191v1: X9.62 curve over a 191 bit binary fieldc2tnb191v2: X9.62 curve over a 191 bit binary fieldc2tnb191v3: X9.62 curve over a 191 bit binary fieldc2pnb208w1: X9.62 curve over a 208 bit binary fieldc2tnb239v1: X9.62 curve over a 239 bit binary fieldc2tnb239v2: X9.62 curve over a 239 bit binary fieldc2tnb239v3: X9.62 curve over a 239 bit binary fieldc2pnb272w1: X9.62 curve over a 272 bit binary fieldc2pnb304w1: X9.62 curve over a 304 bit binary fieldc2tnb359v1: X9.62 curve over a 359 bit binary fieldc2pnb368w1: X9.62 curve over a 368 bit binary fieldc2tnb431r1: X9.62 curve over a 431 bit binary fieldwap-wsg-idm-ecid-wtls1: WTLS curve over a 113 bit binary fieldwap-wsg-idm-ecid-wtls3: NIST/SECG/WTLS curve over a 163 bit binary fieldwap-wsg-idm-ecid-wtls4: SECG curve over a 113 bit binary fieldwap-wsg-idm-ecid-wtls5: X9.62 curve over a 163 bit binary fieldwap-wsg-idm-ecid-wtls6: SECG/WTLS curve over a 112 bit prime fieldwap-wsg-idm-ecid-wtls7: SECG/WTLS curve over a 160 bit prime fieldwap-wsg-idm-ecid-wtls8: WTLS curve over a 112 bit prime fieldwap-wsg-idm-ecid-wtls9: WTLS curve over a 160 bit prime fieldwap-wsg-idm-ecid-wtls10: NIST/SECG/WTLS curve over a 233 bit binary fieldwap-wsg-idm-ecid-wtls11: NIST/SECG/WTLS curve over a 233 bit binary fieldwap-wsg-idm-ecid-wtls12: WTLS curve over a 224 bit prime fieldOakley-EC2N-3:IPSec/IKE/Oakley curve #3 over a 155 bit binary field.Not suitable for ECDSA.Questionable extension field!Oakley-EC2N-4:IPSec/IKE/Oakley curve #4 over a 185 bit binary field.Not suitable for ECDSA.Questionable extension field!brainpoolP160r1: RFC 5639 curve over a 160 bit prime fieldbrainpoolP160t1: RFC 5639 curve over a 160 bit prime fieldbrainpoolP192r1: RFC 5639 curve over a 192 bit prime fieldbrainpoolP192t1: RFC 5639 curve over a 192 bit prime fieldbrainpoolP224r1: RFC 5639 curve over a 224 bit prime fieldbrainpoolP224t1: RFC 5639 curve over a 224 bit prime fieldbrainpoolP256r1: RFC 5639 curve over a 256 bit prime fieldbrainpoolP256t1: RFC 5639 curve over a 256 bit prime fieldbrainpoolP320r1: RFC 5639 curve over a 320 bit prime fieldbrainpoolP320t1: RFC 5639 curve over a 320 bit prime fieldbrainpoolP384r1: RFC 5639 curve over a 384 bit prime fieldbrainpoolP384t1: RFC 5639 curve over a 384 bit prime fieldbrainpoolP512r1: RFC 5639 curve over a 512 bit prime fieldbrainpoolP512t1: RFC 5639 curve over a 512 bit prime fieldSM2       : SM2 curve over a 256 bit prime field

比较每种椭圆曲线的质数域位数, 挑出最大的那个.

sect571k1 : NIST/SECG curve over a 571 bit binary field
sect571r1 : NIST/SECG curve over a 571 bit binary field

可知, 质数域位数最大的椭圆曲线有2个 : sect571k1 或者 sect571r1, 位数都是571位.

笔记

将 openssl ecparam -list_curves 实现迁移到自己的demo工程

想看看官方怎么实现的这个命令.

/*!
* \file exp017_ecparam_list_curves.cpp
* \note 看看openssl如何实现命令 openssl ecparam -list_curves
*/#include "my_openSSL_lib.h"
#include <openssl/crypto.h>
#include <openssl/bio.h>
#include <openssl/ec.h>
#include <openssl/objects.h>#include <stdlib.h>
#include <stdio.h>
#include <assert.h>#include "CMemHookRec.h"void my_openssl_app();
int list_builtin_curves(BIO* out);int main(int argc, char** argv)
{setvbuf(stdout, NULL, _IONBF, 0); // 清掉stdout缓存, 防止调用printf时阻塞mem_hook();my_openssl_app();mem_unhook();/*! run resultlist_builtin_curves, cnt = 82--------------------secp112r1           : -20SECG/WTLS curve over a 112 bit prime fieldsecp112r2           : -20SECG curve over a 112 bit prime fieldsecp128r1           : -20SECG curve over a 128 bit prime fieldsecp128r2           : -20SECG curve over a 128 bit prime fieldsecp160k1           : -20SECG curve over a 160 bit prime fieldsecp160r1           : -20SECG curve over a 160 bit prime fieldsecp160r2           : -20SECG/WTLS curve over a 160 bit prime fieldsecp192k1           : -20SECG curve over a 192 bit prime fieldsecp224k1           : -20SECG curve over a 224 bit prime fieldsecp224r1           : -20NIST/SECG curve over a 224 bit prime fieldsecp256k1           : -20SECG curve over a 256 bit prime fieldsecp384r1           : -20NIST/SECG curve over a 384 bit prime fieldsecp521r1           : -20NIST/SECG curve over a 521 bit prime fieldprime192v1          : -20NIST/X9.62/SECG curve over a 192 bit prime fieldprime192v2          : -20X9.62 curve over a 192 bit prime fieldprime192v3          : -20X9.62 curve over a 192 bit prime fieldprime239v1          : -20X9.62 curve over a 239 bit prime fieldprime239v2          : -20X9.62 curve over a 239 bit prime fieldprime239v3          : -20X9.62 curve over a 239 bit prime fieldprime256v1          : -20X9.62/SECG curve over a 256 bit prime fieldsect113r1           : -20SECG curve over a 113 bit binary fieldsect113r2           : -20SECG curve over a 113 bit binary fieldsect131r1           : -20SECG/WTLS curve over a 131 bit binary fieldsect131r2           : -20SECG curve over a 131 bit binary fieldsect163k1           : -20NIST/SECG/WTLS curve over a 163 bit binary fieldsect163r1           : -20SECG curve over a 163 bit binary fieldsect163r2           : -20NIST/SECG curve over a 163 bit binary fieldsect193r1           : -20SECG curve over a 193 bit binary fieldsect193r2           : -20SECG curve over a 193 bit binary fieldsect233k1           : -20NIST/SECG/WTLS curve over a 233 bit binary fieldsect233r1           : -20NIST/SECG/WTLS curve over a 233 bit binary fieldsect239k1           : -20SECG curve over a 239 bit binary fieldsect283k1           : -20NIST/SECG curve over a 283 bit binary fieldsect283r1           : -20NIST/SECG curve over a 283 bit binary fieldsect409k1           : -20NIST/SECG curve over a 409 bit binary fieldsect409r1           : -20NIST/SECG curve over a 409 bit binary fieldsect571k1           : -20NIST/SECG curve over a 571 bit binary field // !!! best one sect571r1           : -20NIST/SECG curve over a 571 bit binary field // !!! best onec2pnb163v1          : -20X9.62 curve over a 163 bit binary fieldc2pnb163v2          : -20X9.62 curve over a 163 bit binary fieldc2pnb163v3          : -20X9.62 curve over a 163 bit binary fieldc2pnb176v1          : -20X9.62 curve over a 176 bit binary fieldc2tnb191v1          : -20X9.62 curve over a 191 bit binary fieldc2tnb191v2          : -20X9.62 curve over a 191 bit binary fieldc2tnb191v3          : -20X9.62 curve over a 191 bit binary fieldc2pnb208w1          : -20X9.62 curve over a 208 bit binary fieldc2tnb239v1          : -20X9.62 curve over a 239 bit binary fieldc2tnb239v2          : -20X9.62 curve over a 239 bit binary fieldc2tnb239v3          : -20X9.62 curve over a 239 bit binary fieldc2pnb272w1          : -20X9.62 curve over a 272 bit binary fieldc2pnb304w1          : -20X9.62 curve over a 304 bit binary fieldc2tnb359v1          : -20X9.62 curve over a 359 bit binary fieldc2pnb368w1          : -20X9.62 curve over a 368 bit binary fieldc2tnb431r1          : -20X9.62 curve over a 431 bit binary fieldwap-wsg-idm-ecid-wtls1: -20WTLS curve over a 113 bit binary fieldwap-wsg-idm-ecid-wtls3: -20NIST/SECG/WTLS curve over a 163 bit binary fieldwap-wsg-idm-ecid-wtls4: -20SECG curve over a 113 bit binary fieldwap-wsg-idm-ecid-wtls5: -20X9.62 curve over a 163 bit binary fieldwap-wsg-idm-ecid-wtls6: -20SECG/WTLS curve over a 112 bit prime fieldwap-wsg-idm-ecid-wtls7: -20SECG/WTLS curve over a 160 bit prime fieldwap-wsg-idm-ecid-wtls8: -20WTLS curve over a 112 bit prime fieldwap-wsg-idm-ecid-wtls9: -20WTLS curve over a 160 bit prime fieldwap-wsg-idm-ecid-wtls10: -20NIST/SECG/WTLS curve over a 233 bit binary fieldwap-wsg-idm-ecid-wtls11: -20NIST/SECG/WTLS curve over a 233 bit binary fieldwap-wsg-idm-ecid-wtls12: -20WTLS curve over a 224 bit prime fieldOakley-EC2N-3       : -20IPSec/IKE/Oakley curve #3 over a 155 bit binary field.Not suitable for ECDSA.Questionable extension field!Oakley-EC2N-4       : -20IPSec/IKE/Oakley curve #4 over a 185 bit binary field.Not suitable for ECDSA.Questionable extension field!brainpoolP160r1     : -20RFC 5639 curve over a 160 bit prime fieldbrainpoolP160t1     : -20RFC 5639 curve over a 160 bit prime fieldbrainpoolP192r1     : -20RFC 5639 curve over a 192 bit prime fieldbrainpoolP192t1     : -20RFC 5639 curve over a 192 bit prime fieldbrainpoolP224r1     : -20RFC 5639 curve over a 224 bit prime fieldbrainpoolP224t1     : -20RFC 5639 curve over a 224 bit prime fieldbrainpoolP256r1     : -20RFC 5639 curve over a 256 bit prime fieldbrainpoolP256t1     : -20RFC 5639 curve over a 256 bit prime fieldbrainpoolP320r1     : -20RFC 5639 curve over a 320 bit prime fieldbrainpoolP320t1     : -20RFC 5639 curve over a 320 bit prime fieldbrainpoolP384r1     : -20RFC 5639 curve over a 384 bit prime fieldbrainpoolP384t1     : -20RFC 5639 curve over a 384 bit prime fieldbrainpoolP512r1     : -20RFC 5639 curve over a 512 bit prime fieldbrainpoolP512t1     : -20RFC 5639 curve over a 512 bit prime fieldSM2                 : -20SM2 curve over a 256 bit prime field--------------------free map, g_mem_hook_map.size() = 0*/return 0;
}void my_openssl_app()
{BIO* bio_out = NULL;do {bio_out = BIO_new_fp(stdout, 0);if (NULL == bio_out){break;}list_builtin_curves(bio_out);} while (false);if (NULL != bio_out){BIO_free(bio_out);bio_out = NULL;}
}int list_builtin_curves(BIO* out)
{int ret = 0;EC_builtin_curve* curves = NULL;size_t n, crv_len = EC_get_builtin_curves(NULL, 0);BIO_printf(out, "list_builtin_curves, cnt = %d\n", crv_len);curves = (EC_builtin_curve*)OPENSSL_malloc(sizeof(*curves) * crv_len);if (!EC_get_builtin_curves(curves, crv_len)){BIO_printf(out, "err\n");goto end;}BIO_printf(out, "--------------------\n");for (n = 0; n < crv_len; n++) {const char* comment = curves[n].comment;const char* sname = OBJ_nid2sn(curves[n].nid);if (comment == NULL)comment = "CURVE DESCRIPTION NOT AVAILABLE";if (sname == NULL)sname = "";BIO_printf(out, "  %-20s: -20%s\n", sname, comment);}BIO_printf(out, "--------------------\n");ret = 1;
end:OPENSSL_free(curves);return ret;
}

备注

在这里插入图片描述
从查到的资料看, ECC521就比普通的RSA位数强多了.
现在主流网站用的RSA证书位数都是4096(e.g. MS主站)
sect571k1, sect571r1的位数是571位, 强度应该更高吧.

END

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/743362.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

深度学习armv8/armv9 cache的原理

文章目录 前言1、为什么要用cache?2、背景:架构的变化?2、cache的层级关系 ––big.LITTLE架构&#xff08;A53为例)3、cache的层级关系 –-- DynamIQ架构&#xff08;A76为例)4、DSU / L3 cache5、L1/L2/L3 cache都是多大呢6、cache相关的术语介绍7、cache的分配策略(alocat…

C++函数 加括号与不加括号

很多时候&#xff0c;我们会看到一些在创建对象时有的加括号有的不加括号 那么&#xff0c;这是什么情况呢&#xff1f; 总结&#xff1a;函数需要加上括号&#xff0c;加上括号会对函数初始化&#xff0c;不加括号可能导致未知错误 我们来验证一下。 1.基本数据类型不带括…

利用Python进行网络爬虫:Beautiful Soup和Requests的应用【第131篇—Beautiful Soup】

利用Python进行网络爬虫&#xff1a;Beautiful Soup和Requests的应用 在网络数据变得日益丰富和重要的今天&#xff0c;网络爬虫成为了获取和分析数据的重要工具之一。Python作为一种强大而灵活的编程语言&#xff0c;在网络爬虫领域也拥有广泛的应用。本文将介绍如何使用Pyth…

Elasticseach基础认识

ES的起源&#xff1f; Elasticsearch 是由 Elastic 公司创建 简称&#xff08;ES&#xff09; Elasticsearch 是一个分布式、免费和开放的搜索和分析引擎&#xff0c;适用于所有类型的数据&#xff0c;包括文本、数字、地理空间、结构化和非结构化数据。 Elasticsearch 基于 …

Oracle 主从切换脚本

一、 切换前预检查 1. dg_precheck_main_v1.4.sh #!/bin/bash#********************************************************************************** # Author: Hehuyi_In # Date: 2022年06月16日 # FileName: dg_precheck_main_v1.4.sh # # For sys user, execute the sc…

LLM之RAG实战(二十九)| 探索RAG PDF解析

对于RAG来说&#xff0c;从文档中提取信息是一种不可避免的场景&#xff0c;确保从源文件中提取出有效的内容对于提高最终输出的质量至关重要。 文件解析过程在RAG中的位置如图1所示&#xff1a; 在实际工作中&#xff0c;非结构化数据比结构化数据丰富得多。如果这些海量数据无…

如何使用vue定义组件之——子组件调用父组件数据

1.定义父子模板template <div class"container"><my-father></my-father><my-father></my-father><my-father></my-father><!-- 此处无法调用子组件&#xff0c;子组件必须依赖于父组件进行展示 --><!-- <my-…

数学实验_Matlab使用2_简单绘图

简单使用 x -pi * 2 : .1 : pi*2;y sin(x);plot(x, y); % 绘制普通图像plot(x, y, k-.*); % 绘制2维图像&#xff0c;线为实线&#xff0c;*为每个点&#xff08;Matlab的画图比较原始&#xff0c;就是简单的秒点画图&#xff09;grid on; % 打开网状格式% grid off; % 关闭…

SORA和大语言模型的区别

OpenAI的文生视频模型SORA与大语言模型&#xff08;LLM&#xff09;的主要区别在于它们的应用领域和处理的数据类型&#xff0c;数据处理能力、技术架构、多模态能力和创新点。SORA作为一款专注于视频生成的模型&#xff0c;展现了在处理视觉数据方面的独特优势和创新能力。 1…

R语言读取大型NetCDF文件

失踪人口回归&#xff0c;本篇来介绍下R语言读取大型NetCDF文件的一些实践。 1 NetCDF数据简介 先给一段Wiki上关于NetCDF的定义。 NetCDF (Network Common Data Form) is a set of software libraries and self-describing, machine-independent data formats that support…

STM32串口通信—串口的接收和发送详解

目录 前言&#xff1a; STM32串口通信基础知识&#xff1a; 1&#xff0c;STM32里的串口通信 2&#xff0c;串口的发送和接收 串口发送&#xff1a; 串口接收&#xff1a; 串口在STM32中的配置&#xff1a; 1. RCC开启USART、串口TX/RX所对应的GPIO口 2. 初始化GPIO口 …

YOLOv8改进 | 图像去雾 | 特征融合注意网络FFA-Net增强YOLOv8对于模糊图片检测能力(北大和北航联合提出)

一、本文介绍 本文给大家带来的改进机制是由北大和北航联合提出的FFA-net: Feature Fusion Attention Network for Single Image Dehazing图像增强去雾网络,该网络的主要思想是利用特征融合注意力网络(Feature Fusion Attention Network)直接恢复无雾图像,FFA-Net通过特征…

MyBatis-Plus学习记录

目录 MyBatis-Plus快速入门 简介 快速入门 MyBatis-Plus核心功能 基于Mapper接口 CRUD 对比mybatis和mybatis-plus&#xff1a; CRUD方法介绍&#xff1a; 基于Service接口 CRUD 对比Mapper接口CRUD区别&#xff1a; 为什么要加强service层&#xff1a; 使用方式 CR…

开发指南009-从list导出excel文件

从数据库返回一般是对象的列表&#xff0c;平台底层提供了从list转为excel文件的方法。平台的设计思想就是为一些典型的场景设计对应的解决方法&#xff0c;通过模式化的方法来简化编程和提高维护性&#xff08;通过标准化来减少学习成本和维护成本&#xff0c;张三做的东西和李…

游戏数据处理

游戏行业关键数据指标 ~ 总激活码发放量、总激活量、总登录账号数 激活率、激活登录率 激活率 激活量 / 安装量 激活率 激活量 / 激活码发放量 激活且登录率 激活且登录量 / 激活码激活量 激活且登录率应用场景 激活且登录率是非常常用的转化率指标之一&#xff0c;广泛…

Ypay源支付6.9无授权聚合免签系统可运营源码

YPay是一款专为个人站长设计的聚合免签系统&#xff0c;YPay基于高性能的ThinkPHP 6.1.2 Layui PearAdmin架构&#xff0c;提供了实时监控和管理的功能&#xff0c;让您随时随地掌握系统运营情况。 说明 Ypay源支付6.9无授权聚合免签系统可运营源码 已搭建测试无加密版本…

HTML5:七天学会基础动画网页13

看完前面很多人可能还不是很明白0%-100%那到底是怎么回事&#xff0c;到底该怎么用&#xff0c;这里我们做一个普遍的练习——心跳动画 想让心❤跳起来&#xff0c;我们先分析一波&#xff0c;这个心怎么写&#xff0c;我们先写一个正方形&#xff0c;再令一个圆形前移: 再来一…

Linux中YUM仓库的配置

Linux软件包的管理 YUM仓库是什么YUM的常用命令修改YUM源其实CentOS7已经对YUM做了优化 YUM仓库是什么 之前传统RPM的管理方式 可以简单理解为写Java的时候不用Maven管理 jar包都要自己手动去导入 去下载 但是配置好YUM仓库 就放佛在用Maven管理Java项目 基于RPM包管理 能够从…

Python导入类说一说

要在Python中导入一个类&#xff0c;需要使用import关键字。 详细去看下面的代码 1、多例类 class Restaurant:餐馆类def __init__(self,restaurant_name,cuisine_type):#类的属性self.restaurant_name restaurant_nameself.cuisine_type cuisine_type# self.stregth_leve…

2024软件测试应该学什么?“我“怎么从功能转入自动化测试?

目录&#xff1a;导读 前言一、Python编程入门到精通二、接口自动化项目实战三、Web自动化项目实战四、App自动化项目实战五、一线大厂简历六、测试开发DevOps体系七、常用自动化测试工具八、JMeter性能测试九、总结&#xff08;尾部小惊喜&#xff09; 前言 1、软件测试应该学…