OpenFIPS201 icon indicating copy to clipboard operation
OpenFIPS201 copied to clipboard

Support for multibyte tags in TLVWriter

Open dmercer-google opened this issue 1 year ago • 1 comments

TLVWriter doesn't offer good support for multibyte tags. It should also have a writeTag(byte[] tag) method.

I also noticed that writeTag(short tag) doesn't set a multibyte indicator byte nor does it set the continuation bit on the high byte.

Regarding how the multibyte indicator is added and continuation bit(s) are set or not set, this should be clearly documented in the API comments.

Regardless of your choice of supporting writeTag(byte[] tag) you should clearly document how the various writeTag methods work with respect to setting the multibyte indicator byte and if the user is expected to set the continuation bit.

dmercer-google avatar Jul 26 '23 17:07 dmercer-google

As described in issue #60, the expectation is that the values are already constructed with the required class/multibyte indicators. it makes for a terrible general purpose TLV encoder but does the job for PIV, which has very simple requirements for its responses. The point is taken here that it is worth at least documenting the implementation decisions and constraints. I'll do that.

makinako avatar Aug 01 '23 02:08 makinako