EVerest / cbexigen

cbExiGen - The V2GTP EXI codec generator for cbV2G
Apache License 2.0
32 stars 18 forks source link

Decode problem: string size limit #44

Closed Thoren-G closed 1 year ago

Thoren-G commented 1 year ago

Hi,

I'm getting an error (-111, EXI_ERROR__CHARACTER_BUFFER_TOO_SMALL) while decoding a CertificateInstallationReq. In this message, my X509IssuerName contains 90+1 (nullterminator) characters and it seems like the maximum is set to 60. See: https://github.com/EVerest/cbexigen/blob/4142ec02561602b80d564e5c9ffa780c18c937db/src/input/code_templates/c/static_code/exi_basetypes_decoder.c.jinja#L352-L355

As far as i can see it, the concrete limit comes from here: https://github.com/EVerest/cbexigen/blob/4142ec02561602b80d564e5c9ffa780c18c937db/src/input/code_templates/c/static_code/exi_basetypes.h.jinja#L16 Why are EXI Strings limited to 60 characters?

barsnick commented 1 year ago

Hi Thoren, we originally had size 50, the same as OpenV2G also uses. We increased it to 60, because we encountered actual messages using a size of 52.

If I read the RFCs correctly, the issuer field should be a DN, and thereby restricted to 64 (+1) bytes. Why is yours 90?

What do you suggest we use?

You are of course free to change this value in the code template, or in your generated code.

Thoren-G commented 1 year ago

OK, very interesting. We have always used a 90 characters issuer and never had any problems with it. Where exactly is the 64 bytes limit in the RFC? I can't find it right now.

For better interoperability i think we will probably increase the limit for us, but here it doesn't have to be changed then.

Thanks for the quick answer

barsnick commented 1 year ago

The limit was concluded from StackOverflow comments and skimming over X.509 RFCs.;-) We're glad to discuss more details.

Where and how are you using the cbV2G codec?

We welcome more testing and feedback!

barsnick commented 1 year ago

According to the W3C XMLDsig Recommendation, the X509IssuerSerial is a "Distinguished Name". I interpret this StackOverflow comment and what it is quoting as an indication that 64 is the upper limit.

We will bump our limit up to this value, and leave it up to you to increase it even more.