EncryptionService
using Skipcheck.Tm1.Client.Services; Encryption at rest (schema 11.8.35, except where a method says): the model's files
encrypted with a data encryption key, itself protected by a key from a key management
service. The provider settings are a KeyProtectSettingsPatch (IBM Key Protect),
VaultSettingsPatch (HashiCorp Vault) or
LocalKeyFileProviderSettingsPatch (a key file made with the local GSKit).
What TM1 (11.8) does here that you might not expect:
- The local key file provider needs GSKit's
gsk9capicmd_64, which a TM1 install may lack (the Docker image used in this project's tests does): validation then reports "Could not generate a new key using the local GSKit installation". - On a server that isn't encrypted, the changing actions fail with a bare 400 and an
error code's name for a message:
DataModelConversion(configure, disable),DataFileConversion(encrypt or decrypt a file),DataEncryptionKeyRotationFailedandRotateDataModelKey. - Each must be run by a full administrator.
Encrypt the model with a key from IBM Key Protect, checking the settings first:
// Check the settings first: the report says what's wrong, without secrets
var keyProtect = KeyProtectSettingsPatch
.Builder()
.ServiceEndpoint("https://us-south.kms.cloud.ibm.com")
.InstanceID("8f2c1d6e-0000-4000-8000-000000000000")
.AuthRef("/run/secrets/key-protect-api-key")
.KeyRef("planning-root-key")
.Build();
var report = await tm1.Encryption.ValidateAsync(keyProtect);
if (report.IsValid != true)
{
throw new InvalidOperationException("Can't encrypt: " + string.Join("; ", report.Issues ?? []));
}
await tm1.Encryption.ConfigureAsync(keyProtect);
Rotate the data encryption key:
// A new data encryption key; TM1 re-encrypts the whole model with it
await tm1.Encryption.RotateDataEncryptionKeyAsync();
Members
EncryptionService constructor | A service that sends its requests through session. |
ValidateAsync | Checks the provider settings would work now (the key service is reachable and allows it, and the key exists), changing nothing. |
ConfigureAsync | Validates the provider settings, then applies them; a server not yet encrypted is encrypted. |
DisableAsync | Decrypts the model and stops encrypting it. |
RotateDataEncryptionKeyAsync | Makes a new data encryption key and re-encrypts the whole model with it. |
RotateDataModelKeyAsync | Rotates the model key. |
EncryptFileAsync | EncryptDataFile (schema 11.3.0). |
DecryptFileAsync | DecryptDataFile (schema 11.3.0). |
EncryptModelAsync | EncryptDataModel (schema 11.3.0). |
DecryptModelAsync | DecryptDataModel (schema 11.3.0). |
EncryptionService
constructorEncryptionService(Tm1Session session)A service that sends its requests through session.
ValidateAsync
Task<EncryptionAtRestValidationReport> ValidateAsync(EncryptionAtRestProviderSettingsPatch settings, CancellationToken cancellationToken = default)ValidateEncryptionAtRestSettings: checks the provider settings would work now
(the key service is reachable and allows it, and the key exists), changing nothing. Returns the
report: whether they're valid, and if not, the issues; never secrets.
TM1 REST FunctionImport ValidateEncryptionAtRestSettings
ConfigureAsync
Task ConfigureAsync(EncryptionAtRestProviderSettingsPatch settings, CancellationToken cancellationToken = default)ConfigureEncryptionAtRest: validates the provider settings, then applies them; a
server not yet encrypted is encrypted.
TM1 REST ActionImport ConfigureEncryptionAtRest
DisableAsync
Task DisableAsync(CancellationToken cancellationToken = default)DisableEncryptionAtRest: decrypts the model and stops encrypting it.
TM1 REST ActionImport DisableEncryptionAtRest
RotateDataEncryptionKeyAsync
Task RotateDataEncryptionKeyAsync(CancellationToken cancellationToken = default)RotateDataEncryptionKey: makes a new data encryption key and re-encrypts the
whole model with it.
TM1 REST ActionImport RotateDataEncryptionKey
RotateDataModelKeyAsync
Task RotateDataModelKeyAsync(CancellationToken cancellationToken = default)RotateDataModelKey: rotates the model key.
TM1 REST ActionImport RotateDataModelKey
EncryptFileAsync
Task EncryptFileAsync(string source, string destination, EncryptionFileType type, CancellationToken cancellationToken = default)EncryptDataFile (schema 11.3.0): encrypts one file, such as an exported cube.
source is relative to the data directory or absolute;
type says what the file is: a model object, a transaction log or an audit log.
TM1 REST ActionImport EncryptDataFile
DecryptFileAsync
Task DecryptFileAsync(string source, string destination, EncryptionFileType type, CancellationToken cancellationToken = default)DecryptDataFile (schema 11.3.0): decrypts one file.
TM1 REST ActionImport DecryptDataFile
EncryptModelAsync
Task EncryptModelAsync(TimeSpan? timeUntilShutdown = null, CancellationToken cancellationToken = default)EncryptDataModel (schema 11.3.0): encrypts the model, then shuts the server down
after timeUntilShutdown, or TM1's default if null. Completes when it's
started. Deprecated in TM1 schema 11.8.35: use ConfigureAsync.
TM1 REST ActionImport EncryptDataModel
DecryptModelAsync
Task DecryptModelAsync(TimeSpan? timeUntilShutdown = null, CancellationToken cancellationToken = default)DecryptDataModel (schema 11.3.0): decrypts the model, then shuts the server down
after timeUntilShutdown, or TM1's default if null. Completes when it's
started. Deprecated in TM1 schema 11.8.35: use DisableAsync.
TM1 REST ActionImport DecryptDataModel