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

How to encode a buffer into der we don't know the size of the buffer. #502

Open
chetanpandey1266 opened this issue Aug 26, 2024 · 1 comment

Comments

@chetanpandey1266
Copy link

chetanpandey1266 commented Aug 26, 2024

I was trying to encode a buffer to ber but I don't know the exact size of the buffer.

I tried doing this

size = der_encode_to_buffer(&asn_DEF_type, struct_ptr, *buffer, 1000).encoded

Assuming that the size of the buffer will be less than 1000
But this way I have to choose a upper limit which is hard to define so I tried this

size = der_encode_to_buffer(&asn_DEF_type, struct_ptr, NULL, 0).encoded
der_encode_to_buffer(&asn_DEF_type, struct_ptr, *buffer, size)

But this is giving error

So is there a way to determine the size of the encoded buffer?

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

2 participants
@chetanpandey1266 and others