Subject: bug#66265: Make padding optional with base64

From: Paul Millar <[email-masked]>
Date: Fri, 29 Sep 2023 11:46:18 +0200

Hi,

RFC 4648 says[1]:
 >   In some circumstances, the use of padding ("=") in base-encoded data
 >   is not required or used.

Currently, the 'base64' application always includes the padding when 
encoding, and prints an warning/error message (on stderr) if padding is 
omitted when decoding.  Decoding is nonetheless successful (the correct 
data is emitted on stdout) if the base64-encoded data omits the padding.

I think the base64 application should be updated to support 
base64-encoded data without padding.

My suggestion would be to add an option to base64 to control whether 
padding is added when encoding.  For decoding, it might make sense to 
add an option to control whether padding is expected.

(although, other approaches might be possible)

Cheers,
Paul.

[1] https://datatracker.ietf.org/doc/html/rfc4648#section-3.2