Member-only story
JSON and Encryption Keys — A Marriage Made In Heaven
How many encryption and signing key formats are there? The answer to this — is a great deal. Why? Well, these days we can wrap an encryption key with a JSON format, and which provides additional information on how the encryption key can be used.
For a computer, these keys are just a bunch of 1’s and 0’s, but for humans, we are not so good at interpreting binary. Two common formats are DER (binary) and PEM (Base64). When interpreted as hexadecimal, DER looks something like this [here]:
The PEM format is a little more structured with a special header and footer, and with Base64 text in between:
None of these file formats gives much away about the details of the key, such as its identifier, the type of encryption used, and so on. And so the JSON format is often used to view a key, and Google Tink is a great place to view the key. With this, we can define a symmetric key, and where we give the key and ID, and then define the key type (as we can use a range of encryption methods). In the following, we use an AES GCM key: [link]
{
"primaryKeyId": 1331912396,
"key": [{
"keyData": {…