Skip to content

Understanding tls_codec and it's traits #1109

@imor

Description

@imor

I have been working on adding support for the the Signed Certificate Timestamp extension in x509-cert crate. Since some data in this extension is TLS encoded I an using the tls_codec crate. But I'm a bit confused about the structure of some of the types and traits in tls_codec. Specifially:

  • What's the difference between TlsVecU8<T> and TlsByteVecU8. To me it looks like TlsByteVecU8 can be just a type alias: type TlsByteVecU8 = TlsVecU8<u8>. Is this true? If yes, why do we have two entirely separate types?
  • What is the difference between Serialize and SerializeBytes traits (same for Deserialize and DeserializeBytes)? Are Serialize and Deserialize meant to be used only in an std environment (because they use std::io::{Read, Write})? If yes, why can't SerializeBytes and DeserializeBytes work for both std and no_std?
  • Why is DeserializeBytes impl'd for TlsVecU8<T> but SerializeBytes is not?

Answers to these would be greatly appreciated. Especially the last one because currently my types implement Serialize and DeserializeBytes which looks a bit asymmetric to me.

cc @tarcieri @franziskuskiefer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions