Rasn 0.4 #43
XAMPPRocky
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone, I'm proud to announce the 0.4.0 of rasn! rasn is a
#[no_std]
codec framework for the ASN.1 data model and encoding rules. Allowing you to safely and easily parse ASN.1 data formats such as BER, CER, and DER in safe Rust.Sponsorship
Work on rasn is partially funded through the support of contributors on GitHub Sponsors. If you would like support work on rasn, tokei, and/or my other open source projects, contributions are always welcome, appreciated, and make a direct impact on my ability to build new projects as well as support existing ones.
New Compile-Time Validation
0.4 comes with a new more complete compile-time validation for types that derive
Decode
andEncode
. Previously the validation only looked one-level deep. Now however we have a new type (TagTree
) for representing and validating ASN.1 tags beyond a single type level entirely atconst
time. How it works is actually pretty straightforward, with the enums shown below, we construct a tree of values, and thanks to Rust’s powerfulconst
we can add a compile-time check that ensures this tree is always unique.SET
andANY
SupportThis release also adds support for two of the less frequently used types in ASN.1.
SET
is similar toSEQUENCE
except that its fields can be encoded out-of-order (except some formats require it to be encoded by ascending tag [except some formats do not encode the tag so you need to know the order in the type system.])These exceptions make it incredibly difficult to do correctly, especially across different codecs. Now however with
rasn
adding this to structures is a single line change if you're using the derive macros. It's also relatively straightforward to implement by hand, with encoding being the same as encoding sequences except for callingencode_set
which will behind the scenes ensure that fields are always encoded in the correct order as specified by the encoding rules. For decoding, we require a bit more code, since you can't rely on what order the fields come in. Luckily it's pretty easy to represent this problem using aCHOICE
enum for the fields of theSET
.The
ANY
type is technically deprecated and removed from the current ASN.1 syntax, however it is still used some important specifications and can be used for open type fields.New LDAPv3 and PKIX crates
With the addition of support for those new types, it is now possible to support both IETF RFC 4511 and IETF RFC 5280 also known as LDAPv3 and PKIX. Like the other standards in the
rasn
repository, these are not implementations of servers or clients for these standards, but rather solely the data types used in the protocol, and this means it's easy for them to beno_std
compatible, codec independent, and sans I/O.It's important to note these crates don’t currently implement any non-BER visible constraints on the data types, so not all of these types guarantee a semantically valid message, but they do always ensure that a type is always correctly encoded and decodable. The PKIX crate also currently follows RFC 5280's syntax for ease of implementation of the core certificate types, but will move to be closer to RFC 5912's syntax in the future.
Other Improvements
prelude
module torasn
that exports the codec traits as well as all builtinrasn
types to make it easier to import everything needed when creating an ASN.1 module withrasn
.rasn-snmp
.Contributors
This discussion was created from the release Rasn 0.4.
Beta Was this translation helpful? Give feedback.
All reactions