Skip to content

Backup format in Lowkey Vault

Esta Nagy edited this page Jun 6, 2022 · 3 revisions

The bad news

Lowkey Vault is not compatible with original backups used by Azure Key Vault. This is due to the fact that Azure Key Vault needs to protect our backups while Lowkey Vault has no such requirements. In fact it is better if we can make it more accessible and simple.

The good news

Both formats are in the end using a Base64 string without padding, therefore as far as the original Azure clients are concerned, it is compatible. In case you need to prepare a key or secret that can be easily imported at the beginning of your test run, you can simply prepare the contents once and create a backup you can restore every time you start your tests.

Manual changes/templating

In case:

  1. Your use case would benefit from more flexible backups, for example using a template defining how your keys look like; or
  2. You need to see the backup contents, such as you want to check it in using a human-readable format to git

To read backup content

You can easily decode the Base64 string (please don't forget about the lack of padding) from the response, then decompress the GZip compressed JSON backup produced by Lowkey Vault.

Decompression can be done using the unpackBackup(byte[]) method of LowkeyVaultManagementClient.

To write backup content

Put together a valid JSON backup string, then use GZip to compress it, then encode using Base64 (without using padding) when creating your restore request.

Compression can be done using the compressBackup(String) method of LowkeyVaultManagementClient.

Sample backups

A few examples of sample backups using API version 7.2 and 7.3 can be found here.

Warning!

The inclusion of rotation policy is a breaking change in backups. In case you have old backups using v1.5.x or earlier, and you wish to use them with v1.6.x or later Lowkey Vault, please wrap your uncompressed JSON in a { "versions": <existing_array> }format