- Call Unstructured to get the RSA public key associated with your Unstructured user account.
- Verify the public key’s authenticity.
- Use this key to encrypt your plaintext secret locally.
- Register the encrypted version of the secret with your Unstructured account. Unstructured returns a unique ID for the registered secret, along with the type of encryption that was used.
- Specify the registered secret’s ID and encryption type in the call to the Unstructured Workflow Endpoint as needed.
Requirements
You can use Python, or a REST API client such ascurl or Postman, to complete the following steps. You must have the following:
-
For Python, Python installed on your local development machine and the
unstructured-clientpackage installed into your local Python virtual environment. -
For REST, a REST API client such as
curlor Postman installed on your local development machine. -
An Unstructured account, including a valid Unstructured API key for that account. To get your API key, do the following:
-
If you do not already have an Unstructured account, sign up for free.
After you sign up, you are automatically signed in to your new Unstructured Let’s Go account, at https://platform.unstructured.io.
To sign up for a Business account instead, contact Unstructured Sales, or learn more.
-
If you have an Unstructured Let’s Go, Pay-As-You-Go, or Business SaaS account and are not already signed in, sign in to your account at https://platform.unstructured.io.
For other types of Business accounts, see your Unstructured account administrator for sign-in instructions, or email Unstructured Support at support@unstructured.io.
-
Get your Unstructured API key:
a. After you sign in to your Unstructured Let’s Go, Pay-As-You-Go, or Business account, click API Keys on the sidebar.
b. Click Generate API Key.For a Business account, before you click API Keys, make sure you have selected the organizational workspace you want to create an API key for. Each API key works with one and only one organizational workspace. Learn more.
c. Follow the on-screen instructions to finish generating the key.
d. Click the Copy icon next to your new key to add the key to your system’s clipboard. If you lose this key, simply return and click the Copy icon again.
-
If you do not already have an Unstructured account, sign up for free.
After you sign up, you are automatically signed in to your new Unstructured Let’s Go account, at https://platform.unstructured.io.
-
Some of the following steps also require you to specify the Unstructured Workflow Endpoint API URL for your Unstructured user account.
This URL was provided to you when your Unstructured account was created.
If you do not have this URL, contact Unstructured Sales at sales@unstructured.io.
The default URL for the Unstructured Worfklow Endpoint is
https://platform.unstructuredapp.io/api/v1. However, you should always use the URL that was provided to you when your Unstructured account was created. -
The following steps assume that you have the following two environment variables set locally:
UNSTRUCTURED_API_URL, set to the Workflow Endpoint API URL for your Unstructured user account.UNSTRUCTURED_API_KEY, set to the API key for your Unstructured user account.
Step 1: Get the RSA public key
In this step, you call the Unstructured Workflow Endpoint to get the the public key for your Unstructured user account. This public key is contained within a certificate. The certificate’s chain is also provided so that you can verify the public key’s authenticity in the next step.Python
Python
curl
curl
pem_key field from the output. Ignore the tenant_id and user_id fields.Step 2: Verify the public key’s authenticity
Step 3: Encrypt the secret
In this step, you use the PEM version of the public key for your Unstructured user account that you got from the previous step to encrypt the target plain-text secret. The result is a JSON-formatted object that contains keys namedencrypted_aes_key, aes_iv, encrypted_value, and type. All of the keys’ values except the one for type are
Base64-encoded.
This step can be completed only by using Python on your local development machine.
Python
Python
The following code requires you to install the You could call the preceding The output looks similar to the following:
cryptography package into your
Python virtual environment.The following envelope_encrypt function encrypts the target plain-text string by using envelope encryption. You must supply the function with the
PEM version of the public key for your Unstructured user account that you got from the previous step, and the plain-text version
of the secret that you want to encrypt.envelope_encrypt function with code similar to the following. This code gets
the plain-text contents of the specified service account key file for
a Google Cloud service account. The code then encrypts the plain-text contents
by using the PEM version of the public key file for the user in the Unstructured account.Step 4: Register the encrypted secret
In this step, you call the Unstructured Workflow Endpoint again, this time to register the encrypted secret that you got from the previous step. The result is a JSON-formatted object that contains keys namedid and type.
Python
Python
curl
curl
Step 5: Use the registered secret’s reference ID
In this step, you use the registered secret’s ID and encryption type to specify the secret when you call the Unstructured Workflow Endpoint. This step shows how to specify the registered secret’s ID and encryption type when you create a new Google Drive source connector.Python
Python
curl
curl

