Base64 java string with . decode in c# -
i have following string client - encoded , signed certificate based off of java based sso 3rd party component
"eyjhbgcioijsuzi1niisinr5cci6ikpxvcj9.eyjlehaioje0ntiwnte4ntesimlhdci6mtq1mja1mtc5mswiaxnzijoiahr0chm6ly9vyxv0ac9hcgkvb3blbmlkl3yxl3rva2vuiiwiyxvkijoizwe2njexnjctytrimc00zdq4lwiwztetnwrjotmwmzk5mdgziiwic3viijoimwq1zmiwyjctn2njmy00mjrkltg1m2qtmwe5ywnjmzg2ytm5iiwiyxrfagfzaci6ikf6dnktnujor2nbn0e2ujjqmkewywcilcjjx2hhc2gioij5dzf0nnpncvltbe5ittncqmjyemvnin0.r6x1hz23eahr8h2uzswqra5muytibgl8ymsmh-t7giep1jaqyvmoakronj7dwynqrg7owei6rgoyihgkotid-tkhnpgcae3mcvcw0gtlzj1llq5b8zmfinlbtcwgxvvk54enj04jyr04pir6lxb4vyk1mhec_vhwbmtjkoqrphfsozh99tq-l5akemua-ygnk4ai_gcei7yy4as6al4oa1o3e5dpqmtzd-zz_sum-3bihblpa-9oxrpfrwhmdyrytpar4yhvyhsvcxotul9ahdikf7kddiyo9abq6ujgochggfepvz3ioerphoy8hsrkl5jgfw3w1to6k5dwbbhs9q" for java c# base64 conversions, know '-' needs replaced '+' , '_' needs replaced '/', plus additional padding if required using '=' @ end of string make correct length decoding -
the decoding can done @ : http://ostermiller.org/calc/encode.html , http://www.motobit.com/util/base64-decoder-encoder.asp?charset=utf-8&acharset=
using utf-8 encoding
decoded string:
{"alg":"rs256","typ":"jwt"}{"exp":1452051851,"iat":1452051791,"iss":"https://oauth/api/openid/v1/token","aud":"ea661167-a4b0-4d48-b0e1-5dc930399083","sub":"1d5fb0b7-7cc3-424d-853d-1a9acc386a39","at_hash":"azvy-5bhgca7a6r2j2a0ag","c_hash":"yw1t6zmqyslnhm3bbbrzeg"}�g�m�hz�k�k �k�a8�_2�)����z�ii2� f��������#�ࡈ��-�4ʄ�� �70%b�h--�u���o�l|��70�uo+�4�8��t����[������r���i*�+>l9�}�:�墄�@2�r�j!�x��ˆ�� x9�n�nc=��y��7n!۔����~�!0<�a:@������u����}wh�^�2��c� ����=vw���<z2���^c�u��[h�ncxdz� from decoded can seen - need extract "sub" value - rest can stay garbage doesn't need decoded
problem: problem encoded string has "." in it. replace "." in c# ? have tried replacing + , / 2 other no character values ruins encoding , can't "sub"
suggestions on "." in encoded base64 ?
the . not part of base 64 encoding, it's separator between discrete encoded items.
eyjhbgcioijsuzi1niisinr5cci6ikpxvcj9 decodes to
{"alg":"rs256","typ":"jwt"} and
eyjlehaioje0ntiwnte4ntesimlhdci6mtq1mja1mtc5mswiaxnzijoiahr0chm6ly9vyxv0ac9hcgkvb3blbmlkl3yxl3rva2vuiiwiyxvkijoizwe2njexnjctytrimc00zdq4lwiwztetnwrjotmwmzk5mdgziiwic3viijoimwq1zmiwyjctn2njmy00mjrkltg1m2qtmwe5ywnjmzg2ytm5iiwiyxrfagfzaci6ikf6dnktnujor2nbn0e2ujjqmkewywcilcjjx2hhc2gioij5dzf0nnpncvltbe5ittncqmjyemvnin0 decodes to
{"exp":1452051851,"iat":1452051791,"iss":"https://oauth/api/openid/v1/token","aud":"ea661167-a4b0-4d48-b0e1-5dc930399083","sub":"1d5fb0b7-7cc3-424d-853d-1a9acc386a39","at_hash":"azvy-5bhgca7a6r2j2a0ag","c_hash":"yw1t6zmqyslnhm3bbbrzeg"}
Comments
Post a Comment