ASN.1抽象语法标记(Abstract Syntax Notation One) ASN.1是一种 ISO/ITU-T 标准,描述了一种对数据进行表示、编码、传输和解码的数据格式。

DER是ASN.1众多编码方案中的一个。

ASN.1 defines the abstract syntax of information but does not restrict the way the information is  encoded. Various ASN.1 encoding rules provide the transfer syntax (a  concrete representation) of the data values whose abstract syntax is  described in ASN.1.

The standard ASN.1 encoding rules include:

ASN.1 together with specific ASN.1 encoding rules facilitates the  exchange of structured data especially between application programs over networks by describing data structures in a way that is independent of  machine architecture and implementation language.

Application layer protocols such as X.400  electronic mail , X.500 and LDAP  directory services , H.323 (VoIP ), BACnet and SNMP use ASN.1 to describe the protocol data units (PDUs) they exchange. It is also extensively used in the Access and Non-Access Strata of UMTS . There are many other application domains of ASN.1

A particularly useful new application of ASN.1 is Fast Infoset . Fast Infoset is an international standard that specifies a binary encoding format for the XML Information Set (XML Infoset ) as an alternative to the XML document format. It aims to provide more efficient serialization than the text-based XML format.

Example

Data structures of FooProtocol defined using the ASN.1 notation:

FooProtocol DEFINITIONS ::= BEGIN

FooQuestion ::= SEQUENCE {

trackingNumber INTEGER,

question IA5String

}

FooAnswer ::= SEQUENCE {

questionNumber INTEGER,

answer BOOLEAN

}

This could be a specification published by creators of Foo protocol.  ASN.1 does not define conversation flows. This is up to the textual  description of the protocol.

Assuming a message, which complies with Foo protocol and which will be sent to the receiving party. This particular message (PDU ) is:

myQuestion FooQuestion ::= {

trackingNumber 5,

question "Anybody there?"

}

To send the above message through the network one needs to encode it to a string of bits . ASN.1 defines various algorithms to accomplish that task, called  Encoding rules. There are plenty of them; one of the simplest is Distinguished Encoding Rules (DER) .

The Foo protocol specification should explicitly name one set of  encoding rules to use, so that users of the Foo protocol know which one  they should use.

[edit ]  Example encoded in DER

Below is the data structure shown above encoded in the DER format (all numbers are in hexadecimal):

30 -- tag indicating SEQUENCE

13 -- length in octets

02 -- tag indicating INTEGER

01 -- length in octets

05 -- value

16 -- tag indicating IA5String

0e -- length in octets

41 6e 79 62 6f 64 79 20 74 68 65 72 65 3f -- value

(Note: DER uses a pattern of tag-length-value triplets)

So what one actually gets is the string of 21 octets:

30 13 02 01 05 16 0e 41 6e 79 62 6f 64 79 20 74 68 65 72 65 3f

The scope of ASN.1 and DER ends here. It is possible to transmit the encoded message to the party by any means (utilizing TCP or any other protocol). The party should be able to decode the octets back using DER.

("Anybody there?" in ASCII)

der解码规则_[转] DER编码和ASN.1相关推荐

  1. der解码规则_DER编码简介

    概念: DER是BER的子集,它为每一个ASN.1类型定义一种唯一的编码方案. DER与BER的区别: DER在BER的基础上增加了如下限制: 长度小于等于127,必须使用短型长度表示法. 长度大于1 ...

  2. aac蓝牙编解码协议_蓝牙音频编码哪个音质好?今天我们来逐一解读

    家有影院致力于帮助渴望学习.热爱电影.希望通过自己双手搭建出适合自己的家庭影院的朋友.如果你是这样的人,我们和500位同样热爱家庭影院的伙伴愿意一起帮助你实现梦想.同时,我们还能帮助你找到价格优惠的靠 ...

  3. base32解码工具_[随波逐流]CTF编码工具 V1.0

    自己写的一个工具,python写的.加解密程序主要也是网上收集的,我只是搬运工. 各种编码解码离线工具集成:包括base64,base32,base16,base85(a),base85(b),bas ...

  4. 计算机tlv简介_优化TLV编码规则

    优化 TLV 编码规则 王沁 ; 许娜 ; 张燕 ; 张晓彤 [期刊名称] <计算机科学> [年 ( 卷 ), 期] 2008(035)011 [摘要] 抽象语法标记 ASN.1 是一种 ...

  5. linux解码base64工具,如何解码Linux中的base64编码行?(How do I decode base64 encoded lines in linux?)...

    如何解码Linux中的base64编码行?(How do I decode base64 encoded lines in linux?) 我正在尝试读取文件并仅提取base64编码部分. 我通过使用 ...

  6. 【Android 安装包优化】WebP 图片格式性能测试 ( 测试 WebP 图片解码速度 | 测试 WebP 图片编码速度 )

    文章目录 一.测试 WebP 图片解码速度 二.测试 WebP 图片编码速度 三.参考资料 测试结果 : WebP 格式图片 , 解码快 , 编码慢 , 占用空间小 ; 在解码速度上 , WebP 格 ...

  7. drools动态配置规则_关于规则引擎

    很早之前就知道Drools,这几天正好有个项目,里面用了大量的规则定义,就想是否能采用Drools来解决. 在github上分析了规则引擎项目,包括: Easy-rules https://githu ...

  8. 中国行政区编码_邮政编码_区号编码

    原文:中国行政区编码_邮政编码_区号编码 源代码下载地址:http://www.zuidaima.com/share/1550463699946496.htm 中国行政区编码_邮政编码_区号编码SQL ...

  9. java der 解码_如何解码Java中的.csr文件以提取其内容

    下面是我用来解码.csr文件的代码. public class CSRInfoDecoder { private static Logger LOG = Logger.getLogger(CSRInf ...

  10. 十六进制解码_快速十六进制编码和解码

    十六进制解码 In 在 Easy String Encryption Using CryptoAPI in C++ I described how to encrypt text and recomm ...

最新文章

  1. xcode 4.2 不再支持 Window-Based Application 的解决办法(转载)
  2. 微信小程序canvas绘制环形图(含动画)
  3. [Web 前端] mobx教程(二)-mobx主要概念
  4. delphi OleVariant转换RecordSet
  5. timerfd.h中定义的函数
  6. 【图解】FFmpeg播放器基本原理
  7. 计算机策略组无法打开怎么办,本地组策略打不开,怎么解决
  8. 思科arp欺骗攻击,cdp攻击,DHCP攻击实验命令笔记
  9. charles——教程——转载
  10. 服务器数据库只读怎么修改权限,设置mysql数据库为只读权限
  11. OC.Gen-X:一键生成黑苹果 OpenCore EFI 引导文件
  12. 在nginx环境下同一个网站目录下放2个或者多个zblog程序nginx伪静态规则如何写
  13. 永洪BI——国内领军的一站式大数据分析平台
  14. 基于Matlab使用 IMU、磁力计和高度计估计方向和高度(附源码)
  15. VSCODE 配置cl.exe编译器
  16. ITIL 4 Foundation题目-7
  17. 「亲测有效」解决:如何禁用dl.winehq.org | kali 移除winehq源 |由于没有公钥,无法验证下列签名: NO_PUBKEY 76F1A20FF987672F
  18. Docker虚拟化命令实战
  19. [当人工智能遇上安全] 2.清华张超老师 - GreyOne: Discover Vulnerabilities with Data Flow Sensitive Fuzzing
  20. XCP实战系列介绍14-基于Vector_Davinci工具的XCP配置介绍(三)

热门文章

  1. 英语作文计算机国际会议开幕词,国际学术会议英文主持词
  2. 关于 JWT Token 自动续期的解决(根据其他文献参考写的)
  3. Python 预测孩子身高
  4. 最好用的临时邮箱网站
  5. 安装wsl kali 遇到WslRegisterDistribution failed with error: 0x80070057 Error: 0x80070057解决
  6. 奥的斯服务器状态显示,OTIS服务器(TT)查看故障及清除故障的方法
  7. Windows补丁查询地址
  8. 移植Python3到TQ2440(二)
  9. kubespray安装高可用k8s集群
  10. jsp内置对象-session对象