简体   繁体   English

如何使用OpenSSL编码/解码ASN.1流?

[英]How to encode/decode ASN.1 streams with OpenSSL?

I need an API to encode/decode an ASN.1 stream. 我需要一个API来编码/解码ASN.1流。 I've read that OpenSSL supports this in C and I have access to it in my project, though I don't know how to actually use these functions. 我读过OpenSSL在C语言中支持此功能,尽管我不知道如何实际使用这些功能,但我可以在我的项目中访问它。 I effectively need to decode a struct, a SEQUENCE. 我实际上需要解码一个结构SEQUENCE。 Can anyone recommend how to do so? 有人可以推荐如何做吗?

It looks like openssl can be used to generate ASN.1 encodings of data through a cumbersome command line interface. 看起来 openssl可用于通过繁琐的命令行界面生成ASN.1数据编码。 It's not really an API that you could use - you'd be having to create one yourself that, underneath, made a lot of system calls like system("openssl asn1parse -genstr 'UTF8:Hello World'") . 并不是真正可以使用的API-您必须自己创建一个API,然后在其下进行许多系统调用,例如system("openssl asn1parse -genstr 'UTF8:Hello World'") That sounds like a lot of work. 这听起来像很多工作。

You're far better off using a proper ASN.1 toolset, take a look at the tools page on the ITU's website. 使用适当的ASN.1工具集要好得多,请查看ITU网站上的工具页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM