<div dir="ltr">I DO IT WITH:<div><br></div><div># Break JWT<br>            $var(jwt1) = $(hdr(Identity){s.select,0,.}{s.decode.base64t});<br>            $var(jwt2) = $(hdr(Identity){s.select,1,.}{s.decode.base64t});</div><div><br></div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 30, 2021 at 8:48 PM Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <p>Hello,</p>
    <p>not familiar with python functions, have you tried with Kamailio
      transformation?</p>
    <p><a href="https://www.kamailio.org/wiki/cookbooks/5.5.x/transformations#sdecodebase64url" target="_blank">https://www.kamailio.org/wiki/cookbooks/5.5.x/transformations#sdecodebase64url</a></p>
    <p>Maybe you have to specify in Python that it is ASCII, I remember
      I had to do decoding when porting kamcli to work with Python3 --
      had to change from using directly the variables received as
      parameter to a decoded value, something like:</p>
    <p>prefix = tprefix.encode("ascii", "ignore").decode()</p>
    <p>Also, if you can, share the identity header here to test with and
      see if can be reproduced.<br>
    </p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div>On 30.06.21 21:14, Daniel W. Graham
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      
      
      <div>
        <p class="MsoNormal"><span>I am unable to base64url decode
            the json payload in identity header generated by secsipid.<u></u><u></u></span></p>
        <p class="MsoNormal"><span><u></u> <u></u></span></p>
        <p class="MsoNormal"><span>(Using python for test)<u></u><u></u></span></p>
        <p class="MsoNormal"><span>decoded_payload =
            url64.decode(‘payload’)<u></u><u></u></span></p>
        <p class="MsoNormal"><span>UnicodeDecodeError: 'utf-8' codec
            can't decode byte 0xc2 in position 27: invalid continuation
            byte<u></u><u></u></span></p>
        <p class="MsoNormal"><span><u></u> <u></u></span></p>
        <p class="MsoNormal"><span>Header decodes fine this way but
            not payload.
            <u></u><u></u></span></p>
        <p class="MsoNormal"><span><u></u> <u></u></span></p>
        <p class="MsoNormal"><span>Is this an issue with the payload
            encoding?<u></u><u></u></span></p>
        <p class="MsoNormal"><span><u></u> <u></u></span></p>
        <p class="MsoNormal"><span>Kamailio 5.5<u></u><u></u></span></p>
        <p class="MsoNormal"><span><u></u> <u></u></span></p>
        <p class="MsoNormal"><span style="font-size:11pt">Daniel W.
            Graham, CTO<u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-size:11pt">CMSInter.net
            LLC<u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-size:11pt">DIRECT (989)
            400-4230<u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
        <p class="MsoNormal"><span style="font-size:11pt">INTERNET |
            TELEPHONE | MANAGED IT<u></u><u></u></span></p>
        <p class="MsoNormal"><u></u> <u></u></p>
      </div>
      <br>
      <fieldset></fieldset>
      <pre>__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a></pre>
  </div>

__________________________________________________________<br>
Kamailio - Users Mailing List - Non Commercial Discussions<br>
  * <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
Important: keep the mailing list in the recipients, do not reply only to the sender!<br>
Edit mailing list options or unsubscribe:<br>
  * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div>