Link Search Menu Expand Document

User Controlled Data Encryption and Decryption

PDF.co platform provides built-in user controlled data encryption that you can use for input and output files.

User-controlled encryption and decryption can be applied in almost any API endpoint that reads input files and/or writes output files. Just use profiles parameter to pass user-controlled encryption and/or decryption options like encryption algorithm, password, initialization vector (aka 2nd password).

For the detailed information on options and encryption algorithms available, please check this knowledgebase article.

Popular Use Cases:

  • Automatically encrypt output files with strong AES encryption and copy these files into cloud storage like Google Drive or Dropbox. With user controlled encrypted data inside, cloud storage services can not even scan the content of your files.
  • Automatically read encrypted documents provided and previously encrypted by by 3rd party services like SalesForce, Zapier, Integromat and others (including javascript, php, java, .net custom apps).
  • Add another layer of security by using user-controlled data encryption for processing documents. With user-controlled encryption even temporary files requires further decryption to be readable. This way even if a temporary link to a file is leaked, it is not possible to read this file without applying decryption with your custom provided password.

Available Methods

[POST] Read Custom Encrypted PDF

This sample request demonstrates how to set profiles with built-in decryption options for AES encrypted document (doc/docx) to pdf endpoint.

For the details on available user-controlled encryption and decryption options please review this article.

  • Method: POST
  • URL: /v1/pdf/info

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/encryption/sample_encrypted_aes128.pdf",
    "async": false,
    "profiles": "{ 'DataDecryptionAlgorithm': 'AES128', 'DataDecryptionKey': 'HelloThisKey1234', 'DataDecryptionIV': 'TreloThisKey1234' }"
}

Example responses

Read Custom Encrypted PDF
{
    "info": {
        "PageCount": 1,
        "Author": "Hiren Patel",
        "Title": "",
        "Producer": "Microsoft® Word 2016",
        "Subject": "",
        "CreationDate": "2021-01-10T10:10:54+05:30",
        "Bookmarks": "",
        "Keywords": "",
        "Creator": "Microsoft® Word 2016",
        "Encrypted": false,
        "PasswordProtected": false,
        "PageRectangle": {
            "Location": {
                "IsEmpty": true,
                "X": 0,
                "Y": 0
            },
            "Size": "612, 792",
            "X": 0,
            "Y": 0,
            "Width": 612,
            "Height": 792,
            "Left": 0,
            "Top": 0,
            "Right": 612,
            "Bottom": 792,
            "IsEmpty": false
        },
        "ModificationDate": "2021-01-10T10:10:54+05:30",
        "AttachmentCount": 0,
        "EncryptionAlgorithm": "None",
        "PermissionPrinting": true,
        "PermissionModifyDocument": true,
        "PermissionContentExtraction": true,
        "PermissionModifyAnnotations": true,
        "PermissionFillForms": true,
        "PermissionAccessibility": true,
        "PermissionAssemble": true,
        "PermissionHighQualityPrint": true,
        "CustomProperties": []
    },
    "error": false,
    "status": 200,
    "credits": 7,
    "duration": 446,
    "remainingCredits": 98320547
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/info' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/encryption/sample_encrypted_aes128.pdf",
    "async": false,
    "profiles": "{ '\''DataDecryptionAlgorithm'\'': '\''AES128'\'', '\''DataDecryptionKey'\'': '\''HelloThisKey1234'\'', '\''DataDecryptionIV'\'': '\''TreloThisKey1234'\'' }"
}'

[POST] Custom encrypted Docx to PDF

This sample request demonstrates how to set profiles with built-in decryption options for AES encrypted document (doc/docx) to pdf endpoint.

For the details on available user-controlled encryption and decryption options please review this article.

  • Method: POST
  • URL: /v1/pdf/convert/from/doc

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/encryption/sample_encrypted_aes128.docx",
    "name": "result.pdf",
    "async": false,
    "profiles": "{ 'DataDecryptionAlgorithm': 'AES128', 'DataDecryptionKey': 'HelloThisKey1234', 'DataDecryptionIV': 'TreloThisKey1234' }"
}

Example responses

Custom encrypted Docx to PDF
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/GB6XMWN2VGDTUMKBQBRI24EWYSFRLLLL/result.pdf",
    "pageCount": 1,
    "error": false,
    "status": 200,
    "name": "result.pdf",
    "credits": 21,
    "duration": 2903,
    "remainingCredits": 98320505
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/convert/from/doc' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/encryption/sample_encrypted_aes128.docx",
    "name": "result.pdf",
    "async": false,
    "profiles": "{ '\''DataDecryptionAlgorithm'\'': '\''AES128'\'', '\''DataDecryptionKey'\'': '\''HelloThisKey1234'\'', '\''DataDecryptionIV'\'': '\''TreloThisKey1234'\'' }"
}'

[POST] Read QR Code From Encrypted PNG

This sample request demonstrates how to set profiles with built-in decryption options for QR Code decoding from AES encrypted PNG image file.

For the details on available user-controlled encryption and decryption options please review this article.

  • Method: POST
  • URL: /v1/barcode/read/from/url

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/encryption/barcode_encrypted_aes128.png",
	"types": "QRCode",
	"inline": true,
    "async": false,
	"profiles": "{ 'DataDecryptionAlgorithm': 'AES128', 'DataDecryptionKey': 'Qweasd1234567890', 'DataDecryptionIV': '0mDI&qLv*ivTCd$*' }"
}

Example responses

Read QR Code From Encrypted PNG
{
    "barcodes": [
        {
            "Value": "]Q3\\01695046551543111713033110TEST5632",
            "RawData": "",
            "Type": 14,
            "Rect": "11, 11, 75, 75",
            "Page": 0,
            "File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/encryption/barcode_encrypted_aes128.png",
            "Confidence": 1,
            "Metadata": "",
            "TypeName": "QRCode"
        }
    ],
    "pageCount": 1,
    "error": false,
    "status": 200,
    "credits": 35,
    "duration": 375,
    "remainingCredits": 98320470
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/barcode/read/from/url' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/encryption/barcode_encrypted_aes128.png",
	"types": "QRCode",
	"inline": true,
    "async": false,
	"profiles": "{ '\''DataDecryptionAlgorithm'\'': '\''AES128'\'', '\''DataDecryptionKey'\'': '\''Qweasd1234567890'\'', '\''DataDecryptionIV'\'': '\''0mDI&qLv*ivTCd$*'\'' }"
}'

[POST] PDF Encrypted by SalesForce with AES128 To JPG

This sample request demonstrates how to set profiles with built-in decryption options for PDF to JPG conversion PDF file that was previously encrypted with AES 128 in SalesForce.

For the details on available user-controlled encryption and decryption options please review this article.

  • Method: POST
  • URL: /v1/pdf/convert/to/jpg

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/encryption/sample_encrypted_aes128.pdf",
    "name": "result.jpg",
    "inline" : true,
    "pages": "0",
    "async": false,
    "profiles": "{ 'DataDecryptionAlgorithm': 'AES128', 'DataDecryptionKey': 'HelloThisKey1234', 'DataDecryptionIV': 'TreloThisKey1234' }"
}

Example responses

PDF Encrypted by SalesForce with AES128 To JPG
{
    "urls": [
        "https://pdf-temp-files.s3.amazonaws.com/0C38ED7DQO0NB5UEJTAP35MEPPAPJXAT/result.jpg"
    ],
    "pageCount": 1,
    "error": false,
    "status": 200,
    "name": "result.jpg",
    "credits": 12,
    "duration": 408,
    "remainingCredits": 98320458
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/convert/to/jpg' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/encryption/sample_encrypted_aes128.pdf",
    "name": "result.jpg",
    "inline" : true,
    "pages": "0",
    "async": false,
    "profiles": "{ '\''DataDecryptionAlgorithm'\'': '\''AES128'\'', '\''DataDecryptionKey'\'': '\''HelloThisKey1234'\'', '\''DataDecryptionIV'\'': '\''TreloThisKey1234'\'' }"
}'

[POST] Merge PDFs encrypted by SalesForce to new PDF encrypted for SalesForce

This sample request demonstrates how to set profiles with built-in decryption options for merging multiple PDF files previously encrypted with AES 128 encryption in SalesForce. Also, it enables user-controlled encryption for output PDF file so output PDF is also user-encrypted and will require applying AES decryption before processing in SalesForce or another platforms.

For the details on available user-controlled encryption and decryption options please review this article.

  • Method: POST
  • URL: /v1/pdf/merge

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/encryption/sample_encrypted_aes128.pdf, https://pdfco-test-files.s3.us-west-2.amazonaws.com/encryption/sample_encrypted_aes128.pdf",
    "name": "result.pdf",
    "pages": "0",
    "async": false,
    "profiles": "{ 'DataDecryptionAlgorithm': 'AES128', 'DataDecryptionKey': 'HelloThisKey1234', 'DataDecryptionIV': 'TreloThisKey1234', 'DataEncryptionAlgorithm': 'AES128', 'DataEncryptionKey': 'HelloThisKey1234', 'DataEncryptionIV': 'TreloThisKey1234' }"
}

Example responses

Merge PDFs encrypted by SalesForce to new PDF encrypted for SalesForce
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/DH86OQ2JRK7CZ3WCVTICA84TLPUVJCCS/result.pdf",
    "pageCount": 2,
    "error": false,
    "status": 200,
    "name": "result.pdf",
    "credits": 4,
    "duration": 457,
    "remainingCredits": 98320454
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/merge' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/encryption/sample_encrypted_aes128.pdf, https://pdfco-test-files.s3.us-west-2.amazonaws.com/encryption/sample_encrypted_aes128.pdf",
    "name": "result.pdf",
    "pages": "0",
    "async": false,
    "profiles": "{ '\''DataDecryptionAlgorithm'\'': '\''AES128'\'', '\''DataDecryptionKey'\'': '\''HelloThisKey1234'\'', '\''DataDecryptionIV'\'': '\''TreloThisKey1234'\'', '\''DataEncryptionAlgorithm'\'': '\''AES128'\'', '\''DataEncryptionKey'\'': '\''HelloThisKey1234'\'', '\''DataEncryptionIV'\'': '\''TreloThisKey1234'\'' }"
}'