<?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>LinuxByte &#187; 加密</title>
	<atom:link href="http://www.linuxbyte.org/tag/%e5%8a%a0%e5%af%86/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxbyte.org</link>
	<description>一个Linux Blog</description>
	<lastBuildDate>Tue, 22 Jun 2010 15:10:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>FireGPG-非常好用的GPG工具</title>
		<link>http://www.linuxbyte.org/firegpg-fei-chang-hao-yong-de-gpg-gong-ju.html</link>
		<comments>http://www.linuxbyte.org/firegpg-fei-chang-hao-yong-de-gpg-gong-ju.html#comments</comments>
		<pubDate>Sun, 28 Feb 2010 07:50:15 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[日常桌面]]></category>
		<category><![CDATA[firegpg]]></category>
		<category><![CDATA[GnuPG]]></category>
		<category><![CDATA[加密]]></category>
		<category><![CDATA[数字签名]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=505</guid>
		<description><![CDATA[FireGPG是一个Firefox 的插件，它可以用gpg对网页，邮件，文件进行加密/解密，签名/验证，另外还提供密钥管理功能。
相对其他工具它在对付网页内容时更方便，用鼠标右键就能完成。


并且它... ]]></description>
			<content:encoded><![CDATA[<p>FireGPG是一个Firefox 的插件，它可以用gpg对网页，邮件，文件进行加密/解密，签名/验证，另外还提供密钥管理功能。<br />
相对其他工具它在对付网页内容时更方便，用鼠标右键就能完成。<br />
<span id="more-505"></span><br />
<a href="http://www.linuxbyte.org/uploads/2010/02/firegpg.jpg" rel="lightbox[505]"><img src="http://www.linuxbyte.org/uploads/2010/02/firegpg-121x240.jpg" alt="firegpg" title="firegpg" width="121" height="240" class="alignnone size-medium wp-image-506" /></a><br />
并且它能自动识别需要验证或解密的内容<br />
<a href="http://www.linuxbyte.org/uploads/2010/02/firegpg-2.jpg" rel="lightbox[505]"><img src="http://www.linuxbyte.org/uploads/2010/02/firegpg-2-320x51.jpg" alt="firegpg-2" title="firegpg-2" width="320" height="51" class="alignnone size-medium wp-image-507" /></a></p>
<p>我对本文也做了签名，如果你也装了FireGPG 那么它就会自动识别，并提醒你是否验证。btw：FireGPG 在找不到公钥时能自己链接服务器去下载公钥。</p>
<pre>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

这是有hew 发布的FireGPG-非常好用的GPG工具
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Use GnuPG with Firefox : http://getfiregpg.org (Version: 0.7.7)

iEYEARECAAYFAkuKMb8ACgkQAI2lb99dJYLgKACdFcN4uTIjiOmexCHnglBLo94y
KwMAoInre+1pNZkrvW2nRTLUoO9oeYT+
=AWAw
-----END PGP SIGNATURE-----
</pre>
<h3  class="related_post_title">与本文关系暧昧的文字</h3><ul class="related_post"><li><a href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html" title="我的GnuPG 使用笔记">我的GnuPG 使用笔记</a></li><li><a href="http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html" title="Linux 下的文件加密">Linux 下的文件加密</a></li><li><a href="http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html" title="用Cryptkeeper和EncFS 完成目录加密">用Cryptkeeper和EncFS 完成目录加密</a></li><li><a href="http://www.linuxbyte.org/yong-shc-jiami-shell.html" title="用shc 加密shell">用shc 加密shell</a></li><li><a href="http://www.linuxbyte.org/cryptsetup-luks-jiami.html" title="用Cryptsetup LUKS 加密目录">用Cryptsetup LUKS 加密目录</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2010<br />
Source: <a href="http://www.linuxbyte.org/firegpg-fei-chang-hao-yong-de-gpg-gong-ju.html">FireGPG-非常好用的GPG工具</a><br />
<a href="http://www.linuxbyte.org/firegpg-fei-chang-hao-yong-de-gpg-gong-ju.html#comments">2 comments</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/firegpg" rel="tag">firegpg</a>, <a href="http://www.linuxbyte.org/tag/gnupg" rel="tag">GnuPG</a>, <a href="http://www.linuxbyte.org/tag/%e5%8a%a0%e5%af%86" rel="tag">加密</a>, <a href="http://www.linuxbyte.org/tag/%e6%95%b0%e5%ad%97%e7%ad%be%e5%90%8d" rel="tag">数字签名</a><br/>
</small></p>
	标签：<a href="http://www.linuxbyte.org/tag/firegpg" title="firegpg" rel="tag">firegpg</a>, <a href="http://www.linuxbyte.org/tag/gnupg" title="GnuPG" rel="tag">GnuPG</a>, <a href="http://www.linuxbyte.org/tag/%e5%8a%a0%e5%af%86" title="加密" rel="tag">加密</a>, <a href="http://www.linuxbyte.org/tag/%e6%95%b0%e5%ad%97%e7%ad%be%e5%90%8d" title="数字签名" rel="tag">数字签名</a><br />

	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html" title="我的GnuPG 使用笔记 (2009-06-05)">我的GnuPG 使用笔记</a> (1)</li>
	<li><a href="http://www.linuxbyte.org/yong-shc-jiami-shell.html" title="用shc 加密shell (2009-04-09)">用shc 加密shell</a> (0)</li>
	<li><a href="http://www.linuxbyte.org/cryptsetup-luks-jiami.html" title="用Cryptsetup LUKS 加密目录 (2009-03-06)">用Cryptsetup LUKS 加密目录</a> (1)</li>
	<li><a href="http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html" title="用Cryptkeeper和EncFS 完成目录加密 (2009-04-27)">用Cryptkeeper和EncFS 完成目录加密</a> (0)</li>
	<li><a href="http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html" title="Linux 下的文件加密 (2009-06-26)">Linux 下的文件加密</a> (2)</li>
</ul>


<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/firegpg-fei-chang-hao-yong-de-gpg-gong-ju.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Linux 下的文件加密</title>
		<link>http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html</link>
		<comments>http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html#comments</comments>
		<pubDate>Fri, 26 Jun 2009 05:59:01 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[系统管理]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[加密]]></category>
		<category><![CDATA[文件加密]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=444</guid>
		<description><![CDATA[以前我在blog 写过两篇关于linux 下目录加密的文章用Cryptkeeper和EncFS 完成目录加密和用Cryptsetup LUKS 加密目录，今天我想说说文件加密，先说简单的用VIM 加密文本文件：
vim 加密使用 -x 参数，即

... ]]></description>
			<content:encoded><![CDATA[<p>以前我在blog 写过两篇关于linux 下目录加密的文章<a title="Permanent Link to 用Cryptkeeper和EncFS 完成目录加密" rel="bookmark" href="http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html">用Cryptkeeper和EncFS 完成目录加密</a>和<a title="Permanent Link to 用Cryptsetup LUKS 加密目录" rel="bookmark" href="http://www.linuxbyte.org/cryptsetup-luks-jiami.html">用Cryptsetup LUKS 加密目录</a>，今天我想说说文件加密，先说简单的<strong>用VIM 加密文本文件</strong>：</p>
<p>vim 加密使用 -x 参数，即</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #660033;">-x</span> myfile</pre></div></div>

<p>然后会提示让你输入两次密码，这样就算给你的文件加上密码了，下次要看文件用VIM 打开会要求输入密码，输入错误密码则会得到一堆乱码，用其他编辑器打开也是一堆乱码。要清除密码只要在正确打开文件后用 &#8220;:X&#8221; 指令，然后给一个空密码就行。<br />
当然vim 加密还是有很多局限的，算法弱并且中间会有交换文件，交换文件是不加密的，虽然有&#8221;-n&#8221; 参数可以不使用交换文件但不用交换文件让我不得不时刻记得要存盘。</p>
<p>vim加密的算法很弱所以要更好的保护你的文件你需要专业的加密工具，如openssl，gpg。<span id="more-444"></span><br />
<strong>对称加密：</strong></p>
<p>a.用openssl 加密文件:</p>
<p>加密</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl enc <span style="color: #660033;">-aes-<span style="color: #000000;">128</span>-ecb</span> <span style="color: #660033;">-e</span> <span style="color: #660033;">-in</span> myfile-out myfile-aes</pre></div></div>

<p>解密</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl enc <span style="color: #660033;">-aes-<span style="color: #000000;">128</span>-ecb</span> <span style="color: #660033;">-d</span> <span style="color: #660033;">-in</span> myfile-aes <span style="color: #660033;">-out</span> myfile</pre></div></div>

<p>enc  后面跟你具体的加密算法<br />
-aes-128-ecb 所使用的算法<br />
-e/-d 加密/解密<br />
-in 要被加/解密的文件<br />
-out 被加/解密后的文件</p>
<p>b.用GnuPG加密文件</p>
<p>关于GnuPG 之前有另一篇博文 <a title="Permanent Link to 我的GnuPG 使用笔记" rel="bookmark" href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html">我的GnuPG 使用笔记</a>有关于GnuPG 更多的内容这里只说一下加密。<br />
加密</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gpg <span style="color: #660033;">-c</span> myfile <span style="color: #666666; font-style: italic;">#输入密码后会产生一个myfile.gpg 文件，这就是加密后的文件。</span></pre></div></div>

<p>解密</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gpg <span style="color: #660033;">-o</span> myfile <span style="color: #660033;">-d</span> myfile.gpg <span style="color: #666666; font-style: italic;">#解密文件myfile.gpg 并将解密后的文件输出为myfile。</span></pre></div></div>

<p><strong>非对称加密</strong><br />
前面说的都是对称加密，现在说一下非对称加密，这个应该说是我们目前使用的最安全的方法了。<br />
加密</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gpg <span style="color: #660033;">-ea</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;lily.yu&quot;</span> hello.txt 
<span style="color: #666666; font-style: italic;">#使用lily.yu 这个密钥加密hello.txt，你会得到一个加密后的文件hello.txt.asc。-a 表示已ASCII 输出.</span></pre></div></div>

<p>解密</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gpg <span style="color: #660033;">-o</span> new.txt <span style="color: #660033;">-d</span> hello.txt.asc <span style="color: #666666; font-style: italic;">#解密hello.txt.asc 文件并输出到 new.txt 文件。</span></pre></div></div>

<p>至于如何创建密钥管理密钥请参看<a title="Permanent Link to 我的GnuPG 使用笔记" rel="bookmark" href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html">我的GnuPG 使用笔记</a></p>
<h3  class="related_post_title">与本文关系暧昧的文字</h3><ul class="related_post"><li><a href="http://www.linuxbyte.org/yi-zu-linux-zhu-ti-bi-zhi.html" title="一组 Linux 主题壁纸">一组 Linux 主题壁纸</a></li><li><a href="http://www.linuxbyte.org/firegpg-fei-chang-hao-yong-de-gpg-gong-ju.html" title="FireGPG-非常好用的GPG工具">FireGPG-非常好用的GPG工具</a></li><li><a href="http://www.linuxbyte.org/linuxzhi-fu-peng-chang-windows-7shu-qi-da-mu-zhi.html" title="Linux之父捧场Windows 7竖起大拇指">Linux之父捧场Windows 7竖起大拇指</a></li><li><a href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html" title="我的GnuPG 使用笔记">我的GnuPG 使用笔记</a></li><li><a href="http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html" title="用Cryptkeeper和EncFS 完成目录加密">用Cryptkeeper和EncFS 完成目录加密</a></li><li><a href="http://www.linuxbyte.org/yong-shc-jiami-shell.html" title="用shc 加密shell">用shc 加密shell</a></li><li><a href="http://www.linuxbyte.org/cryptsetup-luks-jiami.html" title="用Cryptsetup LUKS 加密目录">用Cryptsetup LUKS 加密目录</a></li><li><a href="http://www.linuxbyte.org/engarde-secure-linux-3021-released.html" title="EnGarde Secure Linux 3.0.21 发布">EnGarde Secure Linux 3.0.21 发布</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2009<br />
Source: <a href="http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html">Linux 下的文件加密</a><br />
<a href="http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html#comments">2 comments</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/linux" rel="tag">linux</a>, <a href="http://www.linuxbyte.org/tag/%e5%8a%a0%e5%af%86" rel="tag">加密</a>, <a href="http://www.linuxbyte.org/tag/%e6%96%87%e4%bb%b6%e5%8a%a0%e5%af%86" rel="tag">文件加密</a><br/>
</small></p>
	标签：<a href="http://www.linuxbyte.org/tag/linux" title="linux" rel="tag">linux</a>, <a href="http://www.linuxbyte.org/tag/%e5%8a%a0%e5%af%86" title="加密" rel="tag">加密</a>, <a href="http://www.linuxbyte.org/tag/%e6%96%87%e4%bb%b6%e5%8a%a0%e5%af%86" title="文件加密" rel="tag">文件加密</a><br />

	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.linuxbyte.org/help-fun-input-toy.html" title="致Linux开发者社区：新输入法Fitx开发需要大家帮忙 (2008-02-16)">致Linux开发者社区：新输入法Fitx开发需要大家帮忙</a> (0)</li>
	<li><a href="http://www.linuxbyte.org/yong-shc-jiami-shell.html" title="用shc 加密shell (2009-04-09)">用shc 加密shell</a> (0)</li>
	<li><a href="http://www.linuxbyte.org/cryptsetup-luks-jiami.html" title="用Cryptsetup LUKS 加密目录 (2009-03-06)">用Cryptsetup LUKS 加密目录</a> (1)</li>
	<li><a href="http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html" title="用Cryptkeeper和EncFS 完成目录加密 (2009-04-27)">用Cryptkeeper和EncFS 完成目录加密</a> (0)</li>
	<li><a href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html" title="我的GnuPG 使用笔记 (2009-06-05)">我的GnuPG 使用笔记</a> (1)</li>
</ul>


<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>我的GnuPG 使用笔记</title>
		<link>http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html</link>
		<comments>http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html#comments</comments>
		<pubDate>Thu, 04 Jun 2009 20:44:28 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[日常桌面]]></category>
		<category><![CDATA[GnuPG]]></category>
		<category><![CDATA[加密]]></category>
		<category><![CDATA[数字签名]]></category>
		<category><![CDATA[解密]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=431</guid>
		<description><![CDATA[GnuPG全称GNU PrivacyGuard，它是基于公钥/私钥体系的加密工具PGP（Pretty Good Privacy）的开源版本它遵循OpenPGP标准，同时它也是我们平常最常用的非对称工具。
安装GnuPG

yum install gnupg
or
apt-get instll gnu... ]]></description>
			<content:encoded><![CDATA[<p>GnuPG全称GNU PrivacyGuard，它是基于公钥/私钥体系的加密工具PGP（Pretty Good Privacy）的开源版本它遵循OpenPGP标准，同时它也是我们平常最常用的非对称工具。<br />
<strong>安装GnuPG</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> gnupg
or
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> instll gnupg</pre></div></div>

<p>像这样常用的工具基本每个发行版都会带的，所以用你最习惯的方法安装它吧。<br />
<span id="more-431"></span></p>
<p><strong>GnuPG 的使用</strong><br />
1.创建自己的密钥</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gpg <span style="color: #660033;">--gen-key</span></pre></div></div>

<p>键入命令后会有类似如下的输出，#后面的是我的注释。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>hew<span style="color: #000000; font-weight: bold;">@</span>localhost ~<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ gpg <span style="color: #660033;">--gen-key</span>
gpg <span style="color: #7a0874; font-weight: bold;">&#40;</span>GnuPG<span style="color: #7a0874; font-weight: bold;">&#41;</span> 1.4.5; Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>C<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">2006</span> Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is <span style="color: #c20cb9; font-weight: bold;">free</span> software, and you are welcome to redistribute it
under certain conditions. See the <span style="color: #c20cb9; font-weight: bold;">file</span> COPYING <span style="color: #000000; font-weight: bold;">for</span> details.
&nbsp;
Please <span style="color: #000000; font-weight: bold;">select</span> what kind of key you want:
   <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> DSA and Elgamal <span style="color: #7a0874; font-weight: bold;">&#40;</span>default<span style="color: #7a0874; font-weight: bold;">&#41;</span>
   <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> DSA <span style="color: #7a0874; font-weight: bold;">&#40;</span>sign only<span style="color: #7a0874; font-weight: bold;">&#41;</span>
   <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">5</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> RSA <span style="color: #7a0874; font-weight: bold;">&#40;</span>sign only<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Your selection? <span style="color: #000000;">1</span> <span style="color: #666666; font-style: italic;">#选择何种算法，一般默认。</span>
DSA keypair will have <span style="color: #000000;">1024</span> bits.
ELG-E keys may be between <span style="color: #000000;">1024</span> and <span style="color: #000000;">4096</span> bits long.
What keysize <span style="color: #000000; font-weight: bold;">do</span> you want? <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2048</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1024</span> <span style="color: #666666; font-style: italic;">#密钥长度，默认2048，我选1024 太长加解密时间也长。</span>
Requested keysize is <span style="color: #000000;">1024</span> bits
Please specify how long the key should be valid.
         <span style="color: #000000;">0</span> = key does not expire
      <span style="color: #000000; font-weight: bold;">&lt;</span>n<span style="color: #000000; font-weight: bold;">&gt;</span>  = key expires <span style="color: #000000; font-weight: bold;">in</span> n days
      <span style="color: #000000; font-weight: bold;">&lt;/</span>n<span style="color: #000000; font-weight: bold;">&gt;&lt;</span>n<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #c20cb9; font-weight: bold;">w</span> = key expires <span style="color: #000000; font-weight: bold;">in</span> n weeks
      <span style="color: #000000; font-weight: bold;">&lt;/</span>n<span style="color: #000000; font-weight: bold;">&gt;&lt;</span>n<span style="color: #000000; font-weight: bold;">&gt;</span>m = key expires <span style="color: #000000; font-weight: bold;">in</span> n months
      <span style="color: #000000; font-weight: bold;">&lt;/</span>n<span style="color: #000000; font-weight: bold;">&gt;&lt;</span>n<span style="color: #000000; font-weight: bold;">&gt;</span>y = key expires <span style="color: #000000; font-weight: bold;">in</span> n years
Key is valid <span style="color: #000000; font-weight: bold;">for</span>? <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">0</span> <span style="color: #666666; font-style: italic;">#密钥有效期，默认长期有效。</span>
Key does not expire at all
Is this correct? <span style="color: #7a0874; font-weight: bold;">&#40;</span>y<span style="color: #000000; font-weight: bold;">/</span>N<span style="color: #7a0874; font-weight: bold;">&#41;</span> y
&nbsp;
You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address <span style="color: #000000; font-weight: bold;">in</span> this form:
    <span style="color: #ff0000;">&quot;Heinrich Heine (Der Dichter) &lt;heinrichh @duesseldorf.de&gt;&quot;</span>
&nbsp;
Real name: lily
Name must be at least <span style="color: #000000;">5</span> characters long
Real name: lily.yu
Email address: linuxbyte<span style="color: #000000; font-weight: bold;">@</span>qq.com
Comment: linuxbyte<span style="color: #000000; font-weight: bold;">@</span>qq.com
You selected this USER-ID:
    <span style="color: #ff0000;">&quot;lily.yu (linuxbyte@qq.com) &lt;linuxbyte @qq.com&gt;&quot;</span>
<span style="color: #666666; font-style: italic;">#输入用户名和邮箱，用户名最好用全名最少5字符。</span>
Change <span style="color: #7a0874; font-weight: bold;">&#40;</span>N<span style="color: #7a0874; font-weight: bold;">&#41;</span>ame, <span style="color: #7a0874; font-weight: bold;">&#40;</span>C<span style="color: #7a0874; font-weight: bold;">&#41;</span>omment, <span style="color: #7a0874; font-weight: bold;">&#40;</span>E<span style="color: #7a0874; font-weight: bold;">&#41;</span>mail or <span style="color: #7a0874; font-weight: bold;">&#40;</span>O<span style="color: #7a0874; font-weight: bold;">&#41;</span>kay<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>Q<span style="color: #7a0874; font-weight: bold;">&#41;</span>uit? o
You need a Passphrase to protect your secret key.
<span style="color: #666666; font-style: italic;">#这里会让你输入密码这是你私钥的验证密码</span>
We need to generate a lot of random bytes. It is a good idea to perform
some other action <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">type</span> on the keyboard, move the mouse, utilize the
disks<span style="color: #7a0874; font-weight: bold;">&#41;</span> during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
.+++++++++++++++.+++++++++++++++...++++++++++++++++++++++++++++++.++++++++++.+++++.+++++.+++++.+++++.+++++.++++++++++.+++++++++++++++.+++++.++++++++++.<span style="color: #000000; font-weight: bold;">&gt;</span>+++++........................<span style="color: #000000; font-weight: bold;">&gt;</span>+++++.<span style="color: #000000; font-weight: bold;">&lt;</span> +++++........<span style="color: #000000; font-weight: bold;">&gt;</span>+++++....<span style="color: #000000; font-weight: bold;">&lt;</span> +++++.................+++++
We need to generate a lot of random bytes. It is a good idea to perform
some other action <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">type</span> on the keyboard, move the mouse, utilize the
disks<span style="color: #7a0874; font-weight: bold;">&#41;</span> during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
+++++++++++++++.+++++.+++++.+++++++++++++++.+++++++++++++++.+++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++.++++++++++<span style="color: #000000; font-weight: bold;">&gt;</span>.+++++<span style="color: #000000; font-weight: bold;">&gt;</span>+++++...................................+++++^^^
gpg: key 2FD93E4F marked <span style="color: #c20cb9; font-weight: bold;">as</span> ultimately trusted
public and secret key created and signed.
&nbsp;
gpg: checking the trustdb
gpg: <span style="color: #000000;">3</span> marginal<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span> needed, <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">complete</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span> needed, PGP trust model
gpg: depth: <span style="color: #000000;">0</span>  valid:   <span style="color: #000000;">2</span>  signed:   <span style="color: #000000;">0</span>  trust: <span style="color: #000000;">0</span>-, 0q, 0n, 0m, 0f, 2u
pub   1024D<span style="color: #000000; font-weight: bold;">/</span>2FD93E4F <span style="color: #000000;">2009</span>-06-04
      Key fingerprint = BA6F 89DA F2B9 41B5 <span style="color: #000000;">5312</span>  96FB FA32 5AF9 2FD9 3E4F
uid                  lily.yu <span style="color: #7a0874; font-weight: bold;">&#40;</span>linuxbyte<span style="color: #000000; font-weight: bold;">@</span>qq.com<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;/</span>linuxbyte<span style="color: #000000; font-weight: bold;">&gt;&lt;</span>linuxbyte <span style="color: #000000; font-weight: bold;">@</span>qq.com<span style="color: #000000; font-weight: bold;">&gt;</span>
sub   1024g<span style="color: #000000; font-weight: bold;">/</span>D0C255EA <span style="color: #000000;">2009</span>-06-04
<span style="color: #000000; font-weight: bold;">&lt;/</span>linuxbyte<span style="color: #000000; font-weight: bold;">&gt;&lt;/</span>heinrichh<span style="color: #000000; font-weight: bold;">&gt;&lt;/</span>n<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>这样你的密钥就算生成了，生成的key会保存在～/.gnupg/目录下，其中公钥文件为 pubring.gpg,私钥文件为secring.gpg。</p>
<p><strong>密钥的管理</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gpg <span style="color: #660033;">-K</span> <span style="color: #666666; font-style: italic;">#列出当前机器上的密钥</span>
&nbsp;
gpg <span style="color: #660033;">-a</span> <span style="color: #660033;">-o</span> lily.key <span style="color: #660033;">--export</span> lily.yu <span style="color: #666666; font-style: italic;">#导出lily 的公钥到lily.key 。</span>
gpg <span style="color: #660033;">-a</span> <span style="color: #660033;">-o</span> lily-secret.key <span style="color: #660033;">--export-secret-keys</span> 2lily.yu <span style="color: #666666; font-style: italic;">#导出lily 的私钥</span>
&nbsp;
gpg <span style="color: #660033;">--delete-keys</span> lily.yu <span style="color: #666666; font-style: italic;">#从公钥钥匙环里删除密钥</span>
gpg <span style="color: #660033;">--delete-secret-keys</span> lily.yu <span style="color: #666666; font-style: italic;">#从私钥钥匙环里删除密钥</span>
gpg <span style="color: #660033;">--delete-secret-and-public-key</span> lily.yu <span style="color: #666666; font-style: italic;">#同时删除公钥私钥</span>
&nbsp;
gpg <span style="color: #660033;">--import</span> filenamepubkey  <span style="color: #666666; font-style: italic;">#导入一个密钥</span></pre></div></div>

<p><strong>用GnuPG 加解密文件</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gpg <span style="color: #660033;">-ea</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;lily.yu&quot;</span> hello.txt <span style="color: #666666; font-style: italic;">#使用lily.yu 这个密钥加密hello.txt，你会得到一个加密后的文件hello.txt.asc。-a 表示已ASCII 输出.</span>
gpg <span style="color: #660033;">-o</span> new.txt <span style="color: #660033;">-d</span> hello.txt.asc <span style="color: #666666; font-style: italic;">#解密hello.txt.asc 文件并输出到 new.txt 文件。</span></pre></div></div>

<p><strong>用GnuPG 为文件做数字签名</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gpg <span style="color: #660033;">-s</span> hello.txt <span style="color: #666666; font-style: italic;">#为hello.txt 加签名，不加 -o 参数会产生一个hello.txt.gpg 文件</span>
gpg <span style="color: #660033;">--verify</span> hello.txt.gpg <span style="color: #666666; font-style: italic;">#验证该文件的签名</span>
&nbsp;
gpg <span style="color: #660033;">-o</span> hello-new.txt <span style="color: #660033;">--clearsign</span> hello.txt <span style="color: #666666; font-style: italic;">#将数字签名直接附加在文件中</span>
gpg <span style="color: #660033;">--verify</span> hello-new.txt <span style="color: #666666; font-style: italic;">#验证</span></pre></div></div>

<h3  class="related_post_title">与本文关系暧昧的文字</h3><ul class="related_post"><li><a href="http://www.linuxbyte.org/firegpg-fei-chang-hao-yong-de-gpg-gong-ju.html" title="FireGPG-非常好用的GPG工具">FireGPG-非常好用的GPG工具</a></li><li><a href="http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html" title="Linux 下的文件加密">Linux 下的文件加密</a></li><li><a href="http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html" title="用Cryptkeeper和EncFS 完成目录加密">用Cryptkeeper和EncFS 完成目录加密</a></li><li><a href="http://www.linuxbyte.org/yong-shc-jiami-shell.html" title="用shc 加密shell">用shc 加密shell</a></li><li><a href="http://www.linuxbyte.org/cryptsetup-luks-jiami.html" title="用Cryptsetup LUKS 加密目录">用Cryptsetup LUKS 加密目录</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2009<br />
Source: <a href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html">我的GnuPG 使用笔记</a><br />
<a href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html#comments">One comment</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/gnupg" rel="tag">GnuPG</a>, <a href="http://www.linuxbyte.org/tag/%e5%8a%a0%e5%af%86" rel="tag">加密</a>, <a href="http://www.linuxbyte.org/tag/%e6%95%b0%e5%ad%97%e7%ad%be%e5%90%8d" rel="tag">数字签名</a>, <a href="http://www.linuxbyte.org/tag/%e8%a7%a3%e5%af%86" rel="tag">解密</a><br/>
</small></p>
	标签：<a href="http://www.linuxbyte.org/tag/gnupg" title="GnuPG" rel="tag">GnuPG</a>, <a href="http://www.linuxbyte.org/tag/%e5%8a%a0%e5%af%86" title="加密" rel="tag">加密</a>, <a href="http://www.linuxbyte.org/tag/%e6%95%b0%e5%ad%97%e7%ad%be%e5%90%8d" title="数字签名" rel="tag">数字签名</a>, <a href="http://www.linuxbyte.org/tag/%e8%a7%a3%e5%af%86" title="解密" rel="tag">解密</a><br />

	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.linuxbyte.org/firegpg-fei-chang-hao-yong-de-gpg-gong-ju.html" title="FireGPG-非常好用的GPG工具 (2010-02-28)">FireGPG-非常好用的GPG工具</a> (2)</li>
	<li><a href="http://www.linuxbyte.org/yong-shc-jiami-shell.html" title="用shc 加密shell (2009-04-09)">用shc 加密shell</a> (0)</li>
	<li><a href="http://www.linuxbyte.org/cryptsetup-luks-jiami.html" title="用Cryptsetup LUKS 加密目录 (2009-03-06)">用Cryptsetup LUKS 加密目录</a> (1)</li>
	<li><a href="http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html" title="用Cryptkeeper和EncFS 完成目录加密 (2009-04-27)">用Cryptkeeper和EncFS 完成目录加密</a> (0)</li>
	<li><a href="http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html" title="Linux 下的文件加密 (2009-06-26)">Linux 下的文件加密</a> (2)</li>
</ul>


<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>用Cryptkeeper和EncFS 完成目录加密</title>
		<link>http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html</link>
		<comments>http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html#comments</comments>
		<pubDate>Mon, 27 Apr 2009 11:59:22 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[日常桌面]]></category>
		<category><![CDATA[Cryptkeeper]]></category>
		<category><![CDATA[EncFS]]></category>
		<category><![CDATA[加密]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=385</guid>
		<description><![CDATA[之前讨论过用Cryptsetup cryptoloop实现的变通版目录加密Cryptsetup LUKS 加密目录，这个方法虽然能达到目录加密的效果，但我更想要再简单些的方法，主要要求简单快速，对加密安全要求不用太高。... ]]></description>
			<content:encoded><![CDATA[<p>之前讨论过用Cryptsetup cryptoloop实现的变通版目录加密<a href="http://www.linuxbyte.org/cryptsetup-luks-jiami/">Cryptsetup LUKS 加密目录</a>，这个方法虽然能达到目录加密的效果，但我更想要再简单些的方法，主要要求简单快速，对加密安全要求不用太高。于是我找到了Cryptkeeper，Cryptkeeper 是一个系统托盘程序，它支持 KDE、GNOME、Xfce 等桌面环境，用来管理EncFS 加密的文件夹。<br />
<span id="more-385"></span><br />
安装：<br />
我的系统是ubuntu 8.04 可以直接 apt 安装:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> cryptkeeper encfs</pre></div></div>

<p>使用：<br />
安装完成后会在菜单应用程序==》系统工具 中有Cryptkeeper，单击运行。Cryptkeeper 运行后会在系统托盘里有一个钥匙图标，这个就是Cryptkeeper了。单击Cryptkeeper 然后弹出</p>
<p><a href="http://www.linuxbyte.org/uploads/2009/04/cryptkeeper.gif" rel="lightbox[385]"><img class="alignnone size-full wp-image-410" title="cryptkeeper" src="http://www.linuxbyte.org/uploads/2009/04/cryptkeeper.gif" alt="cryptkeeper" width="168" height="132" /></a></p>
<p>Import EncFS folder<br />
导入原有EncFS 目录</p>
<p>New encrypted floder<br />
创建一个EncFS 目录，并导入到Cryptkeeper。</p>
<p>/home/hew/myonly<br />
是我已有的目录。</p>
<h3  class="related_post_title">与本文关系暧昧的文字</h3><ul class="related_post"><li><a href="http://www.linuxbyte.org/firegpg-fei-chang-hao-yong-de-gpg-gong-ju.html" title="FireGPG-非常好用的GPG工具">FireGPG-非常好用的GPG工具</a></li><li><a href="http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html" title="Linux 下的文件加密">Linux 下的文件加密</a></li><li><a href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html" title="我的GnuPG 使用笔记">我的GnuPG 使用笔记</a></li><li><a href="http://www.linuxbyte.org/yong-shc-jiami-shell.html" title="用shc 加密shell">用shc 加密shell</a></li><li><a href="http://www.linuxbyte.org/cryptsetup-luks-jiami.html" title="用Cryptsetup LUKS 加密目录">用Cryptsetup LUKS 加密目录</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2009<br />
Source: <a href="http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html">用Cryptkeeper和EncFS 完成目录加密</a><br />
<a href="http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html#comments">No comment</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/cryptkeeper" rel="tag">Cryptkeeper</a>, <a href="http://www.linuxbyte.org/tag/encfs" rel="tag">EncFS</a>, <a href="http://www.linuxbyte.org/tag/%e5%8a%a0%e5%af%86" rel="tag">加密</a><br/>
</small></p>
	标签：<a href="http://www.linuxbyte.org/tag/cryptkeeper" title="Cryptkeeper" rel="tag">Cryptkeeper</a>, <a href="http://www.linuxbyte.org/tag/encfs" title="EncFS" rel="tag">EncFS</a>, <a href="http://www.linuxbyte.org/tag/%e5%8a%a0%e5%af%86" title="加密" rel="tag">加密</a><br />

	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.linuxbyte.org/yong-shc-jiami-shell.html" title="用shc 加密shell (2009-04-09)">用shc 加密shell</a> (0)</li>
	<li><a href="http://www.linuxbyte.org/cryptsetup-luks-jiami.html" title="用Cryptsetup LUKS 加密目录 (2009-03-06)">用Cryptsetup LUKS 加密目录</a> (1)</li>
	<li><a href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html" title="我的GnuPG 使用笔记 (2009-06-05)">我的GnuPG 使用笔记</a> (1)</li>
	<li><a href="http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html" title="Linux 下的文件加密 (2009-06-26)">Linux 下的文件加密</a> (2)</li>
	<li><a href="http://www.linuxbyte.org/firegpg-fei-chang-hao-yong-de-gpg-gong-ju.html" title="FireGPG-非常好用的GPG工具 (2010-02-28)">FireGPG-非常好用的GPG工具</a> (2)</li>
</ul>


<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用shc 加密shell</title>
		<link>http://www.linuxbyte.org/yong-shc-jiami-shell.html</link>
		<comments>http://www.linuxbyte.org/yong-shc-jiami-shell.html#comments</comments>
		<pubDate>Thu, 09 Apr 2009 13:32:00 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[日常桌面]]></category>
		<category><![CDATA[shc]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[加密]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=405</guid>
		<description><![CDATA[Shell 在Linux 系统中的强大有目共睹，每个管理员都是自己写的一组shell 来简化自己的工作，有时我们会把自己写的shell 让别人用，但这时有一个麻烦的地方，就是shell 里包含一些敏感信息如帐... ]]></description>
			<content:encoded><![CDATA[<p>Shell 在Linux 系统中的强大有目共睹，每个管理员都是自己写的一组shell 来简化自己的工作，有时我们会把自己写的shell 让别人用，但这时有一个麻烦的地方，就是shell 里包含一些敏感信息如帐号密码等，这时我们需要一个工具&#8211;shc 把我们的shell 加密。</p>
<p>shc是一个脚本编译工具, 使用RC4加密算法, 它能够把shell程序转换成二进制可执行文件(支持静态链接和动态链接)。<br />
shc主页:</p>
<p>http://www.datsi.fi.upm.es/%7Efrosal/</p>
<p><span id="more-405"></span><br />
<strong>安装shc</strong><br />
大部分的系统都在自己的源中提供shc 的二进制安装包，如果不幸你的系统中没有则可以去软件主页下载源码包自己安装。<br />
源码安装：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.datsi.fi.upm.es<span style="color: #000000; font-weight: bold;">/%</span>7Efrosal<span style="color: #000000; font-weight: bold;">/</span>sources<span style="color: #000000; font-weight: bold;">/</span>shc-3.8.6.tgz
 <span style="color: #c20cb9; font-weight: bold;">tar</span> vxf shc-3.8.6.tgz
 <span style="color: #7a0874; font-weight: bold;">cd</span> shc-3.8.6
 <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #7a0874; font-weight: bold;">test</span>
 <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">strings</span>
 <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p><strong>shc的使用方法:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">shc <span style="color: #660033;">-v</span> <span style="color: #660033;">-f</span> myshell.sh  <span style="color: #666666; font-style: italic;">#-f 为要加密的shell</span></pre></div></div>

<p>运行后会生成两个文件: myshell.sh.x 和 myshell.sh.x.c<br />
shc -r -f.x 为可执行的二进制文件，myshell.sh.x.c为该文件的C原文件。</p>
<h3  class="related_post_title">与本文关系暧昧的文字</h3><ul class="related_post"><li><a href="http://www.linuxbyte.org/firegpg-fei-chang-hao-yong-de-gpg-gong-ju.html" title="FireGPG-非常好用的GPG工具">FireGPG-非常好用的GPG工具</a></li><li><a href="http://www.linuxbyte.org/unixshellbian-cheng-di-san-ban.html" title="Unix.Shell编程(第三版)">Unix.Shell编程(第三版)</a></li><li><a href="http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html" title="Linux 下的文件加密">Linux 下的文件加密</a></li><li><a href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html" title="我的GnuPG 使用笔记">我的GnuPG 使用笔记</a></li><li><a href="http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html" title="用Cryptkeeper和EncFS 完成目录加密">用Cryptkeeper和EncFS 完成目录加密</a></li><li><a href="http://www.linuxbyte.org/cryptsetup-luks-jiami.html" title="用Cryptsetup LUKS 加密目录">用Cryptsetup LUKS 加密目录</a></li><li><a href="http://www.linuxbyte.org/shel-fang-zhi-wu-cao-zuo.html" title="用 !$ 防止误操作">用 !$ 防止误操作</a></li><li><a href="http://www.linuxbyte.org/fun-unix-shell.html" title="一些奇怪的unix指令名字的由来">一些奇怪的unix指令名字的由来</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2009<br />
Source: <a href="http://www.linuxbyte.org/yong-shc-jiami-shell.html">用shc 加密shell</a><br />
<a href="http://www.linuxbyte.org/yong-shc-jiami-shell.html#comments">No comment</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/shc" rel="tag">shc</a>, <a href="http://www.linuxbyte.org/tag/shell" rel="tag">shell</a>, <a href="http://www.linuxbyte.org/tag/%e5%8a%a0%e5%af%86" rel="tag">加密</a><br/>
</small></p>
	标签：<a href="http://www.linuxbyte.org/tag/shc" title="shc" rel="tag">shc</a>, <a href="http://www.linuxbyte.org/tag/shell" title="shell" rel="tag">shell</a>, <a href="http://www.linuxbyte.org/tag/%e5%8a%a0%e5%af%86" title="加密" rel="tag">加密</a><br />

	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.linuxbyte.org/cryptsetup-luks-jiami.html" title="用Cryptsetup LUKS 加密目录 (2009-03-06)">用Cryptsetup LUKS 加密目录</a> (1)</li>
	<li><a href="http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html" title="用Cryptkeeper和EncFS 完成目录加密 (2009-04-27)">用Cryptkeeper和EncFS 完成目录加密</a> (0)</li>
	<li><a href="http://www.linuxbyte.org/shel-fang-zhi-wu-cao-zuo.html" title="用 !$ 防止误操作 (2008-11-01)">用 !$ 防止误操作</a> (1)</li>
	<li><a href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html" title="我的GnuPG 使用笔记 (2009-06-05)">我的GnuPG 使用笔记</a> (1)</li>
	<li><a href="http://www.linuxbyte.org/fun-bash-shell.html" title="几个有用的bash shell组合 (2008-03-07)">几个有用的bash shell组合</a> (0)</li>
</ul>


<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/yong-shc-jiami-shell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用Cryptsetup LUKS 加密目录</title>
		<link>http://www.linuxbyte.org/cryptsetup-luks-jiami.html</link>
		<comments>http://www.linuxbyte.org/cryptsetup-luks-jiami.html#comments</comments>
		<pubDate>Fri, 06 Mar 2009 13:31:19 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[系统网络安全]]></category>
		<category><![CDATA[Cryptsetup]]></category>
		<category><![CDATA[DM-Crypt]]></category>
		<category><![CDATA[LUKS]]></category>
		<category><![CDATA[加密]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=386</guid>
		<description><![CDATA[系统：Centos 5.x
这里是用了Cryptsetup cryptoloop实现的变通版目录加密。
以下操作都已root 用户操作

 dd if=/dev/urandom of=myfile bs=1M count=10
 losetup /dev/loop0 myfile

这是创建一个存储空间，并将其关联到 /d... ]]></description>
			<content:encoded><![CDATA[<p>系统：Centos 5.x</p>
<p>这里是用了Cryptsetup cryptoloop实现的变通版目录加密。</p>
<p>以下操作都已root 用户操作</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;"><span style="color: #000000; font-weight: bold;">if</span></span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>urandom <span style="color: #007800;">of</span>=myfile <span style="color: #007800;">bs</span>=1M <span style="color: #007800;">count</span>=<span style="color: #000000;">10</span>
 losetup <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop0 myfile</pre></div></div>

<p>这是创建一个存储空间，并将其关联到 /dev/loop0</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> cryptsetup luksFormat <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop0
<span style="color: #666666; font-style: italic;">#这里会要你YES，然后是密码，注意YES 是全大写的，小写是不行的。</span>
 cryptsetup luksOpen <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop0 myfs
<span style="color: #666666; font-style: italic;">#这里要输入上面的那个密码，为/dev/loop0 创建一个Device-Mapper 文件:/dev/mapper/myfs</span>
mkfs.ext2 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>myfs
<span style="color: #666666; font-style: italic;">#格式化文件系统</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>crypt
<span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>myfs <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>crypt<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p><span id="more-386"></span><br />
完成上面后，/mnt/crypt/ 就是你的加密目录，而目录的位置和用户权限是可以自己控制的，这个可以自己看看mount 的manpage。</p>
<p>文件写入完成后要卸载就做下面步骤：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>crypt<span style="color: #000000; font-weight: bold;">/</span>
cryptsetup luksClose <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>myfs
losetup <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop0</pre></div></div>

<p>如果要再写入可以就做下面步骤：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">losetup <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop0 myfile
cryptsetup luksOpen <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop0 myfs
<span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>myfs <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>crypt<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<h3  class="related_post_title">与本文关系暧昧的文字</h3><ul class="related_post"><li><a href="http://www.linuxbyte.org/firegpg-fei-chang-hao-yong-de-gpg-gong-ju.html" title="FireGPG-非常好用的GPG工具">FireGPG-非常好用的GPG工具</a></li><li><a href="http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html" title="Linux 下的文件加密">Linux 下的文件加密</a></li><li><a href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html" title="我的GnuPG 使用笔记">我的GnuPG 使用笔记</a></li><li><a href="http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html" title="用Cryptkeeper和EncFS 完成目录加密">用Cryptkeeper和EncFS 完成目录加密</a></li><li><a href="http://www.linuxbyte.org/yong-shc-jiami-shell.html" title="用shc 加密shell">用shc 加密shell</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2009<br />
Source: <a href="http://www.linuxbyte.org/cryptsetup-luks-jiami.html">用Cryptsetup LUKS 加密目录</a><br />
<a href="http://www.linuxbyte.org/cryptsetup-luks-jiami.html#comments">One comment</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/cryptsetup" rel="tag">Cryptsetup</a>, <a href="http://www.linuxbyte.org/tag/dm-crypt" rel="tag">DM-Crypt</a>, <a href="http://www.linuxbyte.org/tag/luks" rel="tag">LUKS</a>, <a href="http://www.linuxbyte.org/tag/%e5%8a%a0%e5%af%86" rel="tag">加密</a><br/>
</small></p>
	标签：<a href="http://www.linuxbyte.org/tag/cryptsetup" title="Cryptsetup" rel="tag">Cryptsetup</a>, <a href="http://www.linuxbyte.org/tag/dm-crypt" title="DM-Crypt" rel="tag">DM-Crypt</a>, <a href="http://www.linuxbyte.org/tag/luks" title="LUKS" rel="tag">LUKS</a>, <a href="http://www.linuxbyte.org/tag/%e5%8a%a0%e5%af%86" title="加密" rel="tag">加密</a><br />

	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.linuxbyte.org/yong-shc-jiami-shell.html" title="用shc 加密shell (2009-04-09)">用shc 加密shell</a> (0)</li>
	<li><a href="http://www.linuxbyte.org/yong-cryptkeeperhe-encfs-wan-cheng-mu-lu-jia-mi.html" title="用Cryptkeeper和EncFS 完成目录加密 (2009-04-27)">用Cryptkeeper和EncFS 完成目录加密</a> (0)</li>
	<li><a href="http://www.linuxbyte.org/wo-de-gnupg-shi-yong-bi-ji.html" title="我的GnuPG 使用笔记 (2009-06-05)">我的GnuPG 使用笔记</a> (1)</li>
	<li><a href="http://www.linuxbyte.org/linux-xia-de-wen-jian-jia-mi.html" title="Linux 下的文件加密 (2009-06-26)">Linux 下的文件加密</a> (2)</li>
	<li><a href="http://www.linuxbyte.org/firegpg-fei-chang-hao-yong-de-gpg-gong-ju.html" title="FireGPG-非常好用的GPG工具 (2010-02-28)">FireGPG-非常好用的GPG工具</a> (2)</li>
</ul>


<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/cryptsetup-luks-jiami.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
