As a preface to my question, let me state that I'm a relative newbie in the field of security.

I work for a back-office financial software provider that is responsible for processing, generating, and exchanging 1000's of files with 100's of 3rd parties each day. According to our most recent security audits, those files have to be encrypted whenever they aren't in use.

I can solve that problem pretty simply by using PGP encryption when we receive/build the file, and decrypting it when we need to read it/deliver it.

What I'm struggling with is how to do this in a secure fashion, given that the same environment needs to both encrypt and decrypt the files. I understand the paradox of what I'm trying to do...I'd like the same server to both encrypt and decrypt a file, but not allow a user that gets onto that server to do the same. I've contemplated the idea of having an administrator enter the decryption password upon the starting of the service, but that seems clunky.

Do I need a whole other route?


Here's the exact scenario that I'm wondering about...I realize it's counter-intuitive, but I'm hoping that the security community is brilliant enough to have solved this problem.

08:15 - Business Partner delivers a file of transactions for processing. 08:16 - File is decrypted using the keypair assigned to that business partner. 08:17 - As batch processing window has expired, file is encrypted until required later. 20:00 - Batch processing window is active, file is decrypted and transactions are processed.

We are wondering if there's a way to have an application handle all those (which we already have) and at the same time prevent Joe User from logging into the environment and decrypting the file at (e.g.) 14:03?

The reason it seems counter-intuitive to me is that if the application/server/environment has all the required information to both encrypt and decrypt, it would seem that any user that can get into the environment would also have access to that information. I'm hoping there's some fancy way of doing it that might avoid that case.

Make sense?

3 Answers 3


You are talking about security in layers, which is great.

The first issue is how to secure the data at rest and in transit, which you are doing with PGP. Your next issue is securing the system on which the data is stored.

It sounds like you are talking about the following issue: You are encrypting the information right before you transfer, but normally its sitting on the system unsecured.

The issue here is that while you are securing data in transit, its not secured on your system necessarily. To combat this, you make sure that your hard drive is encrypted and that you have good logical security and access controls - require strong/complex passwords, set appropriate file permissions, don't share passwords, don't share root or Administrator passwords, etc. You should not be allowing too many users onto the system, and furthermore should enforce role based access (e.g., only certain group or specific users can access where the file is stored).

You may also be concerned that since your private key is stored on the system, if the system is compromised then so is your private key. You can store the private key on a removable media to combat this or implement hardware encryption techniques.

If data is highly sensitive, it should only be decrypted when necessary and the private key should not be easily accessible.

Is there another issue you are concerned about that you can clarify?

Update I guess the real issue is why does Joe user have system privileges that allow him to access the secure part of the file system? If you are using this server for this automated process, it sounds like very few people, if any should have access to this server. If they do, their group permissions should not allow them to access the secure files when encrypted or not encrypted.

You have to think about security in layers. First, let's do full disk encryption in case the disk is physically stolen at a point when the file is unencrypted at the logical level. Next, lets ensure the file is only decrypted when it needs to be. The decryption keys are stored someplace secure that only root or predetermined users can have access. The files when unencrypted can only be accessed by root and the batch processing user-account using file system level permissions. The only issue you have is if Joe User is also root or Administrator. To address this issue, you need to implement some expensive software or build a home brew solution for password checkin and check out, also known as privileged identity management (PIM).

A PIM system is secured and stores shared secrets. It usually changes the passwords frequently on a time basis and everytime someone wants to log in or log out. For example, you want to log into a system: The PIM system uses scripts or other functionality to change the password on the remote system you want to access, then it gives you the password and prevents others from logging in while you have the password checked out. Once you are done or your session times out, the PIM system changes the password again so you can't get back in without making another log entry showing you checked out the password. These products are a bit pricey and might be overkill for your situation if you can properly restrict root access or limit root to physical console and use some physical security to prevent unauthorized access to the physical console.


We are wondering if there's a way to have an application handle all those (which we already have) and at the same time prevent Joe User from logging into the environment and decrypting the file at (e.g.) 14:03?

Mandatory Access Controls. Specifically, the environment of the application can be setup to read the key while being locked out even from root unless the system goes through a reboot cycle.

See these Fedora docs for a good example of this technique with SELinux as is commonly used for /etc/shadow.


The easy approach is to use full disk encryption (FDE). That way the data will be encrypted while it is stored on your hard drive. Choose a long and strong passphrase, and make sure you lock your computer (or turn it off) before leaving it unattended; that way, if someone steals it, they won't be able to access the data on the system without guessing your passphrase.

If you are looking for full disk encryption software, here are some recommendations. Truecrypt is well-respected. PGP also has a good product.

This will meet your compliance requirement to use encryption and let you tick off the checkbox for your audit. Whether it will provide adequate security for your needs is a different question, and you haven't provided enough information for me to form a strong opinion on that topic. (The way to figure out whether it will provide adequate security starts by asking what resources you have, what threats they might face, and what your business's mission requirements are; and carries on to assess the risks, identify possible controls and mitigations, and evaluate them based upon their costs and benefits.)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .