Pular para o conteúdo principal

Key Stores

A Key Store is a place outside the Server's database where a Vault Certificate's private key may live: an HSM or a cloud key service the Server is configured and credentialed to reach. The key is used there and never leaves it. A certificate whose key is a file the vault stores needs its password at every Signing Session; one whose key is in a Key Store does not, because the Server can reach the key itself, and a Vault PIN an Administrator sets is what a session's pin is checked against instead.

Key Stores need Server 1.31.0 or later with the Certificate Vault on. No newer Workstation is needed: a Vault Certificate is signed with by the Server, never by a machine. A deployment that declares no store sees a Key Stores page that says so and a Pending Keys tab that offers no generation, and its certificates held as files work as before.

This version reads three types: Azure Key Vault, AWS KMS and Amplia (below). What the Server does with a store:

  • declare it in configuration, probe it and show it on the admin console's Key Stores page;
  • adopt a key already in it as a Vault Certificate, import a PFX into it, keeping no file, or move a certificate the vault holds as a file into it;
  • grant its certificates to Windows accounts and to Client Applications, with no password typed;
  • generate a Pending Key in it, or adopt a key already there as one, issue its CSRs, and register the certificate a CA issues for it;
  • renew a certificate over the same key or over a new one;
  • destroy a certificate, deleting its key in the store or leaving it there.

Signing Sessions then sign with the key in place.

The Server can sign unasked​

Whoever holds a store's credential, and can reach the store, can sign with every key in it. That includes the Server: it signs with a certificate held in a Key Store whenever it can reach the store, without a password from anybody. The Key Stores page and every screen that shows such a certificate say so. Treat the credential as you treat the Key Ring Protector: it is configuration, never in the database and never on a screen, and of the two it is the one that signs.

Declaring a store​

A store is configuration under KeyStores:<name>, where the name is yours to choose (Configuration has every key):

{
"KeyStores": {
"signing": {
"Type": "AzureKeyVault",
"VaultUri": "https://contoso-signing.vault.azure.net/"
}
}
}

An AWS KMS store is declared by its region, and its keys are the KMS keys of the account its credential reaches there:

{
"KeyStores": {
"kms": {
"Type": "AwsKms",
"Region": "sa-east-1"
}
}
}
  • An Azure store is a Key Vault or a Managed HSM. The Server makes a key there only when it generates a Pending Key. That key, and one it imports, is an HSM key, which a Standard-tier vault refuses, so generating a Pending Key, importing a PFX, and moving a certificate by the drawer or by import need a Premium-tier vault or a Managed HSM. Adopting a key already there, and a move by adoption, work on either tier.
  • An AWS KMS store's keys are RSA signing keys (SIGN_VERIFY, RSA_2048 to RSA_4096) in the account's standard key store, which AWS holds in its own HSMs, whether KMS generated the key or it was imported. A key in a CloudHSM or external key store, or of any other spec, is refused.
  • The Certificate Vault must be on. A store on a Server with Vault:Enabled off refuses the start, and so does turning the vault off with a store still declared.
  • Adding, changing or removing a store is a deployment change and a restart. Nothing about a store is administered from the console.

Renaming a store breaks every certificate it holds. The name is what a Vault Certificate records, and what the console shows. A certificate whose store is no longer declared cannot sign until the old name is back: the Server still starts, logs one Critical line per missing name, shows a banner naming it, and those certificates answer PIN_NOT_AVAILABLE to a Signing Session and FAILED to a Desktop Signature.

The credential​

Azure Key Vault: the managed identity, or a client secret​

On Azure App Service, use the app's managed identity, and there is no secret anywhere. Declare the store with Type and VaultUri only, turn on the app's system-assigned identity (az webapp identity assign -g <rg> -n <app>), and grant that identity the rights below on the vault. To use a user-assigned identity instead, attach it to the app and set ClientId to its client id. The Server asks the managed identity and nothing else, so a developer's Azure CLI sign-in never stands in for it.

On the Docker posture there is no managed identity, so the store uses an Entra ID application's client secret: TenantId, ClientId and ClientSecret, all three. The secret goes where the Key Ring Protector goes, .env, never a tracked file. A ClientSecret missing either of the other two, or a TenantId without the secret, refuses the start, naming the key that is missing. A ClientId alone does not: it names a user-assigned managed identity, which the Docker posture does not have, so the Server starts and the store fails its probes. A ClientId or ClientSecret written and left blank, as an unset variable in a compose file leaves it, refuses the start too.

AWS KMS: the default chain, or an access key​

On AWS, use the default credential chain, and there is no secret anywhere. Declare the store with Type and Region only, and run the Server under an IAM role with the rights below: the EC2 instance's profile, the ECS task's role or the EKS pod's. The chain also reads the AWS_* environment variables.

Outside AWS there is no such role, so the store uses an IAM user's access key: AccessKeyId and SecretAccessKey, both. They go where the Key Ring Protector goes, .env on Docker, a Key Vault reference on App Service, never a tracked file. One without the other, or either written and left blank, refuses the start rather than reading as the default chain. Bridging an Azure managed identity to AWS is not offered.

Either may assume a role: set RoleArn, and the Server signs with the role's rights, the access key or the chain needing only sts:AssumeRole on it. The role's sessions are named Lacuna.CertificateStorage in CloudTrail. A credential that cannot be obtained reads credential refused on the Key Stores page, with its banner; a role the credential may not assume is meant to read the same, which has not been checked against AWS's own STS.

The Key Stores page shows the region as the store's target, and which of the four credentials it uses: an access key, the default credentials, or either assuming a role. Never a value.

Amplia: an API key​

See Amplia.

What the Server does with a store​

  • At start it checks every store's declaration and builds each one. A malformed declaration refuses the start and names the key. A store it cannot reach does not: the Server starts.
  • It probes each store at start and every five minutes, and the Key Stores page shows each one's state: reachable, unreachable, credential refused or not yet probed, with the time of the last probe and the last error. The probe reads a key name that does not exist, so it proves that the store answers and accepts the credential, and nothing about signing. In Azure it needs keys/read. In AWS it asks kms:DescribeKey of an alias nobody made; whether KMS refuses that to a credential without the right, or answers not found first, has not been checked, so a reachable AWS store does not show that its credential may describe keys. A probe the store does not answer in one minute reads unreachable. Every real use of a store, a signature or a key's lookup, updates its state as a probe does, so a store in use is never five minutes stale.
  • While a store is failing, its certificates cannot sign: a Signing Session is answered PIN_NOT_AVAILABLE and a Desktop Signature FAILED. (A document signed through the Signer has its call accepted first, and its operation then fails with that code; signing digests, and signing with REST PKI Core, are answered it directly.) The admin console shows a banner for the store, and the Server logs one Error when it starts failing and one Information when it answers again. Certificates held as files are not affected, and /healthz never asks a store.
  • A credential refused on a key's lookup or a signature stays refused. The store reads credential refused until a signature through it succeeds (a Signing Session's, a Desktop Signature's, a CSR's, or the proof an adoption, an import or a registration signs): a probe, a lookup or an import that answers does not clear it, since none of them proves the credential may sign. The state is held in memory, so once the role is fixed it clears at the next signature that succeeds, or at a restart. A refusal only the probe met clears at the next probe the store answers.
  • An import the credential is refused refuses that import alone (a credential granted Key Vault Crypto User may sign and not import) and leaves the store's state as it was. An import that cannot reach the store marks it unreachable, as any use does.
  • Each call to a store is bounded by Signing:HashSignTimeout: each digest, the read of the key before a signature or a new session's binding, and what an Administrator's gesture asks of the store. A store that does not answer in time is unreachable.

Adopting a key already in a store​

A key generated in the store, or loaded there with the vendor's tool, becomes a Vault Certificate by adoption. On the Certificate Vault page, choose the store as where the key is held, then:

  1. Upload the holder's certificate alone, as DER or PEM (.cer, .crt, .pem). It is validated once, as any import is.
  2. Name the key, or leave the name empty. With a name, the Server fetches that key and checks that it is the certificate's. Without one, it searches the store for the key whose public key is the certificate's, which on Azure Key Vault reads every key and every version, one call each: on a large vault, give the name. On AWS KMS, give the name, and the form asks for it: a KMS key's name is its alias, without alias/; its key id or ARN is taken too.
  3. Type a Vault PIN twice, up to 256 characters, not only spaces, and give it to the holder yourself. It is what a Signing Session's pin is checked against for this certificate, in place of a file's password; the Server keeps a verifier of it under the vault's Key Ring and never the PIN.

Nothing is written until the store's key has signed. The Server signs a throwaway digest with the key and verifies it against the certificate. A key that is not found, is not the certificate's, needs a store-login PIN, or does not sign is refused, naming the store, and nothing is stored. The key is read again just before the row is written, and a key gone by then, or a store that does not answer within four seconds, is refused too.

The version is pinned. The vault records the key's version with its name, so a new version made later under the same name is never used for this certificate. On AWS KMS the vault records the key's ARN, never the alias it was named by, so an alias pointed at another key later changes nothing.

What follows:

  • An Administrator sets a new Vault PIN from the certificate's drawer, typed twice, with no old PIN asked; it is audited (admin.vault-pin-set). Live sessions stay; every new one, and every per-call pin, is checked against the new PIN.
  • A session made with the Vault PIN holds no secret, so it survives a Server restart. The session's creation looks the key up without signing, and a store that is down, or a key that is gone, answers PIN_NOT_AVAILABLE and binds nothing; a signature answers the same way.
  • Taking the certificate out of use refuses its next signature, as for a file.
  • Granting it to a Windows account or to a Client Application needs no password (below).

Importing a PFX into a store​

A certificate whose key is in a PFX can go into a store instead of into the vault as a file. On the Certificate Vault page, choose the store as where the key is held, choose Import a PFX into the store, then upload the PFX, type its password, and type a Vault PIN twice, as for an adoption.

  • The key must be RSA, of 2048, 3072 or 4096 bits. Any other is refused before the store is asked.
  • The Server opens the file itself, not through the Lacuna PKI SDK, so a PFX whose key is shrouded under PBES2 (what openssl pkcs12 -export writes by default), which the vault refuses as a file, goes into a store.
  • The key is placed as a key that signs only and cannot be exported. On Azure Key Vault it is an HSM-protected key, which a Standard vault refuses, and the refusal says to adopt instead. On AWS KMS it is a new KMS key of origin EXTERNAL, imported with no expiry. The key's name is the Server's own, tb- followed by the certificate's thumbprint and a part never used before, so no name is ever used twice.
  • Nothing is written until the key has signed in the store, as for an adoption. An import that fails after the key is placed deletes the key again (on AWS KMS, a deletion scheduled for seven days). A key the Server placed and could not account for is named in one Error (below).
  • No file is kept. The password is used for that one import and dropped. The audit row records the store, the key and that the key was imported.
  • A certificate the vault already holds in a store is refused, because nothing moves between stores. One it holds as a file is moved instead, once you confirm.

An imported key had an earlier life. It existed in a file before it reached the store, and every copy of that file, with its password, is still the key: the drawer says so. The store's protection holds from the import onward. Where a key must never have existed outside the hardware, generate it there and adopt it.

A key the Server placed and left behind​

An import or a move places its key before it writes anything, and removes it again when it does not complete. Four Error lines name a key it left, and they do not ask for the same thing:

The Error saysWhat it meansWhat to do
the key was not kept, and the Server could not remove itThe store refused the delete. No Vault Certificate names the key.Remove it with the store's own tool.
an import did not finish, and the key may be in the storeThe store did not answer the import, or, in AWS KMS, refused it part-way. A key AWS KMS left part-way has no alias yet: it carries the name as its lacuna-certificate-storage:key-name tag.Look for it, and remove it if it is there.
the move or import may or may not have committed (or been saved)The database answered the write with a failure and could not be read back. Where the write did land, this key is the certificate's only copy: a move deletes the file in the same write.Open the Certificate Vault page first. Remove the key only if the certificate is still held as a file, or is not there at all. If it is held in the store, leave the key.
whether a Vault Certificate names it could not be readThe Server would have removed the key, and could not check first that no certificate had come to name it.Check the Certificate Vault page for a certificate held under that key, and remove the key only if there is none.

The third line reads differently for an adoption: its key was in the store before, the Server did not touch it, and the line says so.

Moving a certificate held as a file into a store​

A certificate the vault already holds as a file moves into a store once, and one way. Three gestures make the same move:

  • The certificate's drawer, Move to a Key Store: type the file's password, choose the store, and type a Vault PIN twice.
  • Importing the same PFX again into a store.
  • Adopting the certificate in a store its key was already loaded into. No password is typed and the file is never opened: this is how a certificate moves into a store that refuses a plaintext import.

The move asks first. It says how many Signing Sessions the move ends, counted just before you confirm, and nothing is placed until you do. Then, once the key has signed in the store, the certificate changes place and its file is deleted in the same transaction. It keeps its row, its history and its out-of-use state. The audit row (admin.vault-certificate-moved) records the store, the key, the gesture and how many sessions the move ended.

Every session the Vault PIN did not unlock ends: its next signature answers PIN_NOT_AVAILABLE, and its client application creates it again with the Vault PIN. A per-call pin on such a session is refused without being compared. The Vault PIN is never compared with the file's password: to keep client applications sending the same value, type that value as the Vault PIN.

What stays behind. The database's earlier backups still hold the file, and with its password and the Key Ring, the key; the drawer says so.

Nothing moves back, and nothing moves between stores. The way there is to destroy the certificate and import it again, deleting the old key in its store or leaving it there.

Grants move with the certificate.

  • Desktop Grants: an Unattended grant signs on in the store, and the password the Server kept for it is deleted in the move. A Grant PIN grant keeps its PIN. Every open Grant Unlock holding the file's password ends, so each of those grantees types the PIN once more. See Desktop certificates.
  • Storage Grants: an Unattended grant signs on in the store, and the password the Server kept for it is deleted. A grant with the PIN on the call is suspended as pin changed: its application's PIN was the file's password, and from the move on it is the Vault PIN. The drawer, and the import's and the adoption's confirmations, list those grants before the click. Once the application has the Vault PIN, re-enable each from the Storage Grants screen. To keep the application sending the same value, type the file's password as the Vault PIN; the grant still waits to be re-enabled.

Pending Keys​

A Pending Key is a key in a store waiting for the certificate a CA issues for it: one the Server generates there, or one already there that an Administrator adopts by its name. It is not a Vault Certificate: it signs nothing but its CSRs, and has no Vault PIN, session or grant. The Certificate Vault page lists them on its Pending Keys tab, beside the certificates: each one's description, store, size, origin (generated or adopted), age and newest CSR, and the certificate it renews where a certificate's drawer generated it. Whoever may see the vault sees the tab; whoever may import into it generates, adopts, issues CSRs, edits a description and deletes one. The Key Stores page lists the Pending Keys of each store beside its certificates.

Generating one. On the tab, choose a configured store, a size (2048, the default, 3072 or 4096 bits) and a description saying whom or what the key is for. The Server creates an RSA key in the store that signs only and cannot be exported (on Azure Key Vault an HSM key, RSA-HSM), under a name of its own (tb-pending-…) never used before. With no store configured the tab offers no generation, and says so. A size the store will not make is refused.

Prefer 2048 bits on Azure Key Vault unless the certificate's policy asks for more: its service limits allow far fewer operations per vault on an HSM key of 3072 or 4096 bits, and every signature counts, a Signing Session's and a CSR's alike.

Adopting a key before its certificate. A key made in the store by another tool, in a key ceremony say, with no certificate yet, is adopted on the tab by its name: choose the store, type the key's name as the store's own tool shows it, and a description. Nothing on the console lists a store's keys. The Server records the key's current version, has the key sign a throwaway digest and verifies it, and writes nothing before that passes. TrustBridge does not check an adopted key's other attributes, and the form says so: it checks only that it is an RSA key allowed to sign, and it may be able to do more than sign and may be extractable. A key that needs a store PIN on every signature, a key a Pending Key or a Vault Certificate already names, and a name the store does not hold are refused, each said plainly. Nothing the Server does here ever deletes the key.

Issuing a CSR. A CSR is a PKCS#10 request the store's key signs; the key never leaves the store. The form takes the subject's usual fields (CN, which is required; O; one or more OU; L; ST; C, preset to BR; an e-mail address) and extra attributes by OID and value, and the hash: SHA-256 (the default), SHA-384 or SHA-512, signed RSA PKCS#1 v1.5. The request carries no extensions: a CA builds Key Usage, the SAN and ICP-Brasil's OIDs from its own policy. Filling the subject in while generating issues the first CSR in the same gesture, and any number more can be issued, each kept and listed newest first. A CSR leaves as a .csr PEM download or its PEM text copied. Issuing one needs the PKI SDK licence.

A CA usually replaces the subject with what its registration office checked, and the form says so. Whether a CA accepts a CSR made in this deployment's HSM for the certificate wanted (an e-CPF or an e-CNPJ among them) is that CA's business: ask it before planning around one.

Registering the certificate the CA issued. Open the Pending Key's row and upload the certificate as DER or PEM (.cer, .crt, .pem), or inside a PKCS#7 bundle (.p7b) with its chain, up to 256 KB, and type a Vault PIN twice; give it to the holder yourself. The Server takes the one certificate in the file whose public key is the Pending Key's. A file with no certificate over that key is refused, and so is one with two, and the Pending Key stays. The certificate must name its holder as an e-CPF or an e-CNPJ does, the store's key signs a proof, and the certificate is validated once, all before anything is written. The result is a Vault Certificate held in that store in every respect, whose drawer says how its key arrived, generated or adopted, and lists the CSRs the key issued. The Pending Key ends in the same write.

Adopting the certificate reaches the same place. Where an adoption finds a Pending Key's key, it completes as that Pending Key's registration, and the page says Registered.

A key's CSRs stay with the key, not with the Pending Key: every certificate over the key shows them in its drawer.

A Pending Key naming a store that is not configured is listed with a banner naming the store, and issues no CSR until the store is declared again under that name. It can still be deleted, its key left.

Deleting a Pending Key​

Nothing deletes a Pending Key on a timer: there is no lifetime to configure and no banner, and the tab's age column is the only nudge. Whoever may import into the vault deletes one from its row, behind the Pending Key's description typed. The dialog asks what becomes of its key first:

  • Delete the key in the store. The default for a key the Server generated.
  • Remove the Pending Key and leave its key in the store. The default for one adopted by its name, which other systems may use. Whoever holds the store's credential can still sign with a key left there, and it can be adopted again.

Only leaving is offered where the store is not configured on this Server, in an Amplia store, and where another row still names the key (in Azure Key Vault a deletion takes every version of a key's name). The dialog says why, and says beforehand what the store keeps of a deleted key and until when. A store that cannot be reached, or refuses, changes nothing. Each deletion writes admin.pending-key-deleted, whose keyFate is deleted, soft-deleted with keySoftDeletedUntil, not-live or left.

The audit records each generation (admin.pending-key-generated), each adoption of a key as a Pending Key (admin.pending-key-adopted), each deletion, each CSR (admin.key-csr-issued: the store, the key, the subject and the hash), and each registration as the import event every certificate entering the vault writes (admin.vault-certificate-imported), with the store, the key, its origin and the Pending Key it settled. A refused gesture records nothing.

A generation that fails after its key exists removes the key again. One that cannot says so in an Error:

The Error saysWhat it meansWhat to do
the key was not kept as a Pending Key, and the Server could not remove itThe store refused the delete, did not answer it within a minute, or, as in Amplia, deletes no key. Nothing names the key.Remove it with the store's own tool.
the key was not kept as a Pending Key, and whether a row names it could not be readThe database could not say whether the key was adopted meanwhile, so the key was left.Open the Pending Keys tab and the certificates. Remove the key only if nothing lists it.
a generation did not finish, and a key may be in the storeThe store did not answer the generation, or, in AWS KMS, refused it part-way (look for the lacuna-certificate-storage:key-name tag).Look for it, and remove it if it is there.
the Pending Key may or may not have been savedThe database answered the save with a failure and could not be read back.Open the Pending Keys tab. Remove the key only if no Pending Key lists it.

Renewing a certificate​

A Signing Session binds the holder's Vault Certificate that expires last, so a renewed certificate is tried before the one it renews; the thumbprint breaks a tie. A renewal is registered beside the old certificate, which is untouched: its verdict, Vault PIN, sessions and grants stay its own, and it keeps working until it expires or is taken out of use or destroyed.

Over the same key​

The drawer of every certificate held in a store has the CSR form a Pending Key has, prefilled from the certificate's subject. It is offered whatever way the key arrived, and while the certificate is in use, out of use or expired. The certificate the CA issues from it is registered on the same drawer, as DER, PEM or .p7b, as a second Vault Certificate over the same key, and records the same origin. A certificate held as a file issues no CSR, and its drawer says how it renews instead: by importing the new file, by moving it into a store first, or over a new key.

Over a new key​

Every certificate's drawer, held as a file or in a store, offers Renew with a new key: it generates a Pending Key that remembers the certificate it renews, prefilled from it (store, key size, subject and a description naming the certificate), and the certificate the CA issues for that key is registered on the Pending Key's row. This is also how a certificate held as a file is renewed into a store: its new key is generated there, and the file stays as it was. The certificate's drawer says a renewal is pending for as long as the Pending Key is there.

What a renewal takes from the old certificate​

  • The Vault PIN is kept by default, for a certificate held in a store: the holder's PIN opens both. The other choice is a new Vault PIN, typed twice. A certificate held as a file has no Vault PIN to keep, so a Vault PIN is typed for the new one.
  • The Desktop Grants are copied by default. The form lists them under a ticked box; untick it and none is made. Each copy keeps its machine, account and protection, is a grant of its own from then on, and starts locked. See Desktop certificates.
  • The Storage Grants are copied by the same box, each as replacing the old one, so the application's old reference reads replacedBy the new one and the application follows the renewal with no step of the Administrator's. An Unattended grant is copied whichever Vault PIN the renewal has. A grant with the PIN on the call is copied only where the Vault PIN is kept; otherwise it stays on the old certificate, and the form lists it apart as left behind. A copy keeps the old grant's suspension and its count of wrong PINs.
  • Nothing passes to another holder. The holder is matched by the old certificate's kind: an e-CNPJ renews as the same Company, whoever it names as responsible; an e-CPF renews as the same CPF. For a certificate naming another holder the form says so as soon as the file is chosen, the box is unticked and disabled, and a new Vault PIN is asked for. The Server holds to the rule whatever the form sent.
  • An adoption copies nothing: it sets a Vault PIN, as every adoption does.

Sessions without a PIN are refused for the holder while both certificates are in use: such a session binds only where exactly one certificate could serve it, and a renewal leaves two. It is answered INVALID_REQUEST, pin is required., and works again, binding the renewal, once the old certificate is taken out of use, destroyed or expires. The registration dialog says so beforehand.

The audit. A CSR from a drawer writes admin.key-csr-issued naming the certificate, on the holder's trail. The registration writes admin.vault-certificate-imported, naming the certificates that share the key (sharesKeyWith), the certificate renewed (renews) and the one the Vault PIN was kept from (vaultPinKeptFrom). Each copied Desktop Grant writes admin.desktop-grant-created (copiedFrom, copiedFromGrant); each copied Storage Grant writes admin.storage-grant-made and admin.storage-grant-replaced.

Granting a Key Store certificate​

To a Windows account (a Desktop Grant), a certificate held in a store is granted as one held as a file is, with no password typed. An Unattended grant keeps nothing, since the store's credential already signs unasked; a Grant PIN grant keeps a verifier of its PIN under the Key Ring. Each Desktop Signature signs in the store, and while the store cannot be reached is refused FAILED. Desktop certificates has the rest.

To a Client Application (a Storage Grant), from its drawer or the Storage Grants screen, also with no password typed. An Unattended grant keeps nothing: whoever holds the application's API key signs with the certificate through the store's credential. Under the PIN on the call the application sends the certificate's Vault PIN on each call, checked before the store is asked; wrong ones count on the grant alone, never on the holder's CPF or the vault's budget. While the store cannot be reached, refuses the Server's credential, is no longer declared, or the Certificate Vault is not open, a call is refused PIN_NOT_AVAILABLE with details store unreachable, and the grant's readiness reads the same. A store just back may read so until a call signs or the next probe, five minutes at most.

Destroying a Key Store certificate​

Destroying a certificate held in a store asks what becomes of its key, before the thumbprint is typed:

  • Delete the key in the store. The default for a key the Server put there: imported, moved, or generated as a Pending Key.
  • Remove the certificate and leave its key in the store. The default for an adopted key, which other systems may use. Whoever holds the store's credential can still sign with a key left there, and the certificate can be adopted again over it, or the key adopted by its name as a Pending Key.

Only leaving is offered where the store is not configured on this Server (or is declared at another vault than the one the key was recorded in), in an Amplia store, and where another certificate, or a Pending Key, still names the key: the dialog lists them, and only this certificate goes. No gesture destroys every certificate over a key at once: destroy them one by one, and the last one may delete the key. The Server enforces these refusals whatever the screen sent.

In Azure Key Vault the Server deletes the key and then purges it. A deleted key stays soft-deleted for the vault's retention, 7 to 90 days, where purge protection is on or the credential may not purge (keys/purge/action); otherwise the purge removes it at once. The dialog says beforehand what a deletion would leave and until when, and the answer and the audit row give the date the vault set. Recovering a soft-deleted key with Azure's tools does not bring the certificate back; it is adopted again.

In AWS KMS the Server schedules the key's deletion for seven days, the shortest window KMS allows, and deletes every alias that points at it. Until that date the key can be brought back by whoever may cancel its deletion (kms:CancelKeyDeletion): deny that to everyone who must not undo a destruction. The name is free at once, and a key made later under it is another key the destroyed certificate never signs with.

In the store first, then the row, in one request. A store that refuses the deletion changes nothing: the certificate stays, and the page says what was refused and what the store answered. A deletion whose outcome is not known changes nothing either: the key is named in an Error, and the page says to destroy it again, deleting its key, once the Key Stores page shows the store reachable.

The audit row (admin.vault-certificate-deleted) names the store and the key, and keyFate says what became of it: deleted, soft-deleted with keySoftDeletedUntil, not-live, or left (with any other owner in keyStillNamedBy). As for a certificate held as a file, its Vault PIN's verifier goes with the row, its Desktop Grants are revoked and its Storage Grants end. A destruction confirmed for a file is refused once the certificate has moved into a store meanwhile; confirm again.

Amplia​

An Amplia store is a Key Store whose keys Lacuna's Amplia holds, reached with the API key of an Amplia application. Declare it with the Amplia keys:

{
"KeyStores": {
"amplia": {
"Type": "Amplia",
"EndpointUri": "https://amplia.example.com/",
"ApiKey": "<the application's API key, from a secret store>",
"KeyStore": "HsmStore",
"SubscriptionId": "5f0c1f43-3f0c-4e53-8f0b-4f0f6a1d0001"
}
}
}
  • The API key is the credential, and it signs. Keep it where the Key Ring Protector goes. The Key Stores page shows the credential as API key, never its value, and EndpointUri as its target, which is https, or http to an Amplia on the same machine only.
  • KeyStore is the key store inside Amplia that a generated Pending Key goes in; without it, Amplia's default. Whether a key is in hardware is that key store's to say: the Server reports nothing about it. Where a key must be in an HSM, name an HSM-backed key store of Amplia's here, and adopt only keys made in one. Amplia's default key store (AzureSoft) makes no 3072-bit key: choose 2048 or 4096, or name another.
  • SubscriptionId is the Amplia subscription a generated Pending Key goes in. It lives in configuration rather than on the generation form, so that an Administrator account cannot place keys in another subscription the application reaches. Without it, Amplia decides.
GestureAmpliaWhy
Adopt a key, with its certificateyes, by the key's Amplia identifier (its GUID), which the form asks forthe provider cannot search by public key
Sign: Signing Sessions and Desktop Signaturesyesone digest per call to Amplia
Generate a Pending Key, and issue its CSRsyesin KeyStore and SubscriptionId
Adopt a key as a Pending Keyyes, by its identifieras above
Issue a CSR from a certificate's key, and register a certificate over ityesas a Pending Key's
Renew a certificate over a new key, a file-held one into Amplia among themyesits new key is a generated Pending Key's
Import a PFX, and a move by the drawer or by importno: the screen offers adoption alone and says whythe provider imports nothing
Move a certificate held as a file by adopting its keyyes, where the key is in Amplia alreadyan adoption opens no file
Destroy, or delete a Pending Key, deleting the keyno: only leave in the store, and the dialog says whythe provider deletes no key Amplia holds
  • A key with a store-login PIN of its own is refused, since it would need its PIN on every signature.
  • The probe reads a key identifier that names nothing. A refused API key reads credential refused, and an endpoint nobody answers reads unreachable. A wrong EndpointUri that something else answers, such as a gateway's 404, also reads credential refused; the last error on the Key Stores page says what was answered (HTTP 404), so check the endpoint before the key.
  • Nothing deletes a key in Amplia. A destroyed certificate leaves its key, which still signs for whoever holds the API key: delete it with Amplia's own tool if it should go. A generation that fails after Amplia made its key says so at Error, naming the key's identifier.
  • The application the API key belongs to needs to read keys and sign with them, and to create keys for Pending Keys. Whether Amplia refuses the probe to an application without the read role has not been checked. A missing role (RoleMissing) reads credential refused for a signature or a lookup.

The rights the credential needs​

Azure Key Vault​

Grant the Server's identity, on the vault, the data actions of each thing it does. The table is Azure Key Vault's role-based access on a vault; a Managed HSM's local role assignments must carry the same data actions. Azure's built-in Key Vault Crypto User role covers signing, issuing a CSR, the probe and adoption, and not import, generation or deleting a key.

ActionData action
Sign, and the proof an adoption or an import signskeys/sign/action and keys/read
The probe, adopt, a move by adoptionkeys/read
Import, and a move by the drawer or by importkeys/import/action and keys/read, and keys/delete with keys/purge/action to remove a key whose import failed
Generate a Pending Keykeys/create/action and keys/read; keys/sign/action for its first CSR; keys/delete with keys/purge/action to remove a key whose generation failed
Issue a CSR, register a certificate, adopt a key as a Pending Keykeys/sign/action and keys/read
Renew a certificate over a new keyas generating a Pending Key, then as registering
Destroy a certificate, or delete a Pending Key, deleting its keykeys/delete, keys/purge/action to purge, and keys/read
Destroy a certificate, or delete a Pending Key, leaving its keynothing in the store

A deployment that wants a credential that only signs grants Key Vault Crypto User and adopts; one that imports grants a custom role with the import row's actions and keys/sign/action. With Key Vault Crypto User, destroying a certificate or deleting a Pending Key can only leave its key.

AWS KMS​

Grant the Server's identity, or the role it assumes, these actions on the keys it uses. AWS's managed policies grant far more; write a policy of your own. Where a key policy does not delegate to IAM, it must grant the same.

ActionPermissions
Sign, and the proof an adoption or an import signskms:Sign, and kms:DescribeKey with kms:GetPublicKey
The probekms:DescribeKey
Adopt by namekms:DescribeKey, kms:GetPublicKey
Adopt by the certificate alonealso kms:ListKeys, on *; a key the credential may not read is passed over as no match
Generate a Pending Keykms:CreateKey, kms:TagResource, kms:CreateAlias on the key and its alias, kms:DescribeKey and kms:GetPublicKey; kms:Sign for its first CSR; kms:ScheduleKeyDeletion, kms:ListAliases and kms:DeleteAlias to remove a key whose generation failed
Import, and a move by the drawer or by importas generate, and kms:GetParametersForImport and kms:ImportKeyMaterial; kms:DeleteImportedKeyMaterial optionally
Issue a CSR, register a certificateas sign
Renew a certificate over a new keyas generate, then as sign
Destroy a certificate, or delete a Pending Key, deleting its keykms:ScheduleKeyDeletion, kms:ListAliases, kms:DeleteAlias, kms:DescribeKey and kms:GetPublicKey
Destroy a certificate, or delete a Pending Key, leaving its keynothing in the store

kms:ListKeys, kms:ListAliases and kms:CreateKey are granted on *. kms:CreateAlias and kms:DeleteAlias need the permission on the alias as well as on the key: the Server's own names are alias/tb-*, but a destruction deletes every alias that points at the key, and an adopted key's alias is the name your own tool gave it, so grant kms:DeleteAlias on those too, or on alias/*.

View as Markdown