首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >面向Objective-C的BER-TLV开源库

面向Objective-C的BER-TLV开源库
EN

Stack Overflow用户
提问于 2012-11-21 15:03:23
回答 2查看 5.6K关注 0票数 6

我打算从智能卡响应中解析BER-TLV格式来解释数据。

它类似于JACCAL,但在Objective-C或C++中

有没有人可以提供任何开源项目或参考资料来做这件事?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-12-01 03:21:22

这是一个解码ASN.1误码率格式的项目。https://github.com/chrisridd/asn1-dump/

主逻辑位于此文件中:https://github.com/chrisridd/asn1-dump/blob/master/berd.m

如果有足够的时间,在阅读标准:http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf http://luca.ntop.org/Teaching/Appunti/asn1.html之后,编写自己的解码器并不难

解码流程是这样的:读入标签、长度、值序列。

从标签中获取

  • 您将获得

代码语言:javascript
复制
- Data Class, usually be Universal(predefined type in standard like "Boolean","Sequence"...)         and context-specific (to distinguish different field with same type).
- Primitive (like boolean and integer) or Constructed (usually is sequence). because constructed type can contains Primitive or Constructed type. maybe need recursive decoding.
- Tag Number, determine data types (boolean? integer? bitstring?)

  • Length:

代码语言:javascript
复制
- determine length of the contents to decode into (maybe need recursively decoding).
- length has two form (short and long). you'd better support both.

TLV值:要在当前级别中读取的实际值。如果这是一个构造的数据(如序列),该值将包含TLV的内部级别。

在标准(http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf)的末尾有一张图像显示了多个水平的TLV,也许可以更好地帮助您理解误码率。

在你读完标准后,最好的方法是: 1)找一些GUI查看器来查看一些BER证书文件,以熟悉它。搜索"ASN.1查看器“查找。2)开始查看代码https://github.com/chrisridd/asn1-dump/blob/master/berd.m

票数 4
EN

Stack Overflow用户

发布于 2012-11-25 22:08:49

tlve如何?http://tlve.sourceforge.net/

苹果的Tokend似乎也很有用:http://www.opensource.apple.com/source/Tokend/Tokend-36720/PIV/TLV.cpp

sourceforge上的jayacard是另一个处理这个问题的项目,现在看起来已经被抛弃了,但来源在这里:http://www.codeforge.com/read/7149/tlv.c__html

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13487992

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档