add base64safeurl support as it states at https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-31#appendix-C

Hello,
maybe it is good to add base64safe encoding as it states at https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-31#appendix-C

Let me know if you want me make any changes.
Sorry if I has broken your tests, but I wasn't able to run them, because of compile issues with kiwi.

Thanks