<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>gHacks technology news &#187; decryption</title>
	<atom:link href="http://www.ghacks.net/tag/decryption/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ghacks.net</link>
	<description>A technology blog covering software, mobile phones, gadgets, security, the Internet and other relevant areas.</description>
	<lastBuildDate>Tue, 24 Nov 2009 03:24:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Recursively encrypt directories with gpgdir</title>
		<link>http://www.ghacks.net/2009/06/03/recursively-encrypt-directories-with-gpgdir/</link>
		<comments>http://www.ghacks.net/2009/06/03/recursively-encrypt-directories-with-gpgdir/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 23:11:25 +0000</pubDate>
		<dc:creator>Jack Wallen</dc:creator>
				<category><![CDATA[Advice]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tutorials Basic]]></category>
		<category><![CDATA[decryption]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[GnuPG]]></category>
		<category><![CDATA[gpg]]></category>

		<guid isPermaLink="false">http://www.ghacks.net/2009/06/03/recursively-encrypt-directories-with-gpgdir/</guid>
		<description><![CDATA[Recently I wrote an article about Encrypting and decrypting files with GnuPG. This article described how to encrypt single files in with the help of gpg. But what happens if you have a directory full of files? Sure you can tar the directory up and encrypt the files  as a single file. But that isn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I wrote an article about <a title="File encryption with gpg" href="http://www.ghacks.net/2009/05/30/linux-tips-encrypting-and-decrypting-files-from-command-line-with-gpg/" target="_blank">Encrypting and decrypting files with GnuPG</a>. This article described how to encrypt single files in with the help of gpg. But what happens if you have a directory full of files? Sure you can tar the directory up and encrypt the files  as a single file. But that isn&#8217;t very practical when you don&#8217;t want to have to tar and untar a directory all the time. And what if you only want to encrypt certain files within a directory? That is when you need the help of another application.</p>
<p>The application you need is <a title="gpgdir" href="http://www.cipherdyne.org/gpgdir/" target="_blank">gpgdir</a>. The gpgdir application allows you to recursively encrypt and decrypt directories on your Linux system. It&#8217;s an easy to use command line tool that can save you a lot of time when you have to do a lot of encryption of files. In this article you will see how to install gpgdir and use it for basic directory encryption/decryption.</p>
<p><span id="more-13249"></span><strong>Getting and installing</strong></p>
<p>The only drawback is that gpgdir is not installed on your distribution by default, it doesn&#8217;t come with GnuPG, nor is it included in your repositories. You are going to have to install manually.</p>
<p>If you use an rpm-based distribution you can download the rpm from <a title="gpgdir download" href="http://www.cipherdyne.org/gpgdir/download/" target="_blank">gpgdir&#8217;s download page</a>. Once you have that file downloaded you will issue the command:</p>
<p><em>rpm -ivh gpgdir-XXX.rpm</em></p>
<p>Where XXX is the release number.</p>
<p>If you are not using an rpm-based distribution you will have to install from source. This is actually quite easy. First download the <a title="gpgdir source file" href="http://www.cipherdyne.org/gpgdir/download/gpgdir-1.9.4.tar.bz2" target="_blank">source file</a>. Once you have that file on your hard drive (let&#8217;s say it&#8217;s in <strong>~/Downloads/firefox/</strong>) issue the following comands:</p>
<p><em>cd ~/Downloads/firefox</em></p>
<p><em>bunzip2 gpgdir-XXX.tar.bz2</em></p>
<p><em>tar -xvf gpgdir-XXX.tar</em></p>
<p><em>cd gpgdir-XXX</em></p>
<p><em>./install.pl</em> (or <em>sudo ./install.pl</em>)</p>
<p>Where XXX is the release number.</p>
<p>You should now have a working installation of gpgdir.</p>
<p><strong>Using gpgdir</strong></p>
<p>Before you actually run gpgdir you have to have a gpg key generated (The article mentioned at the beginning will describe to you how this is done.) With your gpg key in mind you have to edit a single line in a file before you begin using gpgdir. The file is <em>~/.gpgdirrc. </em>What you need to do is add your gpg key user name in this file. The line you need to add looks like:</p>
<p>use_key USERNAME</p>
<p>Where USERNAME is your gpg key username (not your Linux system username &#8211; although they could be the same). If you&#8217;re not sure what your gpg key user name is issue the command:</p>
<p><em>gpg &#8211;list-keys</em></p>
<p>to see the user names of your keys.</p>
<p>Once you have your configuration file edited you are ready to go.</p>
<p>The basic usage of gpgdir is:</p>
<p>gpgdir -e|-d DIRECTORY OPTIONS</p>
<p>Let&#8217;s create a test directory containing two files. So issue the following commands to create your test environment:</p>
<p><em>mkdir TEST</em></p>
<p><em>echo $USER &gt; TEST/user</em></p>
<p><em>data &gt; TEST/data</em></p>
<p>Now you are ready to see how this works. Let&#8217;s encrypt the files in our TEST directory.</p>
<p><em>gpgdir -e TEST</em></p>
<p>You will be prompted to enter the key&#8217;s passphrase. Once you do this you will see something like:</p>
<p><code>[+] Encrypting files in directory: /home/jlwallen/TEST<br />
[+] Building file list...<br />
[+] Encrypting:  /home/jlwallen/TEST/user<br />
[+] Encrypting:  /home/jlwallen/TEST/date<br />
[+] Total number of files encrypted: 2</code></p>
<p>If you look in the TEST directory you will now see the following:</p>
<p>date.gpg</p>
<p>user.gpg</p>
<p>To unencrypt these files issue the following command:</p>
<p>gpgdir -d TEST</p>
<p>You will be prompted for the password again. After gpgdir decrypts the files they will no longer be encrypted.</p>
<p><strong>Excluding files</strong></p>
<p>Say you want to encrypt all files in the TEST directory but the <strong>user</strong> file. To do this you would issue the command:</p>
<p><em>gpgdir -e TEST &#8211;Exclude user</em></p>
<p>All files in TEST, except <em>user</em>, will now be encrypted.</p>
<p><strong>Final thoughts</strong></p>
<p>Although you can do more with gpgdir, you now have the fundamental usage of the command.</p>

	Tags: <a href="http://www.ghacks.net/tag/decryption/" title="decryption" rel="tag">decryption</a>, <a href="http://www.ghacks.net/tag/encryption/" title="encryption" rel="tag">encryption</a>, <a href="http://www.ghacks.net/tag/gnupg/" title="GnuPG" rel="tag">GnuPG</a>, <a href="http://www.ghacks.net/tag/gpg/" title="gpg" rel="tag">gpg</a>, <a href="http://www.ghacks.net/tag/linux/" title="Linux" rel="tag">Linux</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.ghacks.net/2008/10/15/secure-your-files-an-introduction-to-gnupg/" title="Secure your files: An introduction to GnuPG (October 15, 2008)">Secure your files: An introduction to GnuPG</a> (4)</li>
	<li><a href="http://www.ghacks.net/2009/05/30/linux-tips-encrypting-and-decrypting-files-from-command-line-with-gpg/" title="Linux tips: Encrypting and decrypting files from command line with gpg (May 30, 2009)">Linux tips: Encrypting and decrypting files from command line with gpg</a> (3)</li>
	<li><a href="http://www.ghacks.net/2009/03/01/encrypt-thunderbird-email-with-enigmail/" title="Encrypt Thunderbird Email with Enigmail (March 1, 2009)">Encrypt Thunderbird Email with Enigmail</a> (7)</li>
	<li><a href="http://www.ghacks.net/2008/02/07/yoggie-pico-personal-mobile-security-computer/" title="Yoggie PICO Personal Mobile Security Computer (February 7, 2008)">Yoggie PICO Personal Mobile Security Computer</a> (3)</li>
	<li><a href="http://www.ghacks.net/2009/10/30/with-ubuntu-9-10-arrives-wubi-9-10/" title="With Ubuntu 9.10 Arrives Wubi 9.10 (October 30, 2009)">With Ubuntu 9.10 Arrives Wubi 9.10</a> (2)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.ghacks.net/2009/06/03/recursively-encrypt-directories-with-gpgdir/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Linux tips: Encrypting and decrypting files from command line with gpg</title>
		<link>http://www.ghacks.net/2009/05/30/linux-tips-encrypting-and-decrypting-files-from-command-line-with-gpg/</link>
		<comments>http://www.ghacks.net/2009/05/30/linux-tips-encrypting-and-decrypting-files-from-command-line-with-gpg/#comments</comments>
		<pubDate>Sat, 30 May 2009 18:30:59 +0000</pubDate>
		<dc:creator>Jack Wallen</dc:creator>
				<category><![CDATA[Advice]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tutorials Basic]]></category>
		<category><![CDATA[decryption]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[linux. gnupg]]></category>

		<guid isPermaLink="false">http://www.ghacks.net/?p=13186</guid>
		<description><![CDATA[Are you paranoid? Are you afraid that someone is going to get ahold of data they sholdn&#8217;t have? I am. And because of that I often encrypt files with a gpg key that was given to no one. With those encrypted files I know they are secure to most of the general public. And because [...]]]></description>
			<content:encoded><![CDATA[<p>Are you paranoid? Are you afraid that someone is going to get ahold of data they sholdn&#8217;t have? I am. And because of that I often encrypt files with a gpg key that was given to no one. With those encrypted files I know they are secure to most of the general public. And because I tend to use lengthy passkeys for gpg, cracking them is a challenge.</p>
<p>Naturally I use gpg for all of this. And when I am using gpg I am using it from the command line. It&#8217;s actually quite easy to use. In this article I will show you how to create a gpg key, encrypt, and decrypt a file. You will find this such an easy task you&#8217;ll be using it more than you think.<span id="more-13186"></span><strong>Must I install?</strong></p>
<p>More than likely, if you have a modern Linux distribution, gpg is already installed. If you issue the command <em>which gpg </em>and you get something like <strong><em>/usr/bin/gpg</em></strong><em> </em>returned, you know you have gpg installed. If you don&#8217;t see that you can install it by issuing one of these commands:</p>
<p><em>sudo apt-get install gnupg</em></p>
<p>or</p>
<p><em>yum install gnupg</em></p>
<p>Once installed you will first have to generate a key. This, too, is done from the command line.</p>
<p><strong>Generate your key</strong></p>
<p>To generate a key issue the command:</p>
<p><em>gpg &#8211;gen-key</em></p>
<p>Once you enter that you will be asked a number of questions pertaining to your key. These should all be fairly obvious. After you complete the generation of your key make sure you remember the username for the key as well as the passphrase.</p>
<p><strong>Encrypting files</strong></p>
<p>Now let&#8217;s get into the good stuff &#8211; encrypting files. To encrypt a file with gpg you will use the command structure:</p>
<p><em>gpg OPTIONS FILE</em></p>
<p>Because you are encrypting you will have to use the <em>e </em>option. And because you will want to encrypt the file with a specific users&#8217; gpg key you will use the <em>r option. </em>So let&#8217;s say you are going to encrypt the file TEST.tgz with the gpg key of user jlwallen. To do this you would issue the command:</p>
<p><em>gpg -e -r jlwallen TEST.tgz</em></p>
<p>The resulting file would be TEST.tgz.gpg. If you tried to view the file you would instantly see it is now a binary file. If you try to untar the file you would be informed the file is not in gzip format.</p>
<p><strong>Decrypting the file</strong></p>
<p>Decrypting the file is just as easy as encrypting the file. We&#8217;ll stick with the same example. To decrypt the file TEST.tgz.gpg issue the command:</p>
<p><em>gpg -d -o TEST.tgz TEST.tgz.gpg</em></p>
<p>You will be prompted for the passphrase associated with the user encryption key used on the file. The <em>d </em>option indicates you are decrypting the file and the <em>o</em> option indicates what file to output the results to. After this command is issued you will be back to the TEST.tgz file.</p>
<p><strong>Final thoughts</strong></p>
<p>Sure there are plenty of gui tools that will make this job even easier. But there are too many instances when needing the command line will enable you to do things you can&#8217;t do with a gui.</p>

	Tags: <a href="http://www.ghacks.net/tag/decryption/" title="decryption" rel="tag">decryption</a>, <a href="http://www.ghacks.net/tag/encryption/" title="encryption" rel="tag">encryption</a>, <a href="http://www.ghacks.net/tag/linux-gnupg/" title="linux. gnupg" rel="tag">linux. gnupg</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.ghacks.net/2009/06/03/recursively-encrypt-directories-with-gpgdir/" title="Recursively encrypt directories with gpgdir (June 3, 2009)">Recursively encrypt directories with gpgdir</a> (3)</li>
	<li><a href="http://www.ghacks.net/2008/07/07/true-crypt-6-released/" title="True Crypt 6 released (July 7, 2008)">True Crypt 6 released</a> (3)</li>
	<li><a href="http://www.ghacks.net/2008/02/07/true-crypt-5-adds-system-partition-encryption/" title="True Crypt 5 adds System Partition Encryption (February 7, 2008)">True Crypt 5 adds System Partition Encryption</a> (1)</li>
	<li><a href="http://www.ghacks.net/2008/07/20/software-to-defeat-disk-encryption-released/" title="Software to defeat Disk Encryption released (July 20, 2008)">Software to defeat Disk Encryption released</a> (3)</li>
	<li><a href="http://www.ghacks.net/2005/12/11/securing-your-pc-with-true-crypt/" title="Securing your Pc with True Crypt (December 11, 2005)">Securing your Pc with True Crypt</a> (29)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.ghacks.net/2009/05/30/linux-tips-encrypting-and-decrypting-files-from-command-line-with-gpg/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
