Crittora Logo
Getting StartedChangelogContact Support

Encrypt API

POST

https://managed.crittoraapis.com/v1/encrypt

This endpoint authenticates users through AWS Cognito and encrypts data using the Crittora Encryption API. It serves as a secure encryption proxy for your applications.

Purpose

The Encrypt API provides a secure way to encrypt sensitive data by authenticating users through AWS Cognito and leveraging the Crittora Encryption API. This endpoint acts as a secure proxy, ensuring your data is encrypted using industry-standard encryption methods.


API Details

Headers
HeaderTypeDescriptionRequired
usernamestringCognito username
Yes
passwordstringCognito password
Yes
api_keystringPartner-level API key from Crittora
Yes
access_keystringPartner access key from Crittora
Yes
secret_keystringPartner secret key from Crittora
Yes
Request Body
{
  "data": "string"
}
FieldTypeDescriptionRequired
datastringThe plaintext data to encrypt
Yes
Response

Returns the encrypted payload from Crittora in JSON format.

Example Response:
{
  "statusCode": 200,
  "body": {
    "encrypted_data": "ugHTJ-ziCZ-QmWh8ruNJ0ojgwY8iA7OmPVGZDzVlGmImv4A4xWJ6HLchv_dRFZEdl7CB8i_F8KlEgTumCAY86B4n5jltbB8NnSiIvlyZT8WkyIDVCJX6F7VT6R_Wt99PjTg7Q"
  }
}
Status Codes

HTTP status codes returned by the encrypt endpoint.

Success Codes
CodeNameDescriptionUsageExample

200

OK

Successfully encrypted data

Request completed successfully

Encryption operation completed

Error Codes
CodeNameDescriptionUsageExample

500

Internal Server Error

Username and/or Password Incorrect

Authentication credentials are invalid

Invalid AWS Cognito username or password

Code Examples
cURL Example:
curl -X POST https://managed.crittoraapis.com/v1/encrypt \
  -H "Content-Type: application/json" \
  -H "username: your_cognito_username" \
  -H "password: your_cognito_password" \
  -H "api_key: your_crittora_api_key" \
  -H "access_key: your_crittora_access_key" \
  -H "secret_key: your_crittora_secret_key" \
  -d '{
    "data": "sensitive information to encrypt"
  }'

JavaScript Example:
// Using fetch API
const encryptData = async (data) => {
  const response = await fetch('https://managed.crittoraapis.com/v1/encrypt', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'username': 'your_cognito_username',
      'password': 'your_cognito_password',
      'api_key': 'your_crittora_api_key',
      'access_key': 'your_crittora_access_key',
      'secret_key': 'your_crittora_secret_key'
    },
    body: JSON.stringify({ data })
  });
  
  return await response.json();
};

Python Example:
import requests

def encrypt_data(data):
    url = "https://managed.crittoraapis.com/v1/encrypt"
    headers = {
        "Content-Type": "application/json",
        "username": "your_cognito_username",
        "password": "your_cognito_password",
        "api_key": "your_crittora_api_key",
        "access_key": "your_crittora_access_key",
        "secret_key": "your_crittora_secret_key"
    }
    
    payload = {"data": data}
    response = requests.post(url, headers=headers, json=payload)
    return response.json()
Flow Summary
  1. API caller sends user credentials and API keys in headers, and plaintext data in the JSON body.
  2. Lambda authenticates user with AWS Cognito and gets a bearer token.
  3. Lambda calls Crittora's /encrypt endpoint with:
    • Authorization bearer token
    • Crittora partner API credentials
    • Requested action: ["e"] for encryption
  4. Response is returned with encrypted data and metadata.

Try it out: Use the interactive API interface below to test the encrypt endpoint with your own data.

Loading API specification...

Powered by AWS • Partner Technology • Patent Pending PQC Technology