skipcheck

TM1 client · Docs · The server

EncryptionService

import io.skipcheck.tm1.client.service.encryption.EncryptionService;

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), DataEncryptionKeyRotationFailed and RotateDataModelKey.
  • 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
KeyProtectSettingsPatch 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();
return tm1.encryption()
    .validate(keyProtect)
    .flatMap(report -> Boolean.TRUE.equals(report.isValid()) ? tm1.encryption().configure(keyProtect)
            : Mono.error(new IllegalStateException("Can't encrypt: " + report.issues())));

Rotate the data encryption key:

// A new data encryption key; TM1 re-encrypts the whole model with it
return tm1.encryption().rotateDataEncryptionKey();

Members

EncryptionService constructorA service sending its requests through session.
validateChecks the provider settings would work now (the key service is reachable and allows it, and the key exists), changing nothing.
configureValidates the provider settings, then applies them; a server not yet encrypted is encrypted.
disableDecrypts the model and stops encrypting it.
rotateDataEncryptionKeyMakes a new data encryption key and re-encrypts the whole model with it.
rotateDataModelKeyRotates the model key.
encryptFileEncryptDataFile (schema 11.3.0).
decryptFileDecryptDataFile (schema 11.3.0).
encryptModelEncryptDataModel (schema 11.3.0).
decryptModelDecryptDataModel (schema 11.3.0).

EncryptionService

constructor
EncryptionService(Tm1Session session)

A service sending its requests through session.

Parameters

session
the session

validate

Mono<EncryptionAtRestValidationReport> validate(EncryptionAtRestProviderSettingsPatch settings)

ValidateEncryptionAtRestSettings: checks the provider settings would work now (the key service is reachable and allows it, and the key exists), changing nothing.

Parameters

settings
the provider settings

Returns

the report: whether they're valid, and if not, the issues; never secrets

TM1 REST FunctionImport ValidateEncryptionAtRestSettings

configure

Mono<Void> configure(EncryptionAtRestProviderSettingsPatch settings)

ConfigureEncryptionAtRest: validates the provider settings, then applies them; a server not yet encrypted is encrypted.

Parameters

settings
the provider settings

Returns

completes when they're applied

TM1 REST ActionImport ConfigureEncryptionAtRest

disable

Mono<Void> disable()

DisableEncryptionAtRest: decrypts the model and stops encrypting it.

Returns

completes when it's done

TM1 REST ActionImport DisableEncryptionAtRest

rotateDataEncryptionKey

Mono<Void> rotateDataEncryptionKey()

RotateDataEncryptionKey: makes a new data encryption key and re-encrypts the whole model with it.

Returns

completes when it's done

TM1 REST ActionImport RotateDataEncryptionKey

rotateDataModelKey

Mono<Void> rotateDataModelKey()

RotateDataModelKey: rotates the model key.

Returns

completes when it's done

TM1 REST ActionImport RotateDataModelKey

encryptFile

Mono<Void> encryptFile(String source, String destination, EncryptionFileType type)

EncryptDataFile (schema 11.3.0): encrypts one file, such as an exported cube.

Parameters

source
the file, relative to the data directory or absolute
destination
where the encrypted file goes
type
what the file is: a model object, a transaction log or an audit log

Returns

completes when it's written

TM1 REST ActionImport EncryptDataFile

decryptFile

Mono<Void> decryptFile(String source, String destination, EncryptionFileType type)

DecryptDataFile (schema 11.3.0): decrypts one file.

Parameters

source
the encrypted file, relative to the data directory or absolute
destination
where the decrypted file goes
type
what the file is

Returns

completes when it's written

TM1 REST ActionImport DecryptDataFile

encryptModel

Mono<Void> encryptModel(Duration timeUntilShutdown)

EncryptDataModel (schema 11.3.0): encrypts the model, then shuts the server down.

Parameters

timeUntilShutdown
how long to wait before shutting down, or null for TM1's

Returns

completes when it's started

TM1 REST ActionImport EncryptDataModel

decryptModel

Mono<Void> decryptModel(Duration timeUntilShutdown)

DecryptDataModel (schema 11.3.0): decrypts the model, then shuts the server down.

Parameters

timeUntilShutdown
how long to wait before shutting down, or null for TM1's

Returns

completes when it's started

TM1 REST ActionImport DecryptDataModel

Also in the Javadoc.