TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Useful Old Technologies: ASN.1 (2013)

138 pointsby rdpintqogeogsaaover 3 years ago

21 comments

moreatiover 3 years ago
A warning, ASN.1 is disliked by many people in software security. It often features in security vulnerabilities involving TLS and LDAP&#x2F;Active Directory. They would recommend against adopting ASN.1 for new projects.<p>I get the impression this partially due to a) most implementations being adhoc, of varying completeness, and written in C or C++ (e.g. OpenSSL); and b) sheer complexity of ASN.1 and other standards from that family&#x2F;era.<p>Sources: following software security researchers&#x2F;practioners on Twitter, a few podcasts, here, etc.
评论 #29690072 未加载
评论 #29691065 未加载
评论 #29691144 未加载
评论 #29690443 未加载
评论 #29693112 未加载
评论 #29690631 未加载
aheppover 3 years ago
How does ASN.1 compare to something like binary protobuf?<p>I have no data to back this up, but I was under the impression ASN.1 is one of those specifications that is so large and complicated it’s essentially impossible to implement correctly; and that ASN.1 parsers are a pretty infamous source of security bugs (although I mean, most parsers seem to be).
评论 #29692368 未加载
评论 #29690651 未加载
rixraxover 3 years ago
If you&#x27;re interested of learning more about ASN.1, two great books on the subject are:<p>- ASN.1 Communication between Heterogeneous Systems[0]<p>- ASN.1 Complete[1]<p>Both of which are available online for free. Last time I checked, they may not cover the latest fads like JER etc. but will provide you with a solid understanding of ASN.1 nonetheless.<p>[0] <a href="https:&#x2F;&#x2F;www.oss.com&#x2F;asn1&#x2F;resources&#x2F;books-whitepapers-pubs&#x2F;larmouth-asn1-book.pdf" rel="nofollow">https:&#x2F;&#x2F;www.oss.com&#x2F;asn1&#x2F;resources&#x2F;books-whitepapers-pubs&#x2F;la...</a> [1] <a href="https:&#x2F;&#x2F;www.oss.com&#x2F;asn1&#x2F;resources&#x2F;books-whitepapers-pubs&#x2F;dubuisson-asn1-book.PDF" rel="nofollow">https:&#x2F;&#x2F;www.oss.com&#x2F;asn1&#x2F;resources&#x2F;books-whitepapers-pubs&#x2F;du...</a>
评论 #29691273 未加载
jesprenjover 3 years ago
The bittorrent protocol uses a very simple binary data representation system: bencoding.<p>It can be described in a single paragraph: <a href="https:&#x2F;&#x2F;www.bittorrent.org&#x2F;beps&#x2F;bep_0003.html#bencoding" rel="nofollow">https:&#x2F;&#x2F;www.bittorrent.org&#x2F;beps&#x2F;bep_0003.html#bencoding</a><p>Although it supports only dictionaries, lists, ints and strings, it may be enough for your use case and is easily extendable.<p>Edit: also ASN.1 does not solve futute-extending out-of-the-box. In JSON&#x2F;bencoding&#x2F;XML, it&#x27;s trivial to add another key&#x2F;element to a dictionary&#x2F;array&#x2F;element and allow applications to use it if they can and ignore it otherwise. Okay, TLV looks like it could handle that, but there&#x27;s nothing about it in the description language itself.
评论 #29691541 未加载
Rochusover 3 years ago
ASN.1 was great. Another old specification language still in use today is EXPRESS, one of the foundations of the huge ISO 10303 (STEP) standard series, as defined in ISO 10303-11. It even has algebraic data types. The development of STEP started in 1984 and has been one of the largest efforts ever undertaken by ISO.
Ericson2314over 3 years ago
They should have mentioned protobuf which it is closer to.<p>To my knowledge, there is no bad nullability in ASN.1, unlike protobuf. Good job!
ttyprintkover 3 years ago
Among those binary formats, this one benefits from the ubiquity of OpenSSL (see asn1parse) for debugging.
评论 #29689470 未加载
评论 #29689347 未加载
praptakover 3 years ago
Does ASN handle versioning of the messages?<p>If I add a field to the message I expect the new binaries to read the messages serialized by the old binaries and vice versa.<p>Obviously the old binaries are not expected to understand the added field but they should not break when handed the upgraded message.
评论 #29692547 未加载
评论 #29690812 未加载
dathinabover 3 years ago
If you ran into ASN.1 run away (if you can). It&#x27;s so insane hopeless overenginered with so many intersecting standard, different representations and nobes that it can easily become a nightmare. Most parsers also only support an opinionated subset for a specific purpose simply rejecting everything outside of the supported sunset even if they by specification should support it. This night sound fine, until you actually run into it in production and two supposedly compatible systems more are incompatible with no easy fix around.
kevin_thibedeauover 3 years ago
Its greatest weakness is 10 different string encodings. I&#x27;ve always wondered what sort of bugs you could expose with a cert using videotex for the CN fields.
评论 #29692615 未加载
评论 #29690574 未加载
foolfoolzover 3 years ago
this is cool. i’ve only ever used asn1 as content for metadata in x509 certs and it makes a tiny bit more sense now why this is better than a basic string encoding
mistertiover 3 years ago
I&#x27;ve been using asn.1 for 20 years now, and i find it absolutely fabulous. I still learn something new from time to time, when something doesn&#x27;t parse or encode correctly :)
retrocryptidover 3 years ago
It&#x27;s very clear the writer has not used ASN.1 or BER&#x2F;DER encoding. There&#x27;s no discussion of which standard for bit fields to use, constructed encoding, the practical requirement of an ASN.1 compiler or any security concerns.<p>Heck, why not just use CORBA?
phendrenad2over 3 years ago
Oh hey! There&#x27;s quite a chunk of code in the Linux kernel to support this protocol. I hope that people here find some use for this &quot;useful&quot; old technology, otherwise it&#x27;s just taking up space.
nullcover 3 years ago
ASN.1: I can only imagine that one day someone said &quot;Strings are bad for security&quot; and some bold lad overheard and said &quot;Hold my Beer!&quot;.
mech422over 3 years ago
Nice to see someone actually put the TL;DR at the top for a change..<p>Never understood the logic of people putting them at the end of an article.. If I wasn&#x27;t gonna read the whole thing, what makes you think I&#x27;m gonna scroll to the bottom?
评论 #29691959 未加载
johnisgoodover 3 years ago
I use ASN.1 between Kotlin &lt;&gt; Erlang, where Kotlin is the client and Erlang is the server, of course.
anovikovover 3 years ago
How is it better than Protocol Buffers?
vzalivaover 3 years ago
please, don&#x27;t!
ggmover 3 years ago
<p><pre><code> SEQUENCE OF ANY --there I maximally compressed all the comments</code></pre>
fmajidover 3 years ago
Useful? Hell, no. Like most technology derived from OSI, it&#x27;s garbage that has been the source of a huge number of software vulnerabilities.
评论 #29691049 未加载
评论 #29691282 未加载