1

I have a project where I am encrypting a stream like so:

some_command | gpg --keyring tempkeyring.gpg --recipient "person" --output filename.gpg --encrypt

So while the stream is taking place and the encryption has already started, will it hurt the process to delete the currently-used keyring? The keyring is temporary and gets created anew every time the script runs. I'm GUESSING the kernel will still allow the system to access the file and once gpg is finished with it, it will free up the space. Will gpg flip out or will it finish the encryption just fine?

The operating system(s) are Linux RHEL and CentOS kernels 2.6+ if that makes a difference.

1 Answer 1

0

I investigated, and while this answers it for Linux kernels, it's by no way inclusive of other operating systems or filesystems.

gpg does not care. I suspect it treats this like any other deletion within the system. In *nix environments, when you delete a file, you are really 'unlinking' that file. When you remove all links to a file, the system THEN deletes the file and frees up the space. What Linux (and Unix, I'm sure...) kernels do is unlink the file, then check to see if any programs are using those files and if they are, they wait until the program using it closes, then frees up the space by truly deleting the file. Since the file was already unlinked, nobody else is able to access that file, but the currently open application will have no problems so long as it doesn't try to access the file by name and just uses the currently open handle.

You must log in to answer this question.

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