Encryption Keys

This page covers configuration and management of View collection objects.

Object Overview

Encryption keys are the key material used to encrypt and decrypt data.

Endpoint, URL, and Supported Methods

Objects are managed via the Configuration server API at [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/encryptionkeys

Supported methods include: GET HEAD PUT DELETE

Structure

Objects have the following structure:

{
    "GUID": "c3c8b73d-859b-48a2-bfaf-511e83423585",
    "TenantGUID": "00000000-0000-0000-0000-000000000000",
    "OwnerGUID": "00000000-0000-0000-0000-000000000000",
    "KeyBase64": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
    "KeyHex": "0000000000000000000000000000000000000000000000000000000000000000",
    "IvBase64": "AAAAAAAAAAAAAAAAAAAAAA==",
    "IvHex": "00000000000000000000000000000000",
    "SaltBase64": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
    "SaltHex": "0000000000000000000000000000000000000000000000000000000000000000",
    "Name": "Another default key",
    "Description": "Another default key",
    "CreatedUtc": "2025-03-29T08:38:38.457116Z"
}

  • GUID GUID globally unique identifier for the object
  • TenantGUID GUID globally unique identifier for the tenant
  • OwnerGUID GUID globally unique identifier for the owner
  • Name string name of the object
  • KeyBase64 string key on base 64 string
  • KeyHex``string key in hex format
  • IvBase64 strgin Iv in base 64 string
  • IvHex stringIv in Hex format
  • SaltBase64 string Salt in base 64 string
  • SaltHex string Salt in Hex format
  • Description string description of the object
  • CreatedUtc datetime timestamp from creation, in UTC time

Create

To create, call PUT /v1.0/tenants/[tenant-guid]/encryptionkeys with the following properties using the Configuration server

curl --location --request PUT 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/encryptionkeys' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "KeyBase64": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
    "KeyHex": "0000000000000000000000000000000000000000000000000000000000000000",
    "IvBase64": "AAAAAAAAAAAAAAAAAAAAAA==",
    "IvHex": "00000000000000000000000000000000",
    "SaltBase64": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
    "SaltHex": "0000000000000000000000000000000000000000000000000000000000000000",
    "Name": "Another default key",
    "Description": "Another default key"
}'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "http://localhost:8000/", //endpoint
  "default", //tenant Id
  "default" //access key
);

const createEncryptionKeys = async () => {
  try {
    const response = await api.EncryptionKey.create({
      KeyBase64: "*********************************AA=",
      KeyHex:
        "************************************************000",
      IvBase64: "**********************A==",
      IvHex: "***************************000",
      SaltBase64: "***************************************AA=",
      SaltHex:
        "********************************************************000",
      Name: "Another default key ash test",
      Description: "Another default key",
    });
    console.log(response, "Encryption keys created successfully");
  } catch (err) {
    console.log("Error creating Encryption keys:", err);
  }
};

createEncryptionKeys();
import view_sdk
from view_sdk import configuration

sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")

def createEncryptionKey():
    encryptionKey = configuration.EncryptionKey.create(
        KeyBase64="*********************************AA=",
        KeyHex="************************************************000",
        IvBase64="**********************A==",
        IvHex="***************************000",
        SaltBase64="***************************************AA=",
        SaltHex="********************************************************000",
        Name="Another default key",
        Description="Another default key"
    )
    print(encryptionKey)

createEncryptionKey()
using View.Sdk;
using View.Sdk.Configuration;

ViewConfigurationSdk sdk = new ViewConfigurationSdk(Guid.Parse("<tenant-guid>"),"default", "http://localhost:8000/");
            
EncryptionKey newEncryptionKey = new EncryptionKey
{
    KeyBase64 = "*********************************AA=",
    KeyHex = "************************************************000",
    IvBase64 = "**********************A==",
    IvHex = "***************************000",
    SaltBase64 = "***************************************AA=",
    SaltHex = "********************************************************000",
    Name = "Another default key test",
    Description = "Another default key",
};

EncryptionKey createdEncryptionKey = await sdk.CreateEncryptionKey(newEncryptionKey);

Enumerate

Enumerate objects by using GET /v2.0/tenants/[tenant-guid]/encryptionkeys

curl --location 'http://view.homedns.org:8000/v2.0/tenants/00000000-0000-0000-0000-000000000000/encryptionkeys/' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "http://localhost:8000/", //endpoint
  "default", //tenant Id
  "default" //access key
);


const enumerateEncryptionKeys = async () => {
  try {
    const response = await api.EncryptionKey.enumerate();
    console.log(response, "Encryption keys fetched successfully");
  } catch (err) {
    console.log("Error fetching Encryption keys:", err);
  }
};

enumerateEncryptionKeys();
import view_sdk
from view_sdk import configuration

sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")

def enumerateEncryptionKeys():
    encryptionKeys = configuration.EncryptionKey.enumerate()
    print(encryptionKeys)

enumerateEncryptionKeys() 

Read

To read an object by GUID, call GET /v1.0/tenants/[tenant-guid]/encryptionkeys/[encryptionkey-guid]. If the object exists, it will be returned as a JSON object in the response body. If it does not exist, a 404 will be returned with a NotFound error response.

curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/encryptionkeys/00000000-0000-0000-0000-000000000000' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "http://localhost:8000/", //endpoint
  "default", //tenant Id
  "default" //access key
);
const readEncryptionKey = async () => {
  try {
    const response = await api.EncryptionKey.read(
      "<encryptionkey-guid>"
    );
    console.log(response, "Encryption key fetched successfully");
  } catch (err) {
    console.log("Error fetching Encryption key:", err);
  }
};

readEncryptionKey();
import view_sdk
from view_sdk import configuration

sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")

def readEncryptionKey():
    encryptionKey = configuration.EncryptionKey.retrieve("<encryptionkey-guid>")
    print(encryptionKey)

readEncryptionKey()
using View.Sdk;
using View.Sdk.Configuration;

ViewConfigurationSdk sdk = new ViewConfigurationSdk(Guid.Parse("<tenant-guid>"),"default", "http://localhost:8000/");
            
EncryptionKey encryptionKey = await sdk.RetrieveEncryptionKey(Guid.Parse("<encryptionkey-guid>"));

Read all

o read all objects, call GET /v1.0/tenants/[tenant-guid]/encryptionkeys/. If the object exists, it will be returned as an array of JSON object in the response body

curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/encryptionkeys/' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "http://localhost:8000/", //endpoint
  "default", //tenant Id
  "default" //access key
);

const readAllEncryptionKeys = async () => {
  try {
    const response = await api.EncryptionKey.readAll();
    console.log(response, "All encryption keys fetched successfully");
  } catch (err) {
    console.log("Error fetching All encryption keys:", err);
  }
};

readAllEncryptionKeys();
import view_sdk
from view_sdk import configuration

sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")

def readAllEncryptionKeys():
    encryptionKeys = configuration.EncryptionKey.retrieve_all()
    print(encryptionKeys)

readAllEncryptionKeys()
using View.Sdk;
using View.Sdk.Configuration;

ViewConfigurationSdk sdk = new ViewConfigurationSdk(Guid.Parse("<tenant-guid>"),"default", "http://localhost:8000/");
            
List<EncryptionKey> encryptionKeys = await sdk.RetrieveEncryptionKeys();

Update

To update, call PUT /v1.0/tenants/[tenant-guid]/encryptionkeys/{encryptionkey-guid} with the object properties using the Configuration server

curl --location --request PUT 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/encryptionkeys/00000000-0000-0000-0000-000000000000' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "KeyBase64": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
    "KeyHex": "0000000000000000000000000000000000000000000000000000000000000000",
    "IvBase64": "AAAAAAAAAAAAAAAAAAAAAA==",
    "IvHex": "00000000000000000000000000000000",
    "SaltBase64": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
    "SaltHex": "0000000000000000000000000000000000000000000000000000000000000000",
    "Name": "Default key, updated",
    "Description": "Default key"
}'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "http://localhost:8000/", //endpoint
  "default", //tenant Id
  "default" //access key
);

const updateEncryptionKey = async () => {
  try {
    const response = await api.EncryptionKey.update({
      GUID: "<encryptionkey-guid>",
      TenantGUID: "<tenant-guid>",
      OwnerGUID: "<owner-guid>",
      KeyBase64: "*********************************AA=",
      KeyHex:
        "************************************************000",
      IvBase64: "**********************A==",
      IvHex: "***************************000",
      SaltBase64: "***************************************AA=",
      SaltHex:
        "********************************************************000",
      Name: "Another default key ash test [UPDATED]",
      Description: "Another default key",
      CreatedUtc: "2025-03-29T08:44:07.522780Z",
    });
    console.log(response, "Encryption key updated successfully");
  } catch (err) {
    console.log("Error updating Encryption key:", err);
  }
};

updateEncryptionKey();
import view_sdk
from view_sdk import configuration

sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")

def updateEncryptionKey():
    encryptionKey = configuration.EncryptionKey.update("<encryptionkey-guid>",
       KeyBase64="*********************************AA=",
        KeyHex="************************************************000",
        IvBase64="**********************A==",
        IvHex="***************************000",
        SaltBase64="***************************************AA=",
        SaltHex="********************************************************000",
        Name="Another default key",
        Description="Another default key [updated]"
    )
    print(encryptionKey)

updateEncryptionKey()
using View.Sdk;
using View.Sdk.Configuration;

ViewConfigurationSdk sdk = new ViewConfigurationSdk(Guid.Parse("<tenant-guid>"),"default", "http://localhost:8000/");
            
var encryptionKey = new EncryptionKey
{ 
    GUID = Guid.Parse("<encryptionkey-guid>"),
    TenantGUID = Guid.Parse("<tenant-guid>"),
    OwnerGUID = Guid.Parse("<owner-guid>"),
    KeyBase64 = "*********************************AA=",
    KeyHex = "************************************************000",
    IvBase64 = "**********************A==",
    IvHex = "***************************000",
    SaltBase64 = "***************************************AA=",
    SaltHex = "********************************************************000",
    Name = "Another default key test [UPDATED]",
    Description = "Another default key",
};

EncryptionKey updatedEncryptionKey = await sdk.UpdateEncryptionKey(encryptionKey);

Delete

To delete an object by GUID, call DELETE /v1.0/tenants/[tenant-guid]/encryptionkeys/[encryptionkey-guid].

curl --location --request DELETE 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/encryptionkeys/00000000-0000-0000-0000-000000000000' \
--header 'Authorization: ••••••' \
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "http://localhost:8000/", //endpoint
  "default", //tenant Id
  "default" //access key
);
const deleteEncryptionKey = async () => {
  try {
    const response = await api.EncryptionKey.delete(
      "<encryptionkey-guid>"
    );
    console.log(response, "Encryption key deleted successfully");
  } catch (err) {
    console.log("Error deleting Encryption key:", err);
  }
};

deleteEncryptionKey();
import view_sdk
from view_sdk import configuration

sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")

def deleteEncryptionKey():
    encryptionKey = configuration.EncryptionKey.delete("<encryptionkey-guid>")
    print(encryptionKey)

deleteEncryptionKey()

using View.Sdk;
using View.Sdk.Configuration;

ViewConfigurationSdk sdk = new ViewConfigurationSdk(Guid.Parse("<tenant-guid>"),"default", "http://localhost:8000/");

bool deleted = await sdk.DeleteEncryptionKey(Guid.Parse("<encryptionkey-guid>"));

Check Existence

Note: the HEAD method can be used as an alternative to get to simply check the existence of the object. HEAD requests return either a 200/OK in the event the object exists, or a 404/Not Found if not. No response body is returned with a HEAD request.

curl --location --head 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/encryptionkey/00000000-0000-0000-0000-000000000000' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "http://localhost:8000/", //endpoint
  "default", //tenant Id
  "default" //access key
);

const encryptionKeyExists = async () => {
  try {
    const response = await api.EncryptionKey.exists(
      "<encryptionkey-guid>"
    );
    console.log(response, "Encryption key exists");
  } catch (err) {
    console.log("Error checking Encryption key:", err);
  }
};

encryptionKeyExists();
import view_sdk
from view_sdk import configuration

sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")

def existsEncryptionKey():
    encryptionKey = configuration.EncryptionKey.exists("<encryptionkey-guid>")
    print(encryptionKey)

existsEncryptionKey()
using System.Text.Json;
using View.Sdk;
using View.Sdk.Configuration;

ViewConfigurationSdk sdk = new ViewConfigurationSdk(Guid.Parse("<tenant-guid>"),"default", "http://view.homedns.org:8000/");

bool exists = await sdk.ExistsEncryptionKey(Guid.Parse("<encryptionkey-guid>"));