---
title: TINES_ENCRYPT
url: https://www.tines.com/docs/formulas/functions/tines-encrypt/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# TINES_ENCRYPT

*[View on tines.com](https://www.tines.com/docs/formulas/functions/tines-encrypt/)*

Encrypts text using Tines encryption. TINES_ENCRYPT is intentionally abstract. Guarantees: authenticated encryption; safe key and IV management with randomized 192-bit IVs and negligible collision probability (no IV reuse even under very high volume); TINES_DECRYPT will always decrypt the output; and, when the OpenSSL FIPS provider is enabled, a FIPS 140–validated crypto module is used. If you need to know or control the exact algorithm, use OPENSSL_ENCRYPT instead.

Implementation note (non-binding; subject to change): currently AES-256-GCM via OpenSSL with a randomized 192-bit IV; a 96-bit segment is used in key derivation; and a SHA-256 HMAC commitment tag over the ciphertext, IV, and auth tag.
Arguments:

text: Plaintext to encrypt.

key: Text of at least 32 bytes. Longer keys are condensed to 32 bytes internally via domain separated HMAC.

expires_in: Integer seconds (>= 0). 0 expires immediately (second granularity; subject to clock skew). Negative values raise an error.

**Categories:** Encryption

## Syntax

```
TINES_ENCRYPT(text, key, [expires_in])
```

## Examples

### Example 1

Formula:

```
TINES_ENCRYPT("hello world", CREDENTIAL.secret_key, expires_in: 60)
```

## Sample actions

```json
{
  "standardLibVersion": "70",
  "actionRuntimeVersion": "2",
  "agents": [
    {
      "disabled": false,
      "name": "TINES_ENCRYPT",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "tines_encrypt": "=TINES_ENCRYPT(my_action.message, CREDENTIAL.aes_secret_key, expires_in: 60)"
        }
      },
      "position": {
        "x": 1620,
        "y": 1830
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "message": "This is a private message for your eyes only!"
        }
      },
      "position": {
        "x": 1725,
        "y": 1740
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 1,
      "receiverIdentifier": 0
    }
  ],
  "diagramNotes": []
}
```
