Skip to content

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

@chetanpandey1266

Description

@chetanpandey1266

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions