From: Iuri de A. S. <iu...@iu...> - 2020-05-25 21:35:02
|
> What do you mean its not encoded correctly? item (2) is not encoded correctly using base64url (https://tools.ietf.org/html/rfc4648#section-5 <https://tools.ietf.org/html/rfc4648#section-5>). Note that padding ("=") must be omitted as per https://tools.ietf.org/html/rfc7515#section-2 <https://tools.ietf.org/html/rfc7515#section-2> How would I use [ns_base64encoding], if i decide to add more content in the payload message? Is it possible? > On May 25, 2020, at 08:55, Gustaf Neumann <ne...@wu...> wrote: > > NaviServer has native support for base64 and base64url encoding/decoding > See: > > https://naviserver.sourceforge.io/n/naviserver/files/ns_base64.html <https://naviserver.sourceforge.io/n/naviserver/files/ns_base64.html> Okay, and what about the wring encrypt, (i.e. within “=“) after the 63rd char? > On May 24, 2020, at 22:08, Maksym Zinchenko <siq...@gm...> wrote: > > What do you mean its not encoded correctly? > > ns_base64decode eydpc3MnOiAnMjY5NzM0MTAwMDAxMDInLCAnYXVkJzogJ2l1cml4LmNvbS9SRVNUJywgJ3N1Yic > 6ICc3MDQnLCAnaWF0JzogMTU5MDM2NTY1MH0= > {'iss': '26973410000102', 'aud': 'iurix.com/REST <http://iurix.com/REST>', 'sub': '704', 'iat': 1590365650} > > > On Sun, May 24, 2020 at 11:56 PM Maksym Zinchenko <siq...@gm... <mailto:siq...@gm...>> wrote: > sourcecode/nsd/uuencode.c maybe > > On Sun, May 24, 2020 at 11:23 PM Iuri de Araujo Sampaio <iu...@iu... <mailto:iu...@iu...>> wrote: > Hi there, > > It looks like [ns_base64encode] generates a wrong payload when message size contains more than 63 characters. > > https://tools.ietf.org/html/rfc4648#section-5 <https://tools.ietf.org/html/rfc4648#section-5> > An alternative alphabet has been suggested that would use "~" as the > 63rd character. > > > (1) Payload, which generates a proper encryption. > > set payload [ns_base64encode "{'sub': '$user(user_id)', 'it': [ns_time]}”] > > eydzdWInOiAnNzA0JywgJ2lhdCc6IDE1OTAzNjU2ODF9 > > (2) Payload, which generates a wrong encryption > > set payload [ns_base64encode "{'iss': '26973410000102', 'aud': 'iurix.com/REST <http://iurix.com/REST>', 'sub': '$user(user_id)', 'iat': [ns_time]}”] > > eydpc3MnOiAnMjY5NzM0MTAwMDAxMDInLCAnYXVkJzogJ2l1cml4LmNvbS9SRVNUJywgJ3N1Yic6ICc3MDQnLCAnaWF0JzogMTU5MDM2NTY1MH0= > > > item (2) is not encoded correctly using base64url (https://tools.ietf.org/html/rfc4648#section-5 <https://tools.ietf.org/html/rfc4648#section-5>). Note that padding ("=") must be omitted as per https://tools.ietf.org/html/rfc7515#section-2 <https://tools.ietf.org/html/rfc7515#section-2> > > How would I use [ns_base64encoding], if i decide to add more content in the payload message? Is it possible? > > > I was trying find where ns_base64encoding is implemented, within Naviserver source code. But I haven’t found yet. > Then I’d be able to go deeper into the problem to identify the actual cause and try to write a solution to it. > > Does anyone know where is the implementation of [ns_base64encode] ? > > Best wishes, > I > _______________________________________________ > naviserver-devel mailing list > nav...@li... <mailto:nav...@li...> > https://lists.sourceforge.net/lists/listinfo/naviserver-devel <https://lists.sourceforge.net/lists/listinfo/naviserver-devel> > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel |