[Feature request] Support for Private use DOs #50
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently, private use data objects are not supported:
374cff588c/src/openpgp/files.c (L63)Particularly Private use (0103) or Private use (0104) (which are PIN-protected) can be used to securely store small amounts of data, such as VeraCrypt key files. While this is of course not the primary purpose of an OpenPGP card, imho it still would provide a nice benefit to users.
Oh wow. Thank you! That was very quick.
However, there is still an issue with deleting the private use DOs again. It might also affect other DOs; I didn't check.
The OpenPGP card spec says:
However, sending a PUT DATA command with an empty data field does not delete the DO (here: 0103):
Compare this to, e.g., a Nitrokey or YubiKey, where sending
00 DA 01 03deletes the data again:Furthermore, sometimes the data is not stored correctly. For example, here I try to store four bytes
01020304as private use DO 0103, but only the last two bytes can be read back:Beautiful coincidence. When you use 01020304 it is interpreted as a TLV DO, with TAG=01, LEN=02, DATA=0304. If you replace 02 by another number not coincident to the length, it will return the entire text (and this is why it passed all tests).
Thank you for the quick fix, which I can confirm to be working for the private DOs.
However, other DOs are probably also interpreted as a TLV, even though they shouldn't be. Consider this – arguably slightly contrived – example for the URL (DO 5F50), where the
Tis probably also interpreted as length, and henceHTis skipped when returning the URL:I pushed a fix to do not parse as TLV any flash data. Hope it will work with all DO but not tested with all.