Re: [codec] Base32/Base64 trailing bit validation is incomplete

2020-01-22 Thread Alex Herbert
This has turned out to be non-trivial. Current progress in in PR [1]. Easy - Added a property to BaseNCodec to enable strict decoding All other properties of the codec are set in the constructor and are final. So using a property is a change. I can change to overloaded constructors but there

Re: [codec] Base32/Base64 trailing bit validation is incomplete

2020-01-20 Thread Alex Herbert
> On 20 Jan 2020, at 23:54, Gary Gregory wrote: > > On Mon, Jan 20, 2020 at 6:45 PM Alex Herbert > > wrote: > >> >> >>> On 20 Jan 2020, at 23:20, Gary Gregory wrote: >>> >>> I hope this would be at the level of BaseNCodec, not just Base64. >>> >>> I am

Re: [codec] Base32/Base64 trailing bit validation is incomplete

2020-01-20 Thread Gary Gregory
On Mon, Jan 20, 2020 at 6:45 PM Alex Herbert wrote: > > > > On 20 Jan 2020, at 23:20, Gary Gregory wrote: > > > > I hope this would be at the level of BaseNCodec, not just Base64. > > > > I am not sure I like BaseNCodec#setAllowTrailingBits(boolean), maybe > > someone more general like

Re: [codec] Base32/Base64 trailing bit validation is incomplete

2020-01-20 Thread Alex Herbert
> On 20 Jan 2020, at 23:20, Gary Gregory wrote: > > I hope this would be at the level of BaseNCodec, not just Base64. > > I am not sure I like BaseNCodec#setAllowTrailingBits(boolean), maybe > someone more general like BaseNCodec.setStrictDecoding(boolean) where the > default is false for

Re: [codec] Base32/Base64 trailing bit validation is incomplete

2020-01-20 Thread Gary Gregory
I hope this would be at the level of BaseNCodec, not just Base64. I am not sure I like BaseNCodec#setAllowTrailingBits(boolean), maybe someone more general like BaseNCodec.setStrictDecoding(boolean) where the default is false for backward compatibility. I do not think we want to go as far as

[codec] Base32/Base64 trailing bit validation is incomplete

2020-01-20 Thread Alex Herbert
In release 1.14 I fixed a patch made in 1.13 to reject decoding bytes that cannot be re-encoded to the same bytes (Codec-134 [1]). My fix was to correct the use of a mask to check the trailing bytes. The implementation checks trailing bits that are to be discarded are all zero. However the