eagre-asn1 is an asn1 library for Rust.
It makes heavy use of macros to make the interface easy to use.
Currently only DER and a very small bit of xer is supported.
Documentation can be found at https://rahix.github.io/eagre-asn1/
Say you have the following asn1 structure:
User ::= SEQUENCE {
username UTF8String,
passwordHash [CONTEXT 12] IMPLICIT OctetString,
age [APPLICATION 1] EXPLICIT Integer,
admin Boolean
}
In Rust it would look like this:
```rust
struct User {
pub username: String,
pub password_hash: Vec
dersequence!{
User:
username: NOTAG TYPE String,
passwordhash: IMPLICIT TAG CONTEXT 12; TYPE Vec
```rust use eagre_asn1::der::DER;
let someuser = User { ... }; let encoded = someuser.derbytes().unwrap(); // Send to far away planet let decoded = User::derfrombytes(encoded).unwrap(); asserteq!(some_user, decoded); ```
types::Any
types::BitString
types::BMPString
bool
types::CharacterString
enum
types::Date
types::DateTime
std::time::Duration
types::EmbeddedPDV
enum
types::GeneralString
types::GraphicString
types::IA5String
i32
types::Null
types::NumericString
Vec<u8>
types::PrintableString
f32
struct
Vec<T>
struct
types::SetOf
types::T61String
types::Time
types::TimeOfDay
types::UniversalString
String
or &str
types::VideotexString
types::VisibleString
eagre-asn1 is licensed under either of
at your option.