title: How to decrypt a base64-encoded string in C
body: <p>I've been bashing my head over this for a few days now, and i just can't figure this out.
  I've got a string, it's a token i get in a JWT for auth, etc.</p>
  
  <p>The token was created like so:</p>
  
  <pre><code>token = base64_urlsafe_encode(DATA)
  DATA = IV + CIPHER_TAG + CIPHER_TEXT
  IV = 16 bytes - initialization vector
  CIPHER_TAG = 16 bytes - cipher tag
  CIPHERTEXT = remaining bytes - encrypted(CREDENTIAL)
  CREDENTIAL = &lt;username&gt;:&lt;password&gt;
  </code></pre>
  
  <p>Now, i can decode-base64 the incoming jwt, no problems. But my token comes up like this:
  (changing some chars for security reasons, i only changed alphanumerics for 0s)</p>
  
  <pre><code>token" =&gt; "00_0000000000000000000000000000000000-00_000000000000000000000000_0000_00000000000000000000000_0000000000000000000000000000000==",
  </code></pre>
  
  <p>I can't decode64 to binary because it fails on the "_" chars and "-" and anything not base64.</p>
  
  <p>Can anyone help me figure out how to do this?
  How can they say: <code>token = base64_urlsafe_encode(DATA)</code> if the token contains invalid (not base64) characters?</p>