eagre-asn1
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
Documentation can be found at https://rahix.github.io/eagre-asn1/
Example
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:
der_sequence!
And serializing is as easy as:
use DER;
let some_user = User ;
let encoded = some_user.der_bytes.unwrap;
// Send to far away planet
let decoded = der_from_bytes.unwrap;
assert_eq!;
Implemented Types
- Any
types::Any
- BitString
types::BitString
- BMPString
types::BMPString
- Boolean
bool
- CharacterString
types::CharacterString
- Choice
enum
- Date
types::Date
- DateTime
types::DateTime
- Duration
std::time::Duration
- EmbeddedPDV
types::EmbeddedPDV
- Enumeration
enum
- External
- GeneralString
types::GeneralString
- GraphicString
types::GraphicString
- IA5String
types::IA5String
- InstanceOf
- Integer
i32
- IRI
- Null
types::Null
- NumericString
types::NumericString
- ObjectClassField
- ObjectIdentifier
- OctetString
Vec<u8>
- PrintableString
types::PrintableString
- Real
f32
- RelativeIRI
- RelativeOID
- Sequence
struct
- Sequence Of
Vec<T>
- Set
struct
- Set Of
types::SetOf
- T61String
types::T61String
- Time
types::Time
- TimeOfDay
types::TimeOfDay
- UniversalString
types::UniversalString
- UTF8String
String
or&str
- VideotexString
types::VideotexString
- VisibleString
types::VisibleString
License
eagre-asn1 is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.