Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write raw der #190

Open
kpp opened this issue Jul 9, 2021 · 8 comments
Open

Write raw der #190

kpp opened this issue Jul 9, 2021 · 8 comments

Comments

@kpp
Copy link

kpp commented Jul 9, 2021

Hey! Thank you so much for your crate.

I found a requirement to write a raw DER slice into the writer. Something like https://docs.rs/yasna/0.4.0/yasna/struct.DERWriter.html#method.write_der. Would you please implement it?

@alex
Copy link
Owner

alex commented Jul 9, 2021

I think the right way to do this would be a public constructor on Tlv.

@kpp
Copy link
Author

kpp commented Jul 9, 2021

As you wish =)

@alex
Copy link
Owner

alex commented Sep 19, 2021

Are you interested in contributing a PR for this?

@kpp
Copy link
Author

kpp commented Sep 20, 2021

No, I found a workaround.

@turbocool3r
Copy link

Are you interested in contributing a PR for this?

I am. Is it still considered?

@reaperhulk
Copy link
Collaborator

Yes, we’d be happy to review a public Tlv constructor.

@turbocool3r
Copy link

Yes, we’d be happy to review a public Tlv constructor.

I've looked into the implementation, and seems like making the constructor wouldn't make much sense besides allowing the type to be used in const contexts and having a shortcut since one could just use the parse function. This wouldn't be very convenient however in cases when you have a piece of data that doesn't come in one slice. Like you want to embed a large file in a DER wrapper and you read it in parts or you have some kind of an internal format encoded into an octet string. You'll have to first encode it into a vector and then build a Tlv. A much simpler and effective design would be to allow writing raw data. This would require something similar to encoded_len() from the der crate though to encode the length beforehand.

@alex
Copy link
Owner

alex commented May 7, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants