Skip to content

003 · Domain 6: Encryption as a service · 5% of the exam

Task 6.1: Encrypt and decrypt secrets

transit encrypt and decrypt with base64 plaintext, ciphertext prefixed with the key version, derived keys and context, and the capabilities each call needs.

Study it

Sample questions

Try each one before opening the answer. Every option is explained, with the HashiCorp documentation page that proves it.

Question 1 · choose 1

A developer runs vault write transit/encrypt/orders plaintext="card=4111" and Vault returns an error about decoding the plaintext. What must change?

  1. AThe orders key must be created with an RSA key type first
  2. BThe plaintext must be base64-encoded before it is sent
  3. CThe request must name a key version, as in transit/encrypt/orders/v1
  4. DThe request must add -wrap-ttl to wrap the plaintext in transit
Show the answer and why
  • AThe orders key must be created with an RSA key type first

    Incorrect

    The default aes256-gcm96 key encrypts; the error concerns the input encoding.

  • BThe plaintext must be base64-encoded before it is sent

    Correct

    Transit accepts any binary data, so it requires all plaintext to be base64-encoded.

  • CThe request must name a key version, as in transit/encrypt/orders/v1

    Incorrect

    The latest version is used by default, and versions are not given as path segments.

  • DThe request must add -wrap-ttl to wrap the plaintext in transit

    Incorrect

    Response wrapping wraps the response; it does not change how transit reads its input.

Encode with base64 on the way in and decode the plaintext that decrypt returns; transit never stores the data.

Question 2 · choose 1

The transit key tenant-data was created with derived=true so that each tenant's records use their own derived key. A service now encrypts with only the plaintext and gets an error. What must its encrypt and decrypt calls include?

  1. AThe same base64-encoded context value for the tenant on both calls
  2. BA base64-encoded nonce on the encrypt call only
  3. CThe key_version parameter on both calls
  4. DA context for the tenant on the encrypt call, which decryption reads from the ciphertext
Show the answer and why
  • AThe same base64-encoded context value for the tenant on both calls

    Correct

    With derivation enabled, every encrypt and decrypt request must provide a context, and decryption needs the context used to encrypt.

  • BA base64-encoded nonce on the encrypt call only

    Incorrect

    A nonce was needed only for convergent keys created in Vault 0.6.1; derivation requires a context.

  • CThe key_version parameter on both calls

    Incorrect

    This does not satisfy the context requirement of a derived key.

  • DA context for the tenant on the encrypt call, which decryption reads from the ciphertext

    Incorrect

    Decrypt requests on a derived key must provide the context as well; Vault does not take it from the ciphertext.

Key derivation turns one named key into many by mixing in a caller-supplied context, so the caller must supply that context every time.

Question 3 · choose 1

The transit engine is enabled at transit/. Which command creates a new encryption key named orders with the default settings?

  1. Avault secrets enable transit/keys/orders
  2. Bvault kv put transit/keys/orders type=aes256-gcm96
  3. Cvault write -f transit/keys/orders
  4. Dvault write transit/encrypt/orders
Show the answer and why
  • Avault secrets enable transit/keys/orders

    Incorrect

    secrets enable mounts an engine; it does not create keys.

  • Bvault kv put transit/keys/orders type=aes256-gcm96

    Incorrect

    kv commands are for KV engines, not transit.

  • Cvault write -f transit/keys/orders

    Correct

    Writing to keys/<name> creates a named key; -f sends the request without data.

  • Dvault write transit/encrypt/orders

    Incorrect

    An encrypt call needs plaintext; keys are created explicitly on keys/<name>.

Usually each application gets its own named key; the default type is aes256-gcm96.

Question 4 · choose 1

An engineer inherits dozens of transit keys of mixed types and must find out which of them can encrypt and decrypt data, without sending a test encrypt call to each key. What shows this?

  1. AA LIST of transit/keys, which returns each key's type and abilities
  2. BA read of transit/config/keys, the mount's key configuration
  3. CAn attempt at transit/export/encryption-key/<name> for every key
  4. DA read of each key; the response includes supports_encryption
Show the answer and why
  • AA LIST of transit/keys, which returns each key's type and abilities

    Incorrect

    Listing returns only the key names.

  • BA read of transit/config/keys, the mount's key configuration

    Incorrect

    It holds settings for the whole mount, not the abilities of each key.

  • CAn attempt at transit/export/encryption-key/<name> for every key

    Incorrect

    Export works only for keys marked exportable, so it says nothing about the others.

  • DA read of each key; the response includes supports_encryption

    Correct

    Reading a key returns its type and flags such as supports_encryption, supports_decryption and supports_signing.

A key read never returns key material: it shows the type, the versions with their creation times, and what the key supports, which makes it the safe way to audit existing keys.

Question 5 · choose 1

An application must encrypt and decrypt with the transit key orders and do nothing else. Which policy grants exactly that?

  1. Aupdate on transit/encrypt/orders and on transit/decrypt/orders
  2. Bread on transit/encrypt/orders and on transit/decrypt/orders
  3. Cupdate on transit/keys/orders
  4. Dcreate, read, update and delete on transit/*
Show the answer and why
  • Aupdate on transit/encrypt/orders and on transit/decrypt/orders

    Correct

    Encrypt and decrypt are POST requests, which map to update, on each key's endpoint.

  • Bread on transit/encrypt/orders and on transit/decrypt/orders

    Incorrect

    These endpoints take writes; read does not allow them.

  • Cupdate on transit/keys/orders

    Incorrect

    That path manages the key's configuration, not encryption.

  • Dcreate, read, update and delete on transit/*

    Incorrect

    This also lets the app reconfigure, rotate or delete every key.

ACLs let operators manage keys while applications only encrypt and decrypt with the keys they need.

Question 6 · choose 1

A job must encrypt 1,000 small values with the transit key orders and wants to avoid 1,000 separate requests. What should it send?

  1. AOne encrypt request with all values joined into a single plaintext
  2. BOne request whose batch_input lists every value
  3. COne request to transit/datakey for all values
  4. DOne request to transit/rewrap with the plaintexts
Show the answer and why
  • AOne encrypt request with all values joined into a single plaintext

    Incorrect

    That yields a single ciphertext, not one per value.

  • BOne request whose batch_input lists every value

    Correct

    batch_input takes a list of items, each with its own base64 plaintext, in a single request.

  • COne request to transit/datakey for all values

    Incorrect

    A data key is for local encryption; it does not encrypt the values.

  • DOne request to transit/rewrap with the plaintexts

    Incorrect

    Rewrap takes existing ciphertext, not plaintext.

Batch input keeps per-item results, including per-item errors, in one round trip.

Practice domain 6 →Practice all domains →