<?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>Ta vie on s'en fout! &#187; cryptage</title>
	<atom:link href="http://tavie.onsenfout.com/tag/cryptage/feed/" rel="self" type="application/rss+xml" />
	<link>http://tavie.onsenfout.com</link>
	<description>Mon bazar techno-miam</description>
	<lastBuildDate>Tue, 22 Nov 2011 11:06:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Authentification Apache avec une table MySQL d&#8217;utilisateurs</title>
		<link>http://tavie.onsenfout.com/2011/05/28/authentification-apache-avec-une-table-mysql-dutilisateurs/</link>
		<comments>http://tavie.onsenfout.com/2011/05/28/authentification-apache-avec-une-table-mysql-dutilisateurs/#comments</comments>
		<pubDate>Sat, 28 May 2011 10:22:56 +0000</pubDate>
		<dc:creator>François</dc:creator>
				<category><![CDATA[Bits]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[authentification]]></category>
		<category><![CDATA[cryptage]]></category>
		<category><![CDATA[dbd]]></category>
		<category><![CDATA[MD5]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[SHA1]]></category>
		<category><![CDATA[webdav]]></category>

		<guid isPermaLink="false">http://tavie.onsenfout.com/?p=763</guid>
		<description><![CDATA[Debian 6.0.1 Squeeze &#8211; Apache 2.2.16 &#8211; MySQL Server 5.1.49 Objectif : Réaliser l&#8217;authentification basique Apache pour un Webdav avec une base d&#8217;utilisateurs en MySQL, et le mot de passe stocké avec un cryptage non réversible dans la base. J&#8217;ai un peu galéré dans cette affaire, les infos qu&#8217;on trouve ne sont pas forcément d&#8217;actualité, [...]<br /><div><img src="http://tavie.onsenfout.com/wp-content/plugins/gd-star-rating/gfx.php?value=0.0" /></div><div>Rating: 0.0/<strong>5</strong> (0 votes cast)</div><br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://tavie.onsenfout.com/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br />]]></description>
			<content:encoded><![CDATA[<p><em>Debian 6.0.1 Squeeze &#8211; Apache 2.2.16 &#8211; MySQL Server 5.1.49</em></p>
<p>Objectif : Réaliser l&#8217;authentification basique Apache pour un Webdav avec une base d&#8217;utilisateurs en MySQL, et le mot de passe stocké avec un cryptage non réversible dans la base. J&#8217;ai un peu galéré dans cette affaire, les infos qu&#8217;on trouve ne sont pas forcément d&#8217;actualité, voici donc un petit topo.<br />
<span id="more-763"></span><br />
On commence par installer le paquet qui va bien pour qu&#8217;Apache puisse causer gentiment à MySQL via dbd :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libaprutil1-dbd-mysql</pre></div></div>

<p>Ensuite on active le <a href="http://httpd.apache.org/docs/2.2/mod/mod_dbd.html" target="_blank">module d&#8217;authentification dbd</a> :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">a2enmod authn_dbd
apache2ctl restart</pre></div></div>

<p>Création de la base sous MySQL. Pour faire simple la table utilisateurs ne comprend que 2 champs, login et pass:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">DATABASE</span> mabase CHARACTER <span style="color: #990099; font-weight: bold;">SET</span> UTF8<span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TABLE</span> <span style="color: #990099; font-weight: bold;">IF <span style="color: #CC0099; font-weight: bold;">NOT</span> EXISTS</span> <span style="color: #008000;">`utilisateurs`</span> <span style="color: #FF00FF;">&#40;</span> 
      <span style="color: #008000;">`login`</span> <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">255</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>  
      <span style="color: #008000;">`pass`</span> <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">255</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>  
      <span style="color: #FF9900; font-weight: bold;">UNIQUE</span> <span style="color: #990099; font-weight: bold;">KEY</span> <span style="color: #008000;">`login`</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`login`</span><span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span> 
      <span style="color: #990099; font-weight: bold;">ENGINE</span><span style="color: #CC0099;">=</span>MyISAM <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #FF9900; font-weight: bold;">CHARSET</span><span style="color: #CC0099;">=</span>utf8<span style="color: #000033;">;</span></pre></div></div>

<p>Toujours sous MySQL on crée un utilisateur &laquo;&nbsp;apache&nbsp;&raquo; avec des droits limités à la table :</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #000099;">USER</span> <span style="color: #008000;">'apache'</span>@<span style="color: #008000;">'localhost'</span> IDENTIFIED BY  <span style="color: #008000;">'secret'</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #990099; font-weight: bold;">ON</span>  <span style="color: #008000;">`mabase`</span>.<span style="color: #008000;">`utilisateurs`</span> <span style="color: #990099; font-weight: bold;">TO</span>  <span style="color: #008000;">'apache'</span>@<span style="color: #008000;">'localhost'</span><span style="color: #000033;">;</span></pre></div></div>

<p>Ensuite on remplit la table MySQL et c&#8217;est là qu&#8217;il faut faire les bons choix pour le cryptage du mot de passe et ne pas se gourer. <a href="http://httpd.apache.org/docs/current/misc/password_encryptions.html">Apache reconnait 4 formats de mots de passe</a> : PLAIN TEXT, CRYPT, SHA1 et MD5.<br />
PLAIN TEXT est clairement à éviter, SHA1 et MD5 sont les plus robustes. Entre les deux SHA1 serait potentiellement le meilleur sauf que l&#8217;implémentation Apache est à priori faiblarde (pas de &laquo;&nbsp;grain de sel&nbsp;&raquo;) donc j&#8217;ai retenu MD5, mais ça reste un choix qu&#8217;on peut discuter le soir au coin du feu.</p>
<p>En tout cas, et quel que soit le cryptage choisi, la première chose à ne pas faire c&#8217;est d&#8217;utiliser les fonctions de cryptage de MySQL (password, MD5, SHA1), c&#8217;est complètement incompatible avec l&#8217;authentification Apache. Une fois qu&#8217;on a compris ça on a fait un grand pas!</p>
<p>On va donc générer en bash le hash MD5 du mot de passe avec l&#8217;utilitaire <a href="http://httpd.apache.org/docs/current/programs/htpasswd.html" target="_blank">htpasswd</a> fourni par Apache et l&#8217;enregistrer dans la base (la fonction htpasswd a surement été portée dans votre langage préféré). </p>
<p>Le cryptage est en MD5 par défaut, les options <code>-n et -b</code> permettent respectivement de rediriger le résultat vers la sortie standard et d&#8217;utiliser le mode batch :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-u</span> admin <span style="color: #660033;">-p</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;INSERT INTO utilisateurs (login, pass) VALUES ( <span style="color: #000099; font-weight: bold;">\
</span>     &quot;</span><span style="color: #000000; font-weight: bold;">\&quot;</span><span style="color: #ff0000;">&quot;robert&quot;</span><span style="color: #000000; font-weight: bold;">\&quot;</span><span style="color: #ff0000;">&quot;, <span style="color: #000099; font-weight: bold;">\
</span>     &quot;</span><span style="color: #000000; font-weight: bold;">\&quot;</span><span style="color: #ff0000;">&quot;<span style="color: #007800;">$(htpasswd -nb robert secret |cut -d ':' -f 2)</span>&quot;</span><span style="color: #000000; font-weight: bold;">\&quot;</span><span style="color: #ff0000;">&quot;)&quot;</span> mabase</pre></div></div>

<p>On met ensuite à jour le Virtual Host pour qu&#8217;Apache puisse aller chercher les infos d&#8217;identification dans la base :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&lt;VirtualHost *:80&gt;
	ServerName webdav.mondomaine.org
	DocumentRoot /var/www/webdav
	...
	DBDriver mysql
	DBDParams &quot;socket=/var/run/mysqld/mysqld.sock dbname=mabase user=apache pass=secret&quot;
	DBDMin  4
	DBDKeep 8
	DBDMax  20
	DBDExptime 300
	...
	&lt;Directory /var/www/webdav&gt;
		...
		AuthName &quot;Webdav&quot;
		AuthType Basic
		AuthBasicProvider dbd
		# Requete SQL pour l'authentification
		AuthDBDUserPWQuery &quot;SELECT pass FROM utilisateurs WHERE login = %s&quot; 
		Require valid-user
	&lt;/Directory&gt;
	...
&lt;/VirtualHost&gt;</pre></div></div>

<p>et on redémarre Apache :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">apache2ctl restart</pre></div></div>

<h3> Liens</h3>
<p><a href="http://httpd.apache.org/docs/2.3/fr/howto/auth.html" target="_blank>Authentification, autorisation et contrôle d&#8217;accès</a><br />
<a href="http://www.loicmorvan.fr/2010/01/php-comparaison-md5-sha-1/" target="_blank">PHP : Comparaison MD5 / SHA-1</a></p>
<br /><div><img src="http://tavie.onsenfout.com/wp-content/plugins/gd-star-rating/gfx.php?value=0.0" /></div><div>Rating: 0.0/<strong>5</strong> (0 votes cast)</div><br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://tavie.onsenfout.com/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br />]]></content:encoded>
			<wfw:commentRss>http://tavie.onsenfout.com/2011/05/28/authentification-apache-avec-une-table-mysql-dutilisateurs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utilisation basique de GnuPG pour crypter et décrypter des fichiers</title>
		<link>http://tavie.onsenfout.com/2007/11/12/utilisation-basique-de-gnupg-pour-crypter-et-decrypter-des-fichiers/</link>
		<comments>http://tavie.onsenfout.com/2007/11/12/utilisation-basique-de-gnupg-pour-crypter-et-decrypter-des-fichiers/#comments</comments>
		<pubDate>Mon, 12 Nov 2007 14:13:56 +0000</pubDate>
		<dc:creator>François</dc:creator>
				<category><![CDATA[Bits]]></category>
		<category><![CDATA[cryptage]]></category>
		<category><![CDATA[gnupg]]></category>
		<category><![CDATA[gpg]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[pgp]]></category>
		<category><![CDATA[sécurité]]></category>

		<guid isPermaLink="false">http://tavie.onsenfout.com/2007/11/12/utilisation-basique-de-gnupg-pour-crypter-et-decrypter-des-fichiers/</guid>
		<description><![CDATA[GnuPG (ou GPG) est un logiciel de cryptographie complet qui implémente la norme OpenPGP. Les possibilités de GnuPG dépassent largement le cadre de ce billet, ceux qui veulent approfondir le sujet se réjouiront de la doc officielle. GnuPG est préinstallé sous Debian et Ubuntu ainsi qu&#8217;avec la majorité des distributions Linux je crois. Le projet [...]<br /><div><img src="http://tavie.onsenfout.com/wp-content/plugins/gd-star-rating/gfx.php?value=0.0" /></div><div>Rating: 0.0/<strong>5</strong> (0 votes cast)</div><br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://tavie.onsenfout.com/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.gnupg.org/" title="GnuPG" target="_blank">GnuPG</a> (ou GPG) est un logiciel de cryptographie complet qui implémente la norme OpenPGP. Les possibilités de GnuPG dépassent largement le cadre de ce billet, ceux qui veulent approfondir le sujet se réjouiront de la <a href="http://www.gnupg.org/documentation/manuals.fr.html" title="Documentation GnuPG" target="_blank">doc officielle</a>.</p>
<p>GnuPG est préinstallé sous Debian et Ubuntu ainsi qu&#8217;avec la majorité des distributions Linux je crois. Le projet <a href="http://www.gpg4win.org/" title="Gpg4win">Gpg4win</a> fournit un programme d&#8217;installation pour Windows qui inclus GnuPG et différents modules complémentaires. Les commandes de gpg sont les mêmes dans les différents environnements. GnuPG est avant tout un logiciel de cryptage asymétrique (clé publique &#8211; clé privée) et son domaine de prédilection est la transmission sécurisée d&#8217;information entre utilisateurs. Mais on peut aussi s&#8217;en servir pour faire du cryptage simple, c&#8217;est ce qu&#8217;on va voir ici.</p>
<p>Le problème à résoudre est le suivant :</p>
<p>Un utilisateur gère sur son poste de travail des informations confidentielles. L&#8217;accès au poste de travail étant protégé, on estime la sécurité suffisante sur le poste (ça pourrait se discuter mais c&#8217;est pas le sujet). Par contre les sauvegardes sont effectuées sur un serveur dont l&#8217;accès est public. On ne peut donc pas y sauvegarder les données confidentielles en l&#8217;état.</p>
<p>La solution va être de crypter les données avant de les sauvegarder, voilà comment :<br />
<span id="more-13"></span><br />
Génération d&#8217;un paire de clés :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">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.7; 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.
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>
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: #000000;">2048</span>
Requested keysize is <span style="color: #000000;">2048</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;</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;</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;</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: #000000;">0</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
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>
Real name: Michel
Email address: michel<span style="color: #000000; font-weight: bold;">@</span>martin.com
Comment:
You selected this USER-ID:
<span style="color: #ff0000;">&quot;Michel &lt;michel@martin.com&gt;&quot;</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.
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;">&gt;</span>..+++++....................................................
.............................................+++++^^^
gpg: key 62757D49 marked <span style="color: #c20cb9; font-weight: bold;">as</span> ultimately trusted
public and secret key created and signed.
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>62757D49 <span style="color: #000000;">2007</span>-<span style="color: #000000;">11</span>-<span style="color: #000000;">12</span>
Key fingerprint = 9B05 <span style="color: #000000;">2259</span> 683C 70CC D73C  3E47 816C 06FE <span style="color: #000000;">6275</span> 7D49
uid                  Michel <span style="color: #000000; font-weight: bold;">&lt;</span>michel<span style="color: #000000; font-weight: bold;">@</span>martin.com<span style="color: #000000; font-weight: bold;">&gt;</span>
sub   2048g<span style="color: #000000; font-weight: bold;">/</span>5589D5F6 <span style="color: #000000;">2007</span>-<span style="color: #000000;">11</span>-<span style="color: #000000;">12</span></pre></div></div>

<p>Ca y est on a notre paire de clés. Attention à ne pas oublier la &laquo;&nbsp;passphrase&nbsp;&raquo;, il n&#8217;y a aucun moyen de la récupérer. Elle n&#8217;est pas nécessaire pour crypter, mais sera demandée au décryptage. On peut mettre une passphrase vide, mais la sécurité est moindre.</p>
<p>L&#8217;étape suivante est de sauvegarder la clé privée, et la conserver en lieu sûr!!! :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gpg <span style="color: #660033;">--export-secret-keys</span> <span style="color: #660033;">-a</span> michel <span style="color: #000000; font-weight: bold;">&gt;</span> michel.sec</pre></div></div>

<p>Crypter le fichier confidentiel.doc :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gpg gpg <span style="color: #660033;">-e</span> <span style="color: #660033;">-r</span> Michel confidentiel.doc</pre></div></div>

<p>Cette commande crée le fichier crypté <strong>confidentiel.doc.gpg</strong> qui peut être stocké sans crainte sur des serveurs publics, tant que la clé privée n&#8217;est pas compromise.</p>
<p>Pour décrypter sur le poste qui contient les clés (la passphrase est demandée) :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gpg confidentiel.doc.gpg</pre></div></div>

<p>Pour décrypter sur un autre poste il faut d&#8217;abord importer la clé privée :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gpg <span style="color: #660033;">--import</span> michel.sec</pre></div></div>

<p>Voilà, c&#8217;est juste un aperçu rapide d&#8217;une application pratique du cryptage avec gpg.</p>
<br /><div><img src="http://tavie.onsenfout.com/wp-content/plugins/gd-star-rating/gfx.php?value=0.0" /></div><div>Rating: 0.0/<strong>5</strong> (0 votes cast)</div><br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://tavie.onsenfout.com/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br />]]></content:encoded>
			<wfw:commentRss>http://tavie.onsenfout.com/2007/11/12/utilisation-basique-de-gnupg-pour-crypter-et-decrypter-des-fichiers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

