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

[BUG] Opaque value decoded in base64 format instead of base64 URL format #698

Open
parmi93 opened this issue May 3, 2023 · 0 comments · May be fixed by #710
Open

[BUG] Opaque value decoded in base64 format instead of base64 URL format #698

parmi93 opened this issue May 3, 2023 · 0 comments · May be fixed by #710

Comments

@parmi93
Copy link
Contributor

parmi93 commented May 3, 2023

I was thinking that was a Leshan bootstrap demo server bug, but it seems to be a problem with the Wakaama library.
eclipse-leshan/leshan#1444
OpenMobileAlliance/OMA_LwM2M_for_Developers#553

According to the RFC8428§4.3- SenML Labels the opaque value over SenML JSON should be encode in base64 URL (no padding) format, but Wakaama lib is trying to decode as base64 (with padding) format.

I noticed this issue because I'm failing the bootstrap phase because of that.

Has anyone else noticed the same problem?

parmi93 added a commit to parmi93/wakaama that referenced this issue Jun 16, 2023
Fix - Changed encoding from Base64 (with padding) to Base64URL (no paddi
ng) for data value 'vd' over SenML JSON format.

According to the SenML JSON specification defined at RFC8428§4.3 the
Base64 URL safe alphabet must be used (without padding) for Data Value
'vd':

"(*) Data Value is a base64-encoded string with the URL-safe alphabet as
defined in Section 5 of [RFC4648], with padding omitted. (In CBOR, the
octets in the Data Value are encoded using a definite-length byte
string, major type 2.)"

So, encoding and decoding has been changed from Base64 (with padding) to
Base64Url (without padding) for data value 'vd' over SenML JSON format.

Note that the behavior of the code in data/json.c has not changed, data
in JSON format will continue to be encoded in Base64 (with padding), see
eclipse-leshan/leshan#1444 (comment)

New tests has been added in order to test the Base64Url (without
padding) encode and decode functions, and the previous tests have been
modified by adding a new entry to be tested.

Fix: eclipse-wakaama#698
also see:
github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues/553
parmi93 added a commit to parmi93/wakaama that referenced this issue Jun 16, 2023
Fix - Changed encoding from Base64 (with padding) to Base64URL (no paddi
ng) for data value 'vd' over SenML JSON format.

According to the SenML JSON specification defined at RFC8428§4.3 the
Base64 URL safe alphabet must be used (without padding) for Data Value
'vd':

"(*) Data Value is a base64-encoded string with the URL-safe alphabet as
defined in Section 5 of [RFC4648], with padding omitted. (In CBOR, the
octets in the Data Value are encoded using a definite-length byte
string, major type 2.)"

So, encoding and decoding has been changed from Base64 (with padding) to
Base64Url (without padding) for data value 'vd' over SenML JSON format.

Note that the behavior of the code in data/json.c has not changed, data
in JSON format will continue to be encoded in Base64 (with padding), see
eclipse-leshan/leshan#1444 (comment)

New tests has been added in order to test the Base64Url (without
padding) encode and decode functions, and the previous tests have been
modified by adding a new entry to be tested.

Fix: eclipse-wakaama#698
also see:
github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues/553
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant