Add crypt_dump_json() API call.

Add API call that can directly print JSON metadata area from LUKS2 device.

For commandline it also adds --dump-json-metadata option for luksDump action.

Note that the binary metadata (UUID, version etc) is not part of this output.
(We reserve flags parameter to be able to add this later.)

Fixes: #511
This commit is contained in:
Milan Broz
2021-01-31 12:39:34 +01:00
parent 2d10545e70
commit 37cc06444d
12 changed files with 68 additions and 2 deletions

View File

@@ -2194,6 +2194,8 @@ static int action_luksDump(void)
r = luksDump_with_volume_key(cd);
else if (ARG_SET(OPT_UNBOUND_ID))
r = luksDump_with_unbound_key(cd);
else if (ARG_SET(OPT_DUMP_JSON_ID))
r = crypt_dump_json(cd, NULL, 0);
else
r = crypt_dump(cd);
out: