0

In Java we have this code:

byte[] clientPublicKeyBase = Base64.getUrlDecoder().decode(...);

How do I convert this to Apex?

identigral
  • 7,543
  • 29
  • 32
  • 42
Holmes285
  • 33
  • 5
  • 1
    From the Javadoc for Base64.getUrlDecoder(): Uses the "URL and Filename safe Base64 Alphabet" as specified in Table 2 of RFC 4648 for encoding and decoding. The encoder does not add any line feed (line separator) character. The decoder rejects data that contains characters outside the base64 alphabet. Have you looked at Table 2 of RFC 4648 and tried implementing? – identigral Jul 15 '22 at 04:07
  • Check this Dev Forum link on similar topic https://developer.salesforce.com/forums/?id=906F00000008zfhIAA – Saroj Bera Jul 15 '22 at 05:25
  • 1
    @identigral Thank you so much for the tip, As you said, It was necessary to encode while converting to RFC 4648 Using this info I found a previous answer of yours https://salesforce.stackexchange.com/questions/273742/using-the-crypto-verify-method-to-verify-a-jwt-signature and it worked perfect, thank you so much – Holmes285 Jul 15 '22 at 05:49

0 Answers0