Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.
/ ser_der Public archive

Newtypes for the der crate to allow for [serde](https://serde.rs) de-/serialization.

License

Notifications You must be signed in to change notification settings

polyphony-chat/ser_der

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ser_der

Newtypes for the der crate to allow for serde de-/serialization.

Usage

Add this to your Cargo.toml:

[dependencies]
ser_der = { version = "0", features = ["alloc"] } # Features should match the ones of the der crate
der = { version = "0", features = ["alloc"] } 
serde = { version = "1", features = ["derive"] }

You can then use the newtypes offered by this crate to de-/serialize DER-encoded data structures using serde.

#[derive(serde::Serialize, serde::Deserialize)]
struct MyStruct {
    #[serde(with = "ser_der::asn1::ia5_string")]
    bits: ser_der::asn1::IA5String,
}

All newtypes implement Deref, DerefMut, From<[Newtype]> for [Type] and From<[Type]> for [Newtype] to the underlying der type.

Types covered

  • IA5String
  • DateTime
  • Document
  • Length
  • Any
  • BitString
  • GeneralizedTime
  • Header
  • Int
  • Length
  • Null
  • ObjectIdentifier
  • OctetString
  • PrintableString
  • SequenceOf
  • SetOf
  • Tag
  • TeletexString
  • Uint
  • UtcTime

Upstreaming to der

This crate is a temporary solution until the der crate supports serde de-/serialization. The plan is to upstream the serde support to the der crate.

About

Newtypes for the der crate to allow for [serde](https://serde.rs) de-/serialization.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages