Skip to main content

Decrypt

post
/api/pvlt/1.0/data/collections/{collection}/decrypt/objects

Decrypts ciphertext. Supports bulk operations.

To decrypt ciphertext, the request must include the scope used when the ciphertext was encrypted. By default, only ciphertext considered active is decrypted. Ciphertext is considered active when its metadata expiration property is for the current or a future date. If options is set to archived, the ciphertext is only decrypted if its metadata expiration property is for a date in the past.

By default, all property values from the ciphertext are returned. Use props to return a subset of the encrypted property values.

If any request details are invalid, none of the ciphertexts are decrypted.

The role performing this operation must have both of these:

  • The CapCryptoDecrypter capability.
  • At least one allowing policy and no denying policies for the decrypt operation for each of the collection properties specified in the call.

See identity and access management for more information about how Vault uses capabilities to control access to operations and policies to control access to data.

Request

Path parameters

  • collection - string required*

    The name of a collection.

Query parameters

  • options - array of strings

    Options for the operation. Options include:

    • archived – whether to decrypt only archived objects. If not specified, decrypts only active objects.
    • include_metadata - show the encrypted object metadata.
    Each string:

    Option for the operation.

  • adhoc_reason - string

    An ad-hoc reason for accessing the Vault data. Required when reason is set to Other.

  • reason - string required*

    Details of the reason for requesting the property. The default is set when no access reason is provided and PVAULT_SERVICE_FORCE_ACCESS_REASON is false.

  • reload_cache - boolean

    Reloads the cache before the action.

Request body

Details of the decryption request.

array of objects required*
Each object:
  • encrypted_object - object required*

    An encrypted object.

    • ciphertext - string required*

      The encrypted object base64 cipher text.

    • scope - string

      The scope used to encrypt the object. By default, it uses the scope of the encrypted object.

  • props - array of strings

    The list of property names and transformers to include in the decrypted object. If not set, return all encrypted property values.

    Each string:
Example
[
{
"encrypted_object": "...",
"props": [
"phone_number",
"email"
]
}
]

Possible responses

The request is successful.

array of objects required*
Each object:
  • fields - object required*

    A list of maps of object properties and their values.

    Example
    {
    "date_of_birth": "1993-02-22",
    "email": "patfar@example.com",
    "first_name": "Pat",
    "last_name": "Far",
    "phone_number": "+11011010101"
    }
  • metadata - object
    • type - string required*

      The type of the encryption:

      • randomized - generates a different randomized unpredictable, non-repeating ciphertext each time.
      • deterministic - generates the ciphertext deterministically based on the collection name, input object, and scope. Defaults to randomized if not set.
    • scope - string required*

      The scope of the tokens.

    • expiration - string

      Effective expiry time of the encrypted object (UTC).

    • tags - array of strings required*

      Tags associated with the encrypted object.

      Each string:
Example
[
{
"fields": {
"date_of_birth": "1993-02-22",
"email": "patfar@example.com",
"first_name": "Pat",
"last_name": "Far",
"phone_number": "+11011010101"
},
"metadata": {
"type": "randomized",
"scope": "default",
"expiration": "2019-08-24T14:15:22Z",
"tags": [
"credit_cards"
]
}
}
]

Try the API

Authorization

Path parameters

Query parameters

Request body

Navigate to the docs of your local Vault installation to try the API directly from there.

Code examples

Example