From eee936d7528d327bc5ddccddbefab29f050a60a3 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Tue, 21 Feb 2017 00:37:16 +0100 Subject: [PATCH] add base64url_strict_encode() --- src/headers/tomcrypt_misc.h | 2 ++ src/misc/base64/base64_encode.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/headers/tomcrypt_misc.h b/src/headers/tomcrypt_misc.h index 092c625..4f5e8fa 100644 --- a/src/headers/tomcrypt_misc.h +++ b/src/headers/tomcrypt_misc.h @@ -12,6 +12,8 @@ int base64_strict_decode(const unsigned char *in, unsigned long len, #ifdef LTC_BASE64_URL int base64url_encode(const unsigned char *in, unsigned long len, unsigned char *out, unsigned long *outlen); +int base64url_strict_encode(const unsigned char *in, unsigned long inlen, + unsigned char *out, unsigned long *outlen); int base64url_decode(const unsigned char *in, unsigned long len, unsigned char *out, unsigned long *outlen); diff --git a/src/misc/base64/base64_encode.c b/src/misc/base64/base64_encode.c index 0ed0aa3..c87f302 100644 --- a/src/misc/base64/base64_encode.c +++ b/src/misc/base64/base64_encode.c @@ -110,6 +110,12 @@ int base64url_encode(const unsigned char *in, unsigned long inlen, { return _base64_encode_internal(in, inlen, out, outlen, codes_base64url, 0); } + +int base64url_strict_encode(const unsigned char *in, unsigned long inlen, + unsigned char *out, unsigned long *outlen) +{ + return _base64_encode_internal(in, inlen, out, outlen, codes_base64url, 1); +} #endif /* LTC_BASE64_URL */ #endif