Secure Cloud File Processing: Sanitize First, Encrypt Second
Blog Post

Secure Cloud File Processing: Sanitize First, Encrypt Second

Cloud Security
File Security
October 14th 2026
Share this Post

 Key takeaway: secure file processing warrants both a cleanup (file sanitization) and a lock (file encryption). MetaDefender™ Cloud’s Deep CDR™ technology handles the cleanup by deconstructing and rebuilding the file without its potentially malicious elements. With RSA encryption turned on in MetaDefender™ Cloud, the sanitized output is encrypted with a key that only your RSA private key can recover. 

Back when we used to send postcards, whatever was written on them could be read by anyone at the sorting office with a free moment. Privacy was not really “a thing” just yet. Today, files we send via cloud services travel much like those postcards did, open to every system that handles them.  

Once a file leaves the customer environment, it may be processed or stored on infrastructure outside their direct control. That makes confidentiality just as important as threat protection, especially when sensitive or regulated data is involved. 

Following the analogy, RSA encryption acts like the sealed envelope replacing free-for-all postcards. But the envelope only protects the letter; readers aren’t safe from whatever message they find inside. In the cloud, an encrypted file can hide malicious content just as easily.  

So, if RSA encryption is only protecting privacy, how can organizations protect sensitive files after they have been processed and sanitized in the cloud?  

A strong secure cloud file processing setup, one that really stands apart, can both encrypt sanitized files in the cloud and keep decryption in the customer's hands, so that not even the platform that cleans the file can open it. Here’s how it works. 

 

What Is RSA Encryption? Asymmetric Encryption Explained 

RSA encryption is a form of asymmetric encryption protecting information with two linked keys instead of one shared password.  

In RSA encryption, users get a public key that anyone can use to lock data, and a private key that only its owner holds, and that alone can unlock it. The keys are generated together from very large prime numbers, making it impractical to work out the private key from the public one, which is why the public key can be shared freely.  

You rely on this whenever your browser checks a website's TLS certificate, which is signed with RSA, or when you log in to a server or a code repository with an SSH key. RSA file encryption applies the pair to a file, while the RSA webhook verification applies it to messages. The webhook is an automatic sys-to-sys notification, sent when an event happens, such as a file finishing processing.  

Since anyone could send a fake RSA webhook to the receiving address, the sender signs each notification with its private key; the receiver checks the signature with the public key to ensure authenticity. 

 

Why Files Still Need Protection after Cloud Processing 

Secure cloud file processing needs two layers of protection: one that removes anything hostile and one that keeps the remainder confidential. Security, protection, and privacy policies should follow some common sense questions:  

Who holds the keys that protect that file? Who can still reach the file once processing ends? Is the file carrying something it shouldn’t?   

First of all, after a service scans or sanitizes a file, the file sits on infrastructure you do not run, and it stays there until you collect it. A contract or a patient record holds the same sensitive details it held before upload, but now more people and systems can reach it, including the provider's administrators and backups, plus anyone who breaches them. 

Uploads bring a second problem.  

Attackers favor them as a delivery route, and they hide malicious macros and embedded scripts inside ordinary-looking office documents and PDFs. Encryption cannot help here, because it locks a file without ever looking inside. An encrypted weaponized file stays weaponized; it only becomes private.  

 

RSA vs. Symmetric Encryption: Why RSA Doesn't Encrypt Large Files 

RSA looks like the obvious tool for confidentiality, but it isn't designed to encrypt large amounts of data. RSA isn’t built to handle large amounts of data. It can only encrypt a limited amount of data at a time, depending on the key size and padding being used. On top of that, RSA is relatively slow compared with algorithms designed specifically for encrypting data. 

So, what do we use instead? Symmetric encryption. With it, the same secret key (SKey) is used to encrypt and decrypt the data. These algorithms are designed to handle large amounts of data quickly, so encrypting a whole file is no problem. 

Modern systems use both; the hybrid (envelope) approach.  

 

Hybrid Encryption (Envelope Encryption) Explained 

With envelope encryption, the system locks the file with a one-time secret key. RSA then locks the small key with the owner's public key, and the locked key travels alongside the file. To open the file, the owner uses the private key to recover the secret key, then uses the secret key to unlock the file. 

Since only the private key can unlock the secret key, whoever holds it controls access to the file, which settles the question of key ownership. 

CDR and Encryption: Two Layers of File Protection  

We’ve established that hybrid (or envelope) encryption keeps a file private, solving the file size limit. However, the weaponized upload problem isn’t yet addressed. Because encryption never checks what the file contains.  

That job belongs to a second layer, and this is where the CDR (Content Disarm and Reconstruction) technology comes in. The process is built on assuming that every file is malicious. Which is why CDR isn’t necessarily about finding threats, as it is about removing the possibility of them existing. CDR takes the file apart, keeps the components that belong, and builds a fresh file from them. 

In platforms like MetaDefender™ Cloud, the CDR layer is delivered via the Deep CDR™ technology.  

Deep CDR in MetaDefender Cloud 

MetaDefender Cloud is OPSWAT's cloud file threat prevention platform for securing file uploads and shared content across cloud environments. It combines Deep CDR with multiple file protection layers like Metascan™ Multiscanning, Proactive DLP™, sandbox analysis, and AI-powered malware prediction.  

Deep CDR supports +200 file types, so it handles the formats that organizations exchange every day. Teams can connect it through a REST API or native integrations with cloud storage and SaaS applications, and the sanitizing happens at upload, before the file reaches its destination. Malicious macros and embedded scripts never reach the user, but employees still get a working file that looks and behaves like the original. Because Deep CDR does not need to recognize an attack to remove it, it also neutralizes zero-day and targeted attacks that no signature covers yet. 

That is secure cloud file processing at its first layer. The second layer is using MetaDefender Cloud to encrypt the sanitized files.   

An RSA key can also be used to add a verification header to webhooks; see the docs. 

 

 

 

How MetaDefender Cloud Encrypts Sanitized Files 

MetaDefender Cloud applies hybrid encryption around the Deep CDR sanitization process. The whole process takes six steps: 

  1. MetaDefender Cloud generates a symmetric key, called the SKey. 

  1. It encrypts the SKey with your RSA public key, creating the encrypted SKey (ESKey). 

  1. It sends the ESKey back to you in the scan response. 

  1. Once sanitization is complete, it uses the SKey to encrypt the sanitized file. 

  1. MetaDefender Cloud stores the sanitized output encrypted with a key that only your RSA private key can recover. 

 

From step four onward, not even MetaDefender Cloud can access the encrypted sanitized file; control is 100% in the user hands.  

 

You can find a more in-depth look at the MetaDefender Cloud encryption process on the docs page. 

 

Customer-Controlled vs. Provider-Managed Encryption; Why It Matters  

The RSA key used to decrypt the file can either be held by the customer (the final recipient of the message) or the platform which generates the RSA key. So who should hold it: you, as its owner, or the platform? 

In a provider-managed model, the service encrypts your files but can technically decrypt them too. Since your confidentiality depends on the provider's key database staying intact, a breach, or a legal demand will reach your files as well. 

In customer-controlled encryption, the keys that unlock your files stay with you; the platform will only find cipher text, should they want to decrypt it. This approach is particularly important in industries where confidentiality is a must, like healthcare or finance.  

Therefore, customer-controlled encryption is more private (and thus more secure), but it also comes with a trade-off in responsibility. Since no copy of the key exists on the platform, nobody can recover it on your behalf. 

 

 

Provider-managed keys 

Customer-controlled encryption with MetaDefender Cloud 

Control 

The provider holds the keys, so the provider's systems and policies determine who can decrypt a file and when. 

Only the holder of your RSA private key can recover the key and decrypt the sanitized file. Following AES-256-GCM, encryption needs the ESKey from the scan response plus the IV and tag from the result.  

Privacy 

Confidentiality depends on the provider's internal access controls and the security of its key store. 

MetaDefender Cloud stores the sanitized output encrypted with a key that only your RSA private key can recover. 

Ownership 

Your access to your own files runs through the provider's service and its key infrastructure. 

The private key stays in your environment. You decide where it is stored and who can use it. 

If the provider is breached or compelled 

The keys and the files can be exposed together. 

The provider holds no key to the encrypted sanitized file. 

 

 Before You Choose a Platform, Ask Who Holds the Key 

 Healthcare providers, banks, insurers, law firms, and government agencies move confidential files via the cloud every day, and many of those files arrive from outside the organization. For these teams, secure cloud file processing has to cover more than threat detection, or access controls. Who can access the resulting file? How is the file locked? Who controls decryption?  

A sanitized patient record or client contract that the provider can read stays exposed to anyone who breaches or compels that provider. That is why customer-controlled encryption belongs on the requirements list beside Deep CDR. 

MetaDefender Cloud covers both sides.  

Deep CDR rebuilds each file without its hostile components, and with RSA encryption enabled, you encrypt sanitized files in the cloud and hold the only key that opens them. Once the SKey is deleted, not even OPSWAT can access the encrypted sanitized file. When you evaluate any platform, apply the same standard: it should sanitize the file, and the customer should hold the keys. To see how this fits your file workflows, book a MetaDefender Cloud demo. 

 

Learn More

 

Frequently Asked Questions 

What is RSA encryption? 
RSA encryption is a form of asymmetric (public key) encryption that uses two linked keys instead of one shared password. Anyone can use the public key to lock data, and only the owner's private key can unlock it. The keys are mathematically linked, but holding one does not let you generate the other. 
Why is RSA alone not used for large-file encryption? 
RSA is slow and resource heavy. Each operation runs orders of magnitude slower than symmetric algorithms such as AES and demands far more processing power, which adds quickly across large files or high volumes. RSA also caps how much data it can encrypt in one operation, based on its key size. 
How does hybrid encryption protect files? 
Hybrid encryption, also called envelope encryption, splits the work between two kinds of keys. A symmetric key encrypts the file quickly at any size, and RSA encrypts only that key with the owner's public key. To open the file, the owner uses the private key to recover the symmetric key, then uses it to decrypt the file. Whoever holds the private key controls access to the file. 
Why is Deep CDR used with RSA encryption? 
Encryption never checks what a file contains, so an encrypted weaponized file is still weaponized. Deep CDR assumes every file is malicious, takes it apart, and rebuilds a fresh file without the hostile components. RSA-based encryption then keeps that sanitized output confidential, which is why the two work as layers: sanitize first, then encrypt. 
How does MetaDefender Cloud protect encrypted sanitized output? 
When you send a file for sanitization, MetaDefender Cloud generates a symmetric key (SKey) and encrypts it with your RSA public key. The sanitized output is stored but encrypted with a key that only your RSA private key can recover. 
Why should organizations opt for customer-controlled decryption? 
In a provider-managed model, the service holds the keys and can technically decrypt your files, so a breach or legal demand on the provider can reach you too. With customer-controlled decryption, the keys that unlock your files stay with you, and the platform holds only ciphertext. The trade-off is responsibility: because no copy of the key exists on the platform, nobody can recover it on your behalf. 
Can MetaDefender Cloud access my processed files? 
The sanitized output is stored encrypted under your key, The original upload and scan metadata are processed and retained under your account's retention settings. 
Cloud Security
File Security