Class InternalCryptoUseCaseProvisioning
java.lang.Object
co.ankatech.ankasecure.keymanagement.model.InternalCryptoUseCaseProvisioning
- All Implemented Interfaces:
AutoCloseable
A provisioned internal cryptographic use case and the client secret of the actor credential it
created.
The Admin API returns the secret exactly once, in the answer to the creation, and keeps only a
hash of it: it cannot be read again. The SDK moves it out of the generated response into
clientSecret(), a zeroizable holder, so useCase() carries no secret at all. Store
the secret where the runtime that authenticates with it reads it, then close this value (or the
holder) to wipe it from memory. The secret never appears in toString(), a log or an exception
message.
try (InternalCryptoUseCaseProvisioning provisioned = sdk.internalCryptoUseCases().create(request)) {
provisioned.clientSecret().ifPresent(secret -> vault.store(provisioned.useCase().getUseCaseId(), secret.chars()));
}
-
Constructor Summary
ConstructorsConstructorDescriptionInternalCryptoUseCaseProvisioning(InternalCryptoUseCaseResponse useCase, SecretChars clientSecret) Creates the value. -
Method Summary
-
Constructor Details
-
InternalCryptoUseCaseProvisioning
public InternalCryptoUseCaseProvisioning(InternalCryptoUseCaseResponse useCase, SecretChars clientSecret) Creates the value.- Parameters:
useCase- the created use case, its credential's secret already removed; must not benullclientSecret- the credential's client secret, ornullwhen the answer carried none
-
-
Method Details
-
useCase
- Returns:
- the created use case; its credential block carries no secret
-
clientSecret
- Returns:
- the credential's client secret, returned once by the Admin API; empty when the answer carried none
-
close
public void close()Wipes the client secret. Idempotent.- Specified by:
closein interfaceAutoCloseable
-
toString
-