posts - 518,  comments - 13,  views - 86万
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

一、简介

asn1parse命令是一种用来诊断ASN.1结构的工具,也能用于从ASN1.1数据中提取数据

 

二、语法

openssl asn1parse [-inform PEM|DER] [-in filename] [-out filename] [-noout] [-offset number] [-length number] [-i] [- structure filename] [-strparse offset]

选项

复制代码
-inform arg   input format - one of DER PEM
 -in arg       input file
 -out arg      output file (output format is always DER
 -noout arg    don't produce any output
 -offset arg   offset into file
 -length arg   length of section in file
 -i            indent entries
 -dump         dump unknown data in hex form
 -dlimit arg   dump the first arg bytes of unknown data in hex form
 -oid file     file of extra oid definitions
 -strparse offset
               a series of these can be used to 'dig' into multiple
               ASN1 blob wrappings
 -genstr str   string to generate ASN1 structure from
 -genconf file file to generate ASN1 structure from
复制代码

 

三、ASN.1结构

0:d=0  hl=4 l= 710 cons: SEQUENCE
复制代码
0 表示节点在整个文件中的偏移长度

d=0 表示节点深度

hl=4 表示节点头字节长度

l=710 表示节点数据字节长度

cons 表示该节点为结构节点,表示包含子节点或者子结构数据

prim 表示该节点为原始节点,包含数据

SEQUENCE、OCTETSTRING等都是ASN.1中定义的数据类型,具体可以参考ASN.1格式说明。

最后一个节点OCTET STRING      [HEX DUMP],就是加密后的私钥数据。
复制代码

 

四、实例

1、分析一个文件

openssl asn1parse -in ec_pubkey.pem

image

2、分析一个DER文件

openssl asn1parse -inform DER -in file.der

 

posted on   红孩儿你好  阅读(3506)  评论(0编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
点击右上角即可分享
微信分享提示