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

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

# RSA_ENCRYPT

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

Encrypts data using a public or private key. A padding choosing from "PKCS1_PADDING", "PKCS1_OAEP_PADDING" and "SSLV23_PADDING" can be passed in with "PKCS1_PADDING" being the default.

**Categories:** Encryption

## Syntax

```
RSA_ENCRYPT(plain_message, key, [padding: "PKCS1_PADDING"])
```

## Examples

### Example 1

Formula:

```
RSA_ENCRYPT(plain_message, key)
```

Output:

```json
"Encrypted data"
```

### Example 2

Formula:

```
RSA_ENCRYPT(plain_message, key, padding: "PKCS1_PADDING")
```

Output:

```json
"Encrypted data"
```

## Sample actions

```json
{
  "standardLibVersion": "20",
  "actionRuntimeVersion": "4",
  "agents": [
    {
      "disabled": false,
      "name": "pems",
      "description": null,
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "message": "=GENERATE_RSA_KEYS()"
        }
      },
      "position": {
        "x": 855,
        "y": -675
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null,
      "cardIconName": null,
      "createdFromTemplateGuid": null,
      "createdFromTemplateVersion": null
    },
    {
      "disabled": false,
      "name": "encrypt message",
      "description": null,
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "message": "<<RSA_ENCRYPT(\"my message\",pems.message[1]) |> BASE64_ENCODE(%)>>"
        }
      },
      "position": {
        "x": 855,
        "y": -555
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null,
      "cardIconName": null,
      "createdFromTemplateGuid": null,
      "createdFromTemplateVersion": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```
