<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>openssl &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://wordpress.com/tag/openssl/</link>
	<description>Feed of posts on WordPress.com tagged "openssl"</description>
	<pubDate>Wed, 15 Oct 2008 01:40:53 +0000</pubDate>

	<generator>http://wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Configure Apache2 with SSL]]></title>
<link>http://saguide.wordpress.com/?p=16</link>
<pubDate>Tue, 14 Oct 2008 15:53:27 +0000</pubDate>
<dc:creator>saguide</dc:creator>
<guid>http://saguide.wordpress.com/2008/10/14/configure-apache2-with-ssl/</guid>
<description><![CDATA[I recently had a need to setup a private directory on my web server that could only be accessed by a]]></description>
<content:encoded><![CDATA[<p>I recently had a need to setup a private directory on my web server that could only be accessed by a handful of selected people. The content also needed to be encrypted in transit. This article details how I did this on a <a title="Debian GNU/Linux" href="http://www.debian.org/" target="_blank">Debian GNU/Linux</a> system running <a title="Apache Foundation" href="http://apache.org/" target="_blank">Apache</a> (2.0.40) server using mod_ssl and <a title="OpenSSL Project" href="http://www.openssl.org/" target="_blank">OpenSSL</a> (0.9.6b and higher).  Here are the goals of this project:</p>
<ul>
<li>Require HIGH or MEDIUM level SSL/TLS encryption at the transport (TCP) layer</li>
<li>Browser must use SSLv3 or TLSv1, not SSLv2</li>
<li>Require username/password authentication for some subdirectories</li>
<li>Be a mini-CA (Certificate Authority)</li>
<li>Use a non-standard port to keep most of the port-scanning riffraff away</li>
</ul>
<p>The key to this whole system is the SSL/TLS protocol. SSL stands for Secure Sockets Layer, and it was developed by Netscape to enable secure transactions over the Web. It operates between the TCP layer and the HTTP application layer. TLSv1 is the IETF standard implementation, based on SSLv3. TLS stands for Transport Layer Security.</p>
<h3>Assumptions</h3>
<p>First and foremost, this document assumes that you are using some flavor of Linux, Apache 2.0.x and that you have OpenSSL installed. Other assumptions:</p>
<ul>
<li>This will be used over the Internet</li>
<li>Your DNS configuration is correct (hostname=FQDN, PTR records O.K., etc.)</li>
<li>Your firewall is setup to allow connections on the chosen https:// port</li>
<li>You have a second machine with a modern web browser for testing purposes</li>
<li>In these examples, my FQDN and hostname is:  <strong>mycompany.com</strong></li>
</ul>
<h3>Step 1:  Setup your own CA (Certificate Authority)</h3>
<p>In order to run a secure (SSL/TLS encrypted) web server, you have to have a private key and a certificate for the server. For a commercial web site, you will probably want to purchase a certificate signed by a well-known root CA. For Intranet or special-purpose uses like this, you can be your own CA. This is done with the OpenSSL tools.</p>
<p>Here, we will make a private CA key and a private CA X.509 certificate.  We will also make a directory for the  certs and keys:</p>
<pre>[root]# <strong>mkdir /root/CA</strong>
[root]# <strong>chmod 0770 /root/CA</strong>
[root]# <strong>cd /root/CA</strong>

[root]# <strong>openssl genrsa -des3 -out my-ca.key 2048</strong>
Generating RSA private key, 2048 bit long modulus
.....................................................+++
...................................................+++
e is 65537 (0x10001)
Enter PEM pass phrase:
Verifying password - Enter PEM pass phrase:

[root]# <strong>openssl req -new -x509 -days 3650 -key my-ca.key -out my-ca.crt</strong>
Using configuration from /usr/share/ssl/openssl.cnf
Enter PEM pass phrase:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) []:LK
State or Province Name (full name) []:Western
Locality Name (eg, city) []:Colombo
Organization Name (eg, company) [My Company Ltd]:MyCompany.Com
Organizational Unit Name (eg, section) []:Certificate Authority
Common Name (eg, your name or your server's hostname) []:mycompany.com CA
Email Address []:user@mycompany.com

[root]# <strong>openssl x509 -in my-ca.crt -text -noout
</strong></pre>
<p><strong>Notes:</strong> The first OpenSSL command makes the key. The second command makes the X.509 certificate with a 10-year lifetime. The third command lets you view the completed certificate. Make sure that you keep the password in a safe place, you will need this every time you sign another certificate! You will probably also want to make backups of the cert and key and lock them in a safe place.</p>
<h3>Step 2:  Make a key and a certificate for the web server:</h3>
<p>Now, we have to make an X.509 certificate and corresponding private key for the web server. Rather than creating a certificate directly, we will create a key and a <em>certificate request</em>, then "sign" the certificate request with the CA key we made in Step 1. You can make keys for multiple web servers this way. One thing to note is that SSL/TLS private keys for web servers need to be either 512 or 1024 bits. Any other key size may be incompatible with certain browsers.</p>
<pre>[root]# <strong>openssl genrsa -des3 -out server.key 1024</strong>
Generating RSA private key, 1024 bit long modulus
....++++++
.++++++
e is 65537 (0x10001)
Enter PEM pass phrase:
Verifying password - Enter PEM pass phrase:

[root]# <strong>openssl req -new -key server.key -out server.csr</strong>
Using configuration from /usr/share/ssl/openssl.cnf
Enter PEM pass phrase:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) []:LK
State or Province Name (full name) []:Western
Locality Name (eg, city) []:Colombo
Organization Name (eg, company) [My Company Ltd]:mycompany.Com
Organizational Unit Name (eg, section) []:TechStaff
Common Name (eg, your name or your server's hostname) []:mycompany.com <span style="color:#ff0000;"><strong>&#60;=== This must be the real FQDN of your server!!!</strong></span>
Email Address []:user@mycompany.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

# <strong>openssl x509 -req -in server.csr -out server.crt -sha1 -CA my-ca.crt -CAkey my-ca.key -CAcreateserial -days 3650</strong>
Signature ok
subject=/C=LK/ST=Western/L=Colombo/O=mycompany.Com/OU=TechStaff/CN=mycompany.com/Email=user@mycompany.com
Getting CA Private Key
Enter PEM pass phrase:

[root]# <strong>openssl x509 -in server.crt -text -noout</strong></pre>
<p>Make sure that your server name is the same as the FQDN that your clients will use when connecting to your site. Also, let's get in the habit of protecting our keys with appropriate permissions:</p>
<pre>[root]# <strong>chmod 0400 *.key
</strong></pre>
<p>Now, we need to move the new keys and certs into the proper directories in the /etc/apache2 hierarchy:</p>
<pre>[root]# <strong>cp server.crt /etc/apache2/ssl.crt</strong>
[root]# <strong>cp server.key /etc/apache2/ssl.key</strong>
[root]# <strong>cp my-ca.crt /etc/apache2/ssl.crt</strong></pre>
<h3>Step 3: Create directories and files for the secure web service</h3>
<p>I do not want the secure branch of my webserver directory tree to be part of my "insecure" branch that serves unencrypted files. My normal web root directory is <tt>/var/www/</tt> .  The document root for the  secure web server will be located at <tt>/var/www/SSL</tt>.</p>
<pre>[root]# <strong>mkdir /var/www/SSL</strong>
[root]# <strong>chmod 0775 /var/www/SSL</strong>
[root]# <strong>cd /var/www/SSL</strong>
[root]# <strong>mkdir Passneeded</strong><strong>
</strong></pre>
<p>For testing purposes, create a simple HTML file in /var/www/SSL to print "Apache rocks with SSL" :)</p>
<h3>Step 4: Configure the Apache web server</h3>
<p>Create a file, let's say <em>https.mycompany.com</em> in /etc/apache2/sites-enabled/ to define your HTTPS virtualhost and include the following lines.</p>
<pre>NameVirtualHost mycompany.com:443
&#60;VirtualHost mycompany.com:443&#62;

DocumentRoot "/var/www/SSL"

# Note that the FQDN and server hostname must go here - clients will not be able to connect, otherwise!
ServerName mars.vanemery.com:443
ServerAdmin webmaster@vanemery.com

# Here, I am allowing only "high" and "medium" security key lengths.
SSLCipherSuite HIGH:MEDIUM

# Here I am allowing SSLv3 and TLSv1, I am NOT allowing the old SSLv2.
SSLProtocol all -SSLv2

#   Server Certificate:
SSLCertificateFile /etc/apache2/ssl.crt/server.crt

#   Server Private Key:
SSLCertificateKeyFile /etc/apache2/ssl.key/server.key

#   Server Certificate Chain:
SSLCertificateChainFile /etc/apache2/ssl.crt/my-ca.crt

#   Certificate Authority (CA):
SSLCACertificateFile /etc/apache2/ssl.crt/my-ca.crt

# This is needed so that you can use auto-indexing for some directories in the
# /var/www/SSL directory branch.  This can be handy if you would like to have
# a list of sensitive files for people to download.
&#60;Directory "/var/www/SSL"&#62;
        Options Indexes
        AllowOverride None
        Allow from from all
        Order allow,deny
&#60;/Directory&#62;</pre>
<p>Also you have to tell Apache, for all HTTPS requests use the port 443. For that append the following lines to <em>/etc/apache2/ports.conf</em></p>
<pre>&#60;IfModule mod_ssl.c&#62;
    Listen "443"
&#60;/IfModule&#62;</pre>
<h3>Step 5: Start the web server and test</h3>
<p>Run the following commands to start the the Apache web server:</p>
<pre>[root]# <strong>/etc/init.d/apache2 start
Starting web server: apache2.
</strong>Server mycompany.com:443 (RSA)
Enter pass phrase:<strong>
</strong></pre>
<p>Note that you will have to enter the password for your server key in order to start the server. You will also have to do this during boot if you have httpd configured to start automatically.</p>
<p>Make sure that the web server is now listening on the SSL/TLS port, TCP port 443:</p>
<pre>[root]# <strong>netstat -tna</strong>
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN</pre>
<p>In order to test that your SSL/TLS web server is running, you will now need to connect to it with a browser. The URL you use should be <tt>https://mycompany.com</tt>. You will probably get a warning prompt about the Certificate Authority (CA) being unknown. You can view the certificate properties, which will look familiar because you created the cert yourself. You can save the cert in your browser, or import the <tt>my-ca.crt</tt> file into your browser as a new CA.  How you do this will depend  on which browser you are using.</p>
<h3>Step 6: Require simple username/password auth for one of the directories:</h3>
<p>We want to require a valid username and password for the <tt>/var/www/SSL/Passneeded</tt> directory. The username and password will be encrypted in transit as part of the TCP stream. We will need to setup the access control directives, as well as use the <tt>htpasswd</tt> command to add the username/password  pairs.</p>
<pre>[root]# <strong>htpasswd -c -m /etc/apache2/.htpasswd test_user1</strong>
New password:
Re-type new password:
Adding password for user test_user1
[root]# <strong>htpasswd -m /etc/apache2/.htpasswd test_user2</strong>
New password:
Re-type new password:
Adding password for user test_user2

[root]# <strong>chown apache.root /etc/apache2/.htpasswd</strong>
[root]# <strong>chmod 0460 /etc/apache2/.htpasswd</strong></pre>
<p>Now, we need to tell Apache to require a username/password to access the <tt>Passneeded</tt> directory.  Here is  what we will add to <em><tt>/etc/apache2/sites-enabled/https.mycompany.com</tt></em> file:</p>
<pre>&#60;Directory "/var/www/SSL/Passneeded"&#62;
	AuthType Basic
	AuthName "Username and Password Required"
	AuthUserFile /etc/apache2/.htpasswd
	Require valid-user
&#60;/Directory&#62;</pre>
<p>Now, restart the webserver with <tt>/etc/init.d/apache2 restart</tt>.  When you try to access the  <tt>Passneeded</tt> directory from a web browser, you should be prompted for a username and password. If you enter incorrect information, you should be denied access.</p>
<h3>Step 7: Change the TCP port that Apache SSL/TLS listens on:</h3>
<p>Since this is a private, special-purpose secure web server, you may want to change the TCP port from 443 to something else. This will make it just a little more difficult for crackers to locate via automated network scans. For this excercise, we will change the port to TCP 444 by editing the <tt>ports.conf</tt> configuration file and <em><tt>/etc/apache2/sites-enabled/https.mycompany.com</tt></em>.  Make the following changes to the <tt>ports.conf</tt>:</p>
<pre>&#60;IfModule mod_ssl.c&#62;
    Listen "444"
&#60;/IfModule&#62;</pre>
<p>And make the following changes in <em><tt>/etc/apache2/sites-enabled/https.mycompany.com</tt></em>:</p>
<pre>NameVirtualHost mycompany.com:444
&#60;VirtualHost mycompany.com:444&#62;</pre>
<p>Now, restart Apache and look at the listening ports:</p>
<pre>[root]# <strong>/etc/init.d/apache2 restart</strong>

[root]# <strong>netstat -tna</strong>
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:444             0.0.0.0:*               LISTEN</pre>
<p>Now, you should be able to connect to the server with this URL:</p>
<p><tt>https://mycompany.com:444</tt></p>
<h3>Web Server Key Password:</h3>
<p>You have probably noticed by now that every time you restart Apache or boot your server, you are forced to enter the password for the server key. This is a security measure, but it can be inconvenient. If you would like to make an <em>insecure</em> server key that will allow Apache to start automatically  at boot time, then there is a way to do this. The choice is yours...</p>
<p>Here is how you do it:</p>
<pre>[root]# <strong>cd /etc/apache2/ssl.key</strong>
[root]# <strong>cp server.key server.key.orig</strong>

[root]# <strong>openssl rsa -in server.key.orig -out server.key</strong>

[root]# <strong>chmod 0400 server*
</strong></pre>
<p>Now, you should be able to restart Apache or boot your server without having to input the password.   <span style="color:#ff0000;"><strong>This may also be a very good time to copy all the keys and certificates that you made to floppy or CD.</strong></span> You can imagine what a pain it would be if you lost all of your keys and certs due to a disk failure. You may even want to make paper copies of the PEM encoded certificates and keys, which use ASCII text. Lock them in a secure place, along with any passwords.</p>
<h3>Conclusion/Final Comments</h3>
<p>As you can see, setting up a secure web server for some specific function is not that difficult. All the tools are included with a standard GNU/Linux distribution. OpenSSL is a fantastic Open Source toolkit that can be used in a number of applications. For example, you can use it to run files through different hashing functions, handle S/MIME encrypted mail, or encrypt &#38; decrypt files.</p>
<p>In order to use Apache as a high-volume e-commerce server with SSL/TLS, you will probably need to do more configuration and hardware tuning. You may need to buy and configure a hardware crypto accelerator card. You will almost certainly want to purchase a "real" server certificate signed by Entrust, Thawte, or one of the other root-level CAs.</p>
<p>In any event, you now have a good feel for all the pieces, parts, and protocols that make it work!</p>
<h3>Resources</h3>
<ul>
<li><a href="http://httpd.apache.org/docs-2.0/">Apache 2.0 Documentation</a></li>
<li><a href="http://www.modssl.org/">mod_ssl home page</a></li>
<li><a href="http://www.openssl.org/">OpenSSL home page</a></li>
<li><a href="http://www.ietf.org/html.charters/tls-charter.html">IETF TLS Charter</a></li>
<li>The following man pages:
<ul>
<li>man openssl</li>
<li>man genrsa</li>
<li>man req</li>
<li>man x509</li>
<li>man pkcs12</li>
<li>man htpasswd</li>
</ul>
<p><iframe src='http://digg.com/api/diggthis.php?u=http%3A%2F%2Fdigg.com%2Flinux_unix%2FConfigure_Apache2_with_SSL' height='82' width='55' frameborder='0' scrolling='no' style='float: right; margin-left: 10px; margin-bottom: 5px; padding: 4px 0 2px 4px; background: #fff;'></iframe></li>
</ul>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Meglio Windows o Linux?]]></title>
<link>http://guana.wordpress.com/?p=312</link>
<pubDate>Fri, 19 Sep 2008 09:50:57 +0000</pubDate>
<dc:creator>guana</dc:creator>
<guid>http://guana.wordpress.com/2008/09/19/meglio-windows-o-linux/</guid>
<description><![CDATA[
Tempo fa scrissi un articolo che parlava del  sistema operativo Ubuntu (Linux), ricordate? . Si me]]></description>
<content:encoded><![CDATA[<p style="text-align:center;"><a href="http://guana.files.wordpress.com/2008/09/immagine2.png"><img class="aligncenter size-medium wp-image-338" title="immagine2" src="http://guana.wordpress.com/files/2008/09/immagine2.png?w=300" alt="" width="300" height="81" /></a></p>
<p>Tempo fa scrissi un articolo che parlava del  sistema operativo Ubuntu (Linux), ricordate? . Si metteva in luce la necessità, per noi informatici, di venire a conoscenza di quelle che sono le differenze tra Windows e Linux.  Si cercava di dare un significato ai tanti luoghi comuni e frasi fatte espresse dalla maggior parte degli utenti, del tipo : "Ubuntu e meglio di Windows" , "Ubuntu è più stabile" , "Windows si blocca sempre”, ecc..  Si era detto in quell'articolo che avrei aperto uno spazio in questo blog appunto per parlare di informatica, iniziando appunto dal nostro dilemma : E' meglio WINDOWS o LINUX?</p>
<p>Bene io e il mio gruppo di colleghi ci siamo posti questa domanda e siamo arrivati a delle conclusioni.</p>
<p>Non è stato un lavoro per niente facile. Il lavoro vero e proprio di test sui due sistemi operativi è stato preceduto da un'approfondito studio teorico che marchasse le principali caratteristiche di ciascun sistema. Naturalmente abbiamo tenuto sempre in considerazione ed approfondito quelli che sono i concetti di base che fanno parte della conoscenza del funzionamento di un sistema operativo tipo:  Kernel, scheduling di processi e thread, meccanismi di interrupt, gestione della memoria e studio dei sistemi multi processore SMP.</p>
<p>Ovviamente affermare che un sistema operativo è meglio di un altro, significa rendersi un po' conto di come tale sistema riesca a gestire ed ottimizzare i suoi processi in esecuzione sfruttando al massimo e al meglio le proprie risorse e conseguentemente riducendo notevolemente i tempi di esecuzione degli stessi. Ci si rende conto che il fine ultimo di un ottimale utilizzo delle risorse riguarda  una minore attesa da parte di un qualsiasi utente che magari si trova davanti ad un monitor e che deve attendere del tempo per avere a sua disposizione la macchina prima che la stessa completi di eseguire un programma. Quindi si capisce che se il sistema operativo è lento l'utente vedrà la macchina lenta o indisponibile. E' per questo che spesso siamo  indotti ad affemare che windows è meglio di linux o viceversa.</p>
<p>Per verificare effettivamente le prestazioni dei sistemi operativi analizzati, abbiamo pensato di eseguire dei test di benchmark per poter confrontare in termini non solo teorici i due sistemi. Questi test ci hanno, infatti, permesso di confrontare i tempi di esecuzione di varie applicazioni. I tempi osservati sono stati raccolti, analizzati e studiati per poterne <strong>trarre delle conclusioni finali per quel che riguarda le prestazioni di scheduling, relative ai due sistemi nell’esecuzione di processi multi-thread su un’architettura multi processore</strong>. La scelta dei programmi utilizzati per il test è ricaduta su quelle applicazioni maggiormente utilizzate in un ambiente desktop/workstation, e che ci desse, inoltre, la possibilità di eseguire lo stesso software su entrambi i sistemi operativi.  Per eseguire questi test abbiamo ritenuto opportuno utilizzare una macchina vergine, con nessun sistema preinstallato, in modo da poter effettuare i test su un sistema operativo che non avesse applicazioni installate se non i driver delle periferiche. Il vantaggio di questo approccio è che, in questo modo, non essendo presenti applicazioni esterne al sistema stesso, eccetto gli applicativi di benchmark, si sono ridotti al minimo i processi/threads in esecuzione sulla macchina.</p>
<p>Si è proceduto secondo i seguenti punti:</p>
<p>- Formattazione della macchina</p>
<p>- Installazione di Windows XP PRO-SP2 (esclusi aggiornamenti)</p>
<p>- Installazione Ubuntu 8.04 e ricompilazione del Kernel ottimizzato per un sistema dual core</p>
<p>- Installazione e configurazione dei software</p>
<p>- Creazione degli script di benchmark</p>
<p>- Esecuzione dei test e raccolta dei risultati</p>
<p>- Analisi ed interpretazione dei dati raccolti.</p>
<p>I test sono stai effettuati sull'esecuzione dei seguanti applicativi: Mencoder, Lame, FAAC, Rar, OpenSSL, Blender.</p>
<p>Ecco a voi i risultati dei nostri test:</p>
<p><strong>LAME, codifica audio.</strong> <a href="http://guana.files.wordpress.com/2008/09/lame.png"><img class="aligncenter size-medium wp-image-313" title="lame" src="http://guana.wordpress.com/files/2008/09/lame.png?w=300" alt="" width="300" height="248" /></a> <img src="/DOCUME~1/DANIELE/IMPOST~1/Temp/moz-screenshot.jpg" alt="" /><img src="/DOCUME~1/DANIELE/IMPOST~1/Temp/moz-screenshot-1.jpg" alt="" /> <img src="/DOCUME~1/DANIELE/IMPOST~1/Temp/moz-screenshot-2.jpg" alt="" /></p>
<div style="margin-top:0;margin-bottom:0;margin-left:0;text-align:left;direction:ltr;unicode-bidi:embed;">Configurazione multipliprocesso singlee thread. I tempi con 2 thread non migliorano rispetto ad un solo processo, perche occupano un core ciascuno. Inoltre lanciando quattro processi si verifica un raddoppio effettivo dei tempi per entrambi i sistemi operativi.</div>
<div style="margin-top:0;margin-bottom:0;margin-left:0;text-align:left;direction:ltr;unicode-bidi:embed;"><strong>MENCODER, codifica video.</strong></div>
<div style="margin-top:0;margin-bottom:0;margin-left:0;text-align:left;direction:ltr;unicode-bidi:embed;"><a href="http://guana.files.wordpress.com/2008/09/mplayer.png"><img class="aligncenter size-medium wp-image-316" title="mplayer" src="http://guana.wordpress.com/files/2008/09/mplayer.png?w=300" alt="" width="300" height="242" /></a></div>
<p>Applicazione multithread nativa. Con un solo thread l'applicazione utilizza appieno un solo core. Con 2 thread si nota un dimezzamento dei tempi di esecuzione e pieno utilizzo dei due core. Con 4 thread Linux risente molto dell'utilizzo dei context switch</p>
<p><strong>FAAC, codifica audio.</strong> <a href="http://guana.files.wordpress.com/2008/09/faac.png"><img class="aligncenter size-medium wp-image-318" title="faac" src="http://guana.wordpress.com/files/2008/09/faac.png?w=300" alt="" width="300" height="251" /></a></p>
<p>Configurazione multiprocesso, single thread. Nel caso di quattro processi di codifica contemporanei è interessante sottolineare come, mentre con linux i processi di codifica ottengono tempi di completamento pressoché identici all’interno della singola prova, con windows invece si possono notare tempi di completamento dei singoli processi molto differenti tra loro. Linux in questo conferma ulteriormente in questo test una migliore esecuzione parallela dei processi.</p>
<p><strong>RAR</strong></p>
<p><a href="http://guana.files.wordpress.com/2008/09/rar.png"><img class="aligncenter size-medium wp-image-321" title="rar" src="http://guana.wordpress.com/files/2008/09/rar.png?w=300" alt="" width="300" height="252" /></a></p>
<p>Differentemente dai test precedenti si nota che con due processi concorrenti il tempo registrato non è stato direttamente proporzionale al caso di un solo processo, ma superiore del 30%. Con 2 processi contemposanei la richiesta di risorse di calcolo veniva ad essere superiore a quella disponibile, causando un umento dei context switch e della prelazione tra processi.</p>
<p><strong>Rendering video, BLENDER:</strong></p>
<p><a href="http://guana.files.wordpress.com/2008/09/blender.png"><img class="aligncenter size-medium wp-image-332" title="blender" src="http://guana.wordpress.com/files/2008/09/blender.png?w=300" alt="" width="300" height="248" /></a></p>
<p>Blender è un'applicazione multithread. Si nota una riduzione notevole dei tempi di completamento sfruttando l'utilizzo di più thread. Con 8 thread le prestazioni migliore ulteriormente rispetto al primo caso. Si nota che Windows ha una risposta migliore. Il motivo è imputabile all'utilizzo dei driver video, proprietari in Windows e open source in Linux.</p>
<p><strong>Crittografia, OPENSSL- DES3</strong></p>
<p><a href="http://guana.files.wordpress.com/2008/09/openssl-des3.png"><img class="aligncenter size-medium wp-image-334" title="openssl-des3" src="http://guana.wordpress.com/files/2008/09/openssl-des3.png?w=300" alt="" width="300" height="244" /></a></p>
<p>Il test di crittografia evidenzia una migliore prestazione del file system EXT3 di Linux. L'NTFS di Windows subisce un calo di prestazioni proporzionale alla quantità di dati scritti fino a raggiungere una perdita del 41 % rispetto a EXT3 di Linux.</p>
<p><strong>Crittografia, OPENSSL, MD5:</strong></p>
<p><a href="http://guana.files.wordpress.com/2008/09/openssl-md5.png"><img class="aligncenter size-medium wp-image-335" title="openssl-md5" src="http://guana.wordpress.com/files/2008/09/openssl-md5.png?w=300" alt="" width="300" height="252" /></a></p>
<p>A causa della natura dell'applicazione, CPU intensive e diskless, si nota una riduzione dei tempi di completamento tra le prove eseguite in successione.</p>
<p><strong>Conclusioni.</strong> Beh analizzando i risultati si nota che <strong>Windows</strong> mostra una migliore gestione delle applicazioni multithread come MPlayer e Blender.</p>
<p><strong>Linux</strong> mostra invece un'ottimizzazione migliore dello scheduling per applicazioni <em>CPU intensive</em> ed una miglior gestione della cache per il riutilizzo delle istruzioni.</p>
<p>Per <strong>Windows</strong> si è notato un effettivo aumento di priorità data alle finestre in primo piano.</p>
<p>Per <strong>Linux</strong> si è notata una notevole stabilità dei tempi di completamento tra le singole prove. GLi altri processi nel sistema interferiscono in maniera non rilevante.</p>
<p>C'è da sottolineare però il fatto che, in generale, l'attenzione non è ricaduta tanto su quale dei due sistemi sia il "migliore" ma su come essi si distinguono nell'affrontare i problemi relativi alla gestione di applicativi <em>Multi-thread</em> e su architetture <em>Multi-Core</em>.</p>
<p><strong>COMPARAZIONE DEI TEST:</strong></p>
<p style="text-align:center;"><a href="http://guana.files.wordpress.com/2008/09/immagine11.png"><img class="size-large wp-image-327 aligncenter" title="immagine11" src="http://guana.wordpress.com/files/2008/09/immagine11.png?w=510" alt="" width="510" height="331" /></a></p>
<p style="text-align:center;">
<p style="text-align:center;">
<p style="text-align:center;"><strong><br />
</strong></p>
<p><a href="http://guana.files.wordpress.com/2008/09/linux62.jpg"><img class="aligncenter size-medium wp-image-323" title="linux62" src="http://guana.wordpress.com/files/2008/09/linux62.jpg?w=300" alt="" width="300" height="225" /></a></p>
<p style="text-align:center;"><strong>RISULTATO FINALE: WINDOWS 10 - LINUX 13</strong></p>
<p style="text-align:left;">Che ne dite?  E' come vi aspettavate?</p>
<p style="text-align:left;">ps. Tutto il lavoro di studio e di test è stato realizzato da me Daniele (guana), Oscar, Lorenzo e Gianluca.</p>
<p style="text-align:left;">Ci sentiamo al prossimo articolo.</p>
<p style="text-align:left;">ciao,</p>
<p style="text-align:left;">guana.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[How to be dishonest and live happy]]></title>
<link>http://bitsandchaos.wordpress.com/?p=42</link>
<pubDate>Wed, 10 Sep 2008 06:22:14 +0000</pubDate>
<dc:creator>Paolo</dc:creator>
<guid>http://bitsandchaos.wordpress.com/2008/09/10/how-to-be-dishonest-and-live-happy/</guid>
<description><![CDATA[It&#8217;s simple, write something like this.
The bottom line is: Debian is far more secure than RHE]]></description>
<content:encoded><![CDATA[<p>It's simple, write something like <a href="http://itmanagement.earthweb.com/osrc/article.php/12068_3770216_1">this</a>.</p>
<p>The bottom line is: Debian is far more secure than RHEL and Fedora, not due to technical reasons but for their development model. When Debian's openssl was compromised, they immediately issued a warning, told their users what to do, whilst Red Hat and Fedora were obscure, pointless and corporate-minded.</p>
<p>Dude, you are forgetting that it's entirely possible that the Debian's openssl security bug could have been the patient zero, and actual compromise of Red Hat's server could have been happened starting from a stolen passkey. Also, you are forgetting that, being Red Hat a corporate with some billions cash (of course, they have so much money because it's plenty of stupid people like me that pay them for their services) they were forced to work closely with law enforcement agencies such an intrusion could occur, and when FBI reaches the crime scene they are not primarily interested in sending an e-mail message on the mailing lists to tell them "ehy, we are here to save the day!".</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Moore's law == SSL]]></title>
<link>http://peekay.wordpress.com/?p=4</link>
<pubDate>Tue, 02 Sep 2008 15:22:27 +0000</pubDate>
<dc:creator>peekay</dc:creator>
<guid>http://peekay.wordpress.com/2008/09/02/moore-vs-ssl/</guid>
<description><![CDATA[When it comes to security, Moore&#8217;s law usually benefits crackers: faster brute-force is an obv]]></description>
<content:encoded><![CDATA[<p>When it comes to security, Moore's law usually benefits crackers: faster brute-force is an obvious benefit. One win for "the good guys" is in regards to SSL.</p>
<p>Not so long ago, implementing SSL was so expensive compute-wise we had to deploy special cryptographic accelerator cards either on our load-balancers or on our edge servers.  One type of card we had was capable of 200 RSA signs/second, but cost ~$4000.00 each.  Theoretically we could stuff three of these cards into a web server,  achieving 600 signs/sec for $12000 (plus whatever the server costs.)</p>
<p>Fast forward 2008.   I recently evaluated a "low-end" Dell Poweredge SC1435 1U rackserver with a single dual-core 2.6GHz Opteron.  After installing FreeBSD/amd64 and recompiling OpenSSL from sources, running "speed rsa1024" computed 2000+ signs/sec <em>per core</em>, totalling 4100 RSA signs/sec.  Plus the SC1435 has an open socket for a second dual-core Opteron.</p>
<p>Not bad for a machine we bought for less than $800 on eBay.  Needless to say we have no performance concerns deploying our application with SSL enabled.  Thanks Mr. Moore.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[El problema criptográfico de Debian parece estar siendo aprovechado  activamente por atacantes]]></title>
<link>http://sematove.wordpress.com/?p=744</link>
<pubDate>Thu, 28 Aug 2008 06:17:41 +0000</pubDate>
<dc:creator>sematove</dc:creator>
<guid>http://sematove.wordpress.com/2008/08/28/el-problema-criptografico-de-debian-parece-estar-siendo-aprovechado-activamente-por-atacantes/</guid>
<description><![CDATA[US-CERT está advirtiendo a los administradores de que, posiblemente, el famoso problema en la gener]]></description>
<content:encoded><![CDATA[<p>US-CERT está advirtiendo a los administradores de que, posiblemente, el famoso problema en la generación de números aleatorios que sufrió OpenSSL para Debian el pasado mes de mayo, está siendo aprovechado (probablemente de forma automática) para instalar rootkits en servidores Linux vulnerables.<br />
 <!--more--><br />
En mayo la criptografía sufrió un grave revés. Se descubrió que el generador de números aleatorios del paquete OpenSSL de Debian era predecible. Las claves generadas con él en los últimos dos años ya no eran fiables o verdaderamente seguras. A efectos prácticos, se podría deducir la clave privada a partir de la pública de los usuarios, con lo que la criptografía asimétrica dejaba de ser fiable para la autenticación y para la confidencialidad. Pronto se generó todo el espacio posible de claves vulnerables (públicas y privadas) y se desarrollaron exploits específicos para poder acceder a sistemas SSH protegidos con criptografía pública. </p>
<p>Los administradores que controlan sus sistemas a través de SSH se suelen autenticar a través de su clave privada (el servidor de SSH almacena la pública correspondiente). Esta es una alternativa a la autenticación a través de la clásica contraseña simétrica. Si la pareja de claves ha sido generada con el OpenSSL vulnerable, se puede hacer un ataque de fuerza bruta sobre un espacio de claves muy pequeño, algo que tarda unos 20 minutos con un ordenador de hoy día. Los que hayan protegido el uso de las claves con contraseña, están en principio a salvo. </p>
<p>Aunque el US-CERT no habla de este problema en concreto, probablemente es el que está siendo aprovechado para llevar a cabo estos ataques durante estos días. Los atacantes están intentando acceder a servidores con SSH activo, protegido por criptografía pública y claves privadas vulnerables. Con esto consiguen acceso de forma fácil al sistema. Si el kernel no está actualizado, utilizan algún exploit para conseguir acceso local como root (existen decenas) y una vez dentro, instalan el rootkit Phalanx2 que les permite (entre otras cosas) obtener otras claves SSH para acceder a otros sistemas. </p>
<p>En el apartado de más información se ofrece información sobre cómo detectar el rootkit. </p>
<p>Como advertíamos en mayo, el problema criptográfico del paquete OpenSSL de Debian traerá de cabeza a los administradores durante mucho tiempo. Fueron casi dos años de generación de claves vulnerables en cientos de miles de máquinas, y pasará mucho tiempo hasta que todos los administradores parcheen sus sistemas y sobre todo, vuelvan a generar sus claves públicas y privadas con un sistema actualizado. </p>
<p>Opina sobre esta noticia:<br />
<a href="http://www.hispasec.com/unaaldia/3594/comentar">http://www.hispasec.com/unaaldia/3594/comentar</a></p>
<p>Más información:</p>
<p>Active attacks using stolen SSH keys<br />
<a href="http://isc.sans.org/diary.php?storyid=4937">http://isc.sans.org/diary.php?storyid=4937</a></p>
<p>SSH Key-based Attacks<br />
<a href="http://www.us-cert.gov/current/#ssh_key_based_attacks">http://www.us-cert.gov/current/#ssh_key_based_attacks<br />
 </a><br />
16/05/2008 Preguntas frecuentes sobre el problema critptográfico de Debian<br />
<a href="http://www.hispasec.com/unaaldia/3492">http://www.hispasec.com/unaaldia/3492<br />
 </a><br />
14/05/2008 Graves problemas en el algoritmo que genera los números<br />
aleatorios en Debian<br />
<a href="http://www.hispasec.com/unaaldia/3490">http://www.hispasec.com/unaaldia/3490</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[OpenSSL과 select]]></title>
<link>http://kewlbear.wordpress.com/?p=24</link>
<pubDate>Sun, 24 Aug 2008 07:56:14 +0000</pubDate>
<dc:creator>kewlbear</dc:creator>
<guid>http://kewlbear.wordpress.com/2008/08/24/openssl%ea%b3%bc-select/</guid>
<description><![CDATA[
int num_read = 0;
while ( num_read &lt; size ) {
  int n = BIO_read( bio, buf + num_read, size - nu]]></description>
<content:encoded><![CDATA[<pre>
int num_read = 0;
while ( num_read &#60; size ) {
  int n = BIO_read( bio, buf + num_read, size - num_read );
  if ( n &#62; 0 ) {
    num_read += n;
    continue;
  }

  if ( !BIO_should_retry( bio ) ) {
    return -1;
  }

  fd_set rset;
  FD_ZERO(&#38;rset);
  fd_set wset;
  FD_ZERO(&#38;wset);
  if (BIO_should_read(bio)) {
    FD_SET(fd, &#38;rset);
  } else if (BIO_should_write(bio)) {
    FD_SET(fd, &#38;wset);
  } else {
    return -1;
  }

  n = select(fd + 1, &#38;rset, &#38;wset, NULL, &#38;t);
  if (n &#60;= 0) {
    if (n &#60; 0) {
      return -1;
    } else {
      printf("select timed out");
    }
  }
}
</pre>
]]></content:encoded>
</item>
<item>
<title><![CDATA[courier-imap用のSSLサーバ証明書を作る]]></title>
<link>http://moukari.wordpress.com/?p=95</link>
<pubDate>Thu, 31 Jul 2008 13:14:13 +0000</pubDate>
<dc:creator>moukari</dc:creator>
<guid>http://moukari.wordpress.com/2008/07/31/courier-imap%e7%94%a8%e3%81%aessl%e3%82%b5%e3%83%bc%e3%83%90%e8%a8%bc%e6%98%8e%e6%9b%b8%e3%82%92%e4%bd%9c%e3%82%8b/</guid>
<description><![CDATA[courier-imap用のサーバ証明書を作る(更新する)には。年に一度しかしないた]]></description>
<content:encoded><![CDATA[<p>courier-imap用のサーバ証明書を作る(更新する)には。年に一度しかしないため必ず忘れてしまうのでメモ。</p>
<pre style="padding-left:30px;">$ su -
# cd /usr/share/courier-imap
# cp -p pop3d.pem pop3e.pem.`date '+%Y%m%d'`
# rm pop3d.pem
# ./mkpop3dcert</pre>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Microsoft: your insecurity, our passion]]></title>
<link>http://guiodic.wordpress.com/?p=223</link>
<pubDate>Thu, 31 Jul 2008 13:01:32 +0000</pubDate>
<dc:creator>guiodic</dc:creator>
<guid>http://guiodic.wordpress.com/2008/07/31/microsoft-your-insecurity-our-passion/</guid>
<description><![CDATA[
Si fa un gran parlare di sicurezza, di questi tempi. Pare che i Rom siano il problema principale, c]]></description>
<content:encoded><![CDATA[<p><span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/xSRFBq9zqkk'></param><param name='wmode' value='transparent'></param><embed src='http://www.youtube.com/v/xSRFBq9zqkk&rel=0' type='application/x-shockwave-flash' wmode='transparent' width='425' height='350'></embed></object></span></p>
<p>Si fa un gran parlare di sicurezza, di questi tempi. Pare che i Rom siano il problema principale, come se li avessimo tra noi da ieri. Mah...</p>
<p>Ma passando all'informatica, colpisce come la sicurezza sia così poco considerata, nell'ambiente proprietario.</p>
<p>Oggi ho scoperto, per dire, che una falla di sicurezza segnalata come gravissima da Secunia, riguardante Microsoft Access, non è ancora stata patchata.</p>
<p><!--more--></p>
<p><a href="http://secunia.com/advisories/30883" target="_blank">http://secunia.com/advisories/30883</a></p>
<p>Leggiamo bene il report:</p>
<blockquote><p><strong>Description</strong>:<br />
A vulnerability has been reported in Snapshot Viewer for Microsoft Access, which can be exploited by malicious people to compromise a user's system.</p>
<p>The vulnerability is caused due to the snapview.ocx ActiveX control reportedly allowing files to be automatically downloaded to arbitrary locations on a user's system when e.g. visiting a malicious website.</p>
<p>Successful exploitation allows execution of arbitrary code.</p>
<p>NOTE: The vulnerability is currently being actively exploited</p></blockquote>
<p>Tradotto: la vulnerabilità causata dall'ActiveX di Snapshot Viewer compromette chi visita un sito web con tale controllo ActiveX, permettendo all'aggressore di eseguire sulla macchina remota del codice arbitrario e di farle automaticamente scaricare un file (quindi può tranquillamente fare quel che gli pare, in parole povere)<br />
Non solo, la vulnerabilità è già attivamente utilizzata.</p>
<p>Basta fare un confronto con le recenti falle in sistemi open source, come quella dell'OpenSSL di Debian.<br />
Scoperta da Debian stessa, mai usata nella pratica, patchata in poche ore.</p>
<p>Bella differenza no?<br />
Eppure quella falla è considerata "gravissima" e ha messo in ginocchio la reputazione di Debian, pur non avendo causato alcun danno (a parte quelli a Verisign che ha dovuto ricalcolare le chiavi). Le falle dei prodotti Windows rimangono incorrette per mesi, a volte per anni, permettendo ad esempio a vecchi virus di attaccare il nuovissimo Windows Vista. Ma nessuno si scandalizza.<br />
Forse perché <strong>è ormai considerato normale che i sistemi Microsoft siano insicuri</strong>, al punto che la legge italiana prevede l'obbligo di installare un antivirus per i computer che custodiscono dati sensibili.</p>
<p>Viceversa una falla grave in un sistema GNU/Linux è come quando nevica ad agosto...</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Generate key without password for apache]]></title>
<link>http://broersa.wordpress.com/?p=64</link>
<pubDate>Thu, 17 Jul 2008 07:06:30 +0000</pubDate>
<dc:creator>broersa</dc:creator>
<guid>http://broersa.wordpress.com/2008/07/17/generate-key-without-password-for-apache/</guid>
<description><![CDATA[Use the following command in openssl to get a non password protected private key:
openssl rsa -in se]]></description>
<content:encoded><![CDATA[<p>Use the following command in openssl to get a non password protected private key:</p>
<p>openssl rsa -in server.key -out server.pem</p>
<p>I needed this for appache.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Habilitando SSL no Apache2 ]]></title>
<link>http://penguim.wordpress.com/?p=371</link>
<pubDate>Mon, 14 Jul 2008 13:59:20 +0000</pubDate>
<dc:creator>penguim</dc:creator>
<guid>http://penguim.wordpress.com/2008/07/14/habilitando-ssl-no-apache2/</guid>
<description><![CDATA[Este artigo descreve os passos necessários para habilitar o SSL no Apache2, ele não cobre a instal]]></description>
<content:encoded><![CDATA[<p>Este artigo descreve os passos necessários para habilitar o SSL no Apache2, ele não cobre a instalação do LAMP e foi implementado no Debian Etch, mas pode ser usado em qualquer distro.</p>
<p><strong>Instale os pacotes necessários</strong></p>
<blockquote><p>
aptitude install openssl ssl-cert
</p></blockquote>
<p><strong>Crie o certificado</strong></p>
<blockquote><p>
openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem
</p></blockquote>
<p><strong>Defina a permissão para o arquivo criado</strong></p>
<blockquote><p>
chmod 600 /etc/apache2/apache.pem
</p></blockquote>
<p><strong>Edite o arquivo /etc/apache2/ports.conf e adicione a seguinte linha:</strong></p>
<blockquote><p>
Listen 443
</p></blockquote>
<p><strong>Habilite o suporte a SSL no apache2 da seguinte forma:</strong></p>
<blockquote><p>
a2enmod ssl
</p></blockquote>
<p><strong>Faça uma cópia do arquivo /etc/apache2/sites-available/default com o nome ssl.</strong></p>
<blockquote><p>
cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl
</p></blockquote>
<p><strong>Faça um link simbólico para /etc/apache2/sites-enabled/</strong></p>
<blockquote><p>
ln -s /etc/apache2/sites-available/ssl /etc/apache2/sites-enabled/
</p></blockquote>
<p><strong>Edite o arquivo /etc/apache2/sites-available/ssl, adicionando as seguintes linhas:</strong></p>
<blockquote><p>
NameVirtualHost *:443 </p>
<p>        ServerAdmin webmaster@localhost<br />
        .....<br />
        CustomLog /var/log/apache2/access.log combined<br />
        SSLEngine on #Adicione esta linha<br />
        ServerSignature On<br />
        SSLCertificateFile /etc/apache2/apache.pem #Adicione esta linha
</p></blockquote>
<p><strong>Reinicie o Apache</strong></p>
<blockquote><p>
apache2ctl restart
</p></blockquote>
<p><a href="http://shib.kuleuven.be/docs/apache2-ssl.shtml">Fonte</a></p>
<p>Este artigo estará disponivel na wiki de documentação do <a href="http://wiki.ubuntu-br.org/TimeDeSeguranca">Time de Segurança do Ubuntu-BR</a></p>
<p><a href="http://penguim.wordpress.com/files/2007/03/creysson.jpg"><img src="http://penguim.wordpress.com/files/2007/03/creysson.jpg?w=101" alt="" width="101" height="102" class="alignnone size-medium wp-image-171" /></a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Decrypting with the OpenSSL API]]></title>
<link>http://kahdev.wordpress.com/?p=11</link>
<pubDate>Sun, 13 Jul 2008 00:37:47 +0000</pubDate>
<dc:creator>kahgoh</dc:creator>
<guid>http://kahdev.wordpress.com/2008/07/13/decrypting-with-the-openssl-api/</guid>
<description><![CDATA[Before you can decrypt something, you have to generate it! You can generate encrypted data with Open]]></description>
<content:encoded><![CDATA[<p>Before you can decrypt something, you have to generate it! You can generate encrypted data with OpenSSL on the commandline using the <em>enc</em> command. The encryption process requires a key and iv (initialisation vector) pair, which can be derived from a given passphrase. The <em>enc</em> command gives you the option of specifying, either the passphrase or the key and iv pair. For this short tutorial, let's use specify the key and iv pair on the command line. To use perform the encryption, use the following command:</p>
<pre>openssl enc -e -bf-cbc -in test.txt -out test.bin \
     -K 12345678911234567892123456789312 \
     -iv 00000000</pre>
<p>The above command instructs OpenSSL to perform encryption ("-e") on the file <em>test.txt</em> ("-in test.txt"), using the blowfish with cipher block chaining ("-bf-cbc"). The encrypted data would be placed in the file "test.bin" ("-out test.bin"). The key, in hexadecimal, is 12345678911234567892123456789312 ("-K ...") and the iv is 00000000 (-"iv ..."). Notice that the <em>-K</em> is in <strong>capital letters</strong>. The lower case <em>k</em> has a different meaning! The key and iv <strong>must</strong> also expect their parameters to be in <strong>hexadecimal</strong>. To decrypt the encrypted file on the command line, you also use the <em>enc</em> command. The only differences are that the use '-d' instead of '-e' and you do not need the "-out ..." argument.</p>
<pre> openssl enc -e -bf-cbc -in test.bin \
    -K 12345678911234567892123456789312 \
    -iv 00000000 </pre>
<p>The functions for performing encryption and decryption in the OpenSSL crypto library are <em>EVP_EncryptInit_ex</em>, <em>EVP_EncryptUpdate</em> and <em>EVP_EncryptFinal_ex</em>, for encryption, and <em>EVP_DecryptInit_ex</em>, <em>EVP_DecryptUpdate</em> and <em>EVP_DecryptFinal_ex</em>, for decryption. The <a href="http://www.openssl.org/docs/crypto/EVP_EncryptInit.html">documentation</a> for these functions include an example for how to perform encryption using the encryption functions. The code for decryption is similar to the code for encryption.</p>
<p>First, start by loading the key, iv and the encrypted data.  The encrypted data can be loaded using the standard combination of <em>fopen</em>, <em>fread</em> and <em>fclose</em>.</p>
<p><font face="monospace"><br />
<font color="#2e8b57"><b>int</b></font>&#160;readfile(<font color="#2e8b57"><b>const</b></font>&#160;<font color="#2e8b57"><b>char</b></font>&#160;*filePath,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#2e8b57"><b>unsigned</b></font>&#160;<font color="#2e8b57"><b>char</b></font>&#160;* buf,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#2e8b57"><b>int</b></font>&#160;maxSize)<br />
{<br />
&#160;&#160;&#160;&#160;<font color="#2e8b57"><b>FILE</b></font>&#160;* inf = <font color="#ff00ff">NULL</font>;<br />
&#160;&#160;&#160;&#160;<font color="#2e8b57"><b>int</b></font>&#160;readSize = <font color="#ff00ff">0</font>;<br />
&#160;&#160;&#160;&#160;inf = fopen(filePath, <font color="#ff00ff">&#34;rb&#34;</font>) ;</p>
<p>&#160;&#160;&#160;&#160;<font color="#a52a2a"><b>if</b></font>&#160;(inf != <font color="#ff00ff">NULL</font>)<br />
&#160;&#160;&#160;&#160;{<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;readSize = fread(buf, <font color="#ff00ff">1</font>,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;maxSize, inf) ;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;fclose(inf);<br />
&#160;&#160;&#160;&#160;}</p>
<p>&#160;&#160;&#160;&#160;<font color="#a52a2a"><b>return</b></font>&#160;readSize;<br />
}</font></p>
<p>If you are using encrypted data created using the same key and iv combination as above, the key and iv should be specified as follows:</p>
<p><font face="monospace">&#160;&#160;&#160;&#160;<font color="#2e8b57"><b>char</b></font>&#160;key[<font color="#ff00ff">16</font>] = {<font color="#ff00ff">0x12</font>, <font color="#ff00ff">0x34</font>, <font color="#ff00ff">0x56</font>, <font color="#ff00ff">0x78</font>, <font color="#ff00ff">0x91</font>, <font color="#ff00ff">0x12</font>, <font color="#ff00ff">0x34</font>, <font color="#ff00ff">0x56</font>,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#ff00ff">0x78</font>, <font color="#ff00ff">0x92</font>, <font color="#ff00ff">0x12</font>, <font color="#ff00ff">0x34</font>, <font color="#ff00ff">0x56</font>, <font color="#ff00ff">0x78</font>, <font color="#ff00ff">0x93</font>, <font color="#ff00ff">0x12</font>};<br />
&#160;<br />
&#160;&#160;&#160;&#160;<font color="#2e8b57"><b>char</b></font>&#160;iv[<font color="#ff00ff">8</font>];<br />
&#160;&#160;&#160;&#160;memset(iv, <font color="#ff00ff">0x00</font>, <font color="#ff00ff">8</font>);</font></p>
<p>Notice that the key and iv are specified in <strong>hexadecimal</strong>. This is because when the encrypted data as generated, the key and iv were also given in hex! This is also <strong>important</strong>, as specifying it has a literal string (ie. char *iv = "00000000") is not the same and could result in time spent in trying to debug it fustratingly!</p>
<p>As mentioned before, the code for decrypting is similar to the code for encrypting. The first step is to setup a cipher context and initialise it.</p>
<p><font face="monospace"><font color="#2e8b57"><b>char</b></font>&#160;*decrypt (<font color="#2e8b57"><b>char</b></font>&#160;*key,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#2e8b57"><b>char</b></font>&#160;*iv,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#2e8b57"><b>char</b></font>&#160;*encryptedData,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#2e8b57"><b>int</b></font>&#160;encryptedLength)<br />
{<br />
&#160;&#160;&#160;&#160;<font color="#0000ff">// Initialisation</font><br />
&#160;&#160;&#160;&#160;EVP_CIPHER_CTX *cryptCtx = EVP_CIPHER_CTX_new();<br />
&#160;&#160;&#160;&#160;EVP_CIPHER_CTX_init(cryptCtx);</p>
<p>&#160;&#160;&#160;&#160;<font color="#2e8b57"><b>int</b></font>&#160;decryptedLength = <font color="#ff00ff">0</font>;<br />
&#160;&#160;&#160;&#160;<font color="#2e8b57"><b>int</b></font>&#160;allocateSize = encryptedLength * <font color="#a52a2a"><b>sizeof</b></font>(<font color="#2e8b57"><b>char</b></font>);<br />
&#160;&#160;&#160;&#160;<font color="#2e8b57"><b>int</b></font>&#160;lastDecryptLength = <font color="#ff00ff">0</font>;</p>
<p>&#160;&#160;&#160;&#160;<font color="#2e8b57"><b>char</b></font>&#160;*decryptedData = (<font color="#2e8b57"><b>char</b></font>&#160;*) malloc (allocateSize);<br />
&#160;&#160;&#160;&#160;memset(decryptedData, <font color="#ff00ff">0x00</font>, allocateSize);</p>
<p>&#160;&#160;&#160;&#160;<font color="#2e8b57"><b>int</b></font>&#160;decryptResult = EVP_DecryptInit_ex(cryptCtx,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;EVP_bf_cbc(), <font color="#ff00ff">NULL</font>, key, iv);</font></p>
<p>Next, use the <em>EVP_DecryptUpdate</em> function to attach the encrypted data and to decrypt the data.</p>
<p><font face="monospace">&#160;&#160;&#160;&#160;<font color="#0000ff">// EVP_DecryptInit_ex returns 1 if it succeeded.</font><br />
&#160;&#160;&#160;&#160;<font color="#a52a2a"><b>if</b></font>&#160;(decryptResult == <font color="#ff00ff">1</font>)<br />
&#160;&#160;&#160;&#160;{<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;decryptResult = EVP_DecryptUpdate(cryptCtx, decryptedData,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;decryptedLength, encryptedData, encryptedLength);</font></p>
<p>Note that <em>EVP_DecryptUpdate</em> will alter the value of the third parameter to be equal to the amount of data that was written. This is <strong>not</strong> <strong>always the entire length of the decrypted data</strong>! To finish the decryption process, use <em>EVP_DecryptFinal_ex</em>. This will decrypt any remaining data.</p>
<p><font face="monospace">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<font color="#0000ff">// Cleanup</font><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<font color="#a52a2a"><b>if</b></font>&#160;(decryptResult == <font color="#ff00ff">1</font>)<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<font color="#0000ff">// Stick the final data at the end of the last</font><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<font color="#0000ff">// decrypted data.</font><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;EVP_DecryptFinal_ex(cryptCtx,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;decryptedData + decryptedLength,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;lastDecryptLength);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;decryptedLength = decryptedLength + lastDecryptLength;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;decryptedData[decryptedLength - <font color="#ff00ff">1</font>] = <font color="#6a5acd">''</font>;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;printf (<font color="#ff00ff">&#34;Decrypted size: </font><font color="#6a5acd">%d</font><font color="#6a5acd">\n</font><font color="#ff00ff">&#34;</font>, decryptedLength);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;printf (<font color="#ff00ff">&#34;Decrypted data: </font><font color="#6a5acd">\n</font><font color="#6a5acd">%s</font><font color="#6a5acd">\n\n</font><font color="#ff00ff">&#34;</font>, decryptedData);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<font color="#a52a2a"><b>else</b></font><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;printf (<font color="#ff00ff">&#34;EVP_DeccryptUpdate failure.</font><font color="#6a5acd">\n</font><font color="#ff00ff">&#34;</font>);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}<br />
&#160;&#160;&#160;&#160;}<br />
&#160;&#160;&#160;&#160;<font color="#a52a2a"><b>else</b></font><br />
&#160;&#160;&#160;&#160;{<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;printf (<font color="#ff00ff">&#34;EVP_DecryptInit_ex failure.</font><font color="#6a5acd">\n</font><font color="#ff00ff">&#34;</font>);<br />
&#160;&#160;&#160;&#160;}</p>
<p>&#160;&#160;&#160;&#160;EVP_CIPHER_CTX_free(cryptCtx);<br />
&#160;&#160;&#160;&#160;EVP_cleanup();<br />
&#160;&#160;&#160;&#160;<font color="#a52a2a"><b>return</b></font>&#160;decryptedData;<br />
}</font></p>
<p>In the call to <em>EVP_DecryptFinal_ex</em>, note that the pointer that is given is the start of the decrypted memory buffer <strong>plus</strong> the length that was given back by the call to <em>EVP_DecryptUpdate</em>. This to prevent it from writing over what was originally decrypted. The resulting decrypted data is <strong>NOT guaranteed to be always null terminated</strong>. This is why a null has also been explicitly set in the above code.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Verisign und OCSP]]></title>
<link>http://binblog.wordpress.com/?p=157</link>
<pubDate>Thu, 10 Jul 2008 20:36:10 +0000</pubDate>
<dc:creator>martin</dc:creator>
<guid>http://binblog.wordpress.com/2008/07/10/verisign-und-ocsp/</guid>
<description><![CDATA[Was mir heute nicht so gut in den Kram gepaßt hat: 
$KUNDE warf mir nochmal 50 SSL-Zertifikate vor ]]></description>
<content:encoded><![CDATA[<p>Was mir heute nicht so gut in den Kram gepaßt hat: </p>
<p>$KUNDE warf mir nochmal 50 SSL-Zertifikate vor die Füße, zwecks Überprüfung, von denen 38 für das Debian-SSL-Problem empfänglich waren. Aber ich hab ja mittlerweile Routine.</p>
<p>Also wurden neue CSRs generiert, welche er bei Verisign (RSA/"Secure Server Certification Authority") zum Re-Issue eingereicht hat. Minuten später kam der erste mit einer Firefox-Fehlermeldung um die Ecke:<br />
<a href="http://binblog.files.wordpress.com/2008/07/shot-20080710220715.png"><img src="http://binblog.wordpress.com/files/2008/07/shot-20080710220715.png" alt="" width="400" height="234" class="alignnone size-full wp-image-160" /></a></p>
<p>Die verantwortliche Konfigurationsoption war dann auch schnell identifiziert:<br />
<a href="http://binblog.files.wordpress.com/2008/07/shot-20080710220823.png"><img src="http://binblog.wordpress.com/files/2008/07/shot-20080710220823.png" alt="" width="661" height="84" class="alignnone size-full wp-image-159" /></a></p>
<p>Willkommen im Dilemma. So schwer es mir fällt, zu bestreiten, daß diese Voreinstellung in Firefox 3.0 auf den Tag genau zur rechten Zeit kommt, so  unangebracht finde ich es, daß Verisign ein Zertifikat, dessen Austausch es gerade mal so mit Ach und Krach in die Mailbox der Administratoren geschafft hat, sofort per OCSP als gesperrt propagiert. </p>
<p>Gerade weil es jetzt so weit ist, daß OCSP, das Online Certificate Status Protokoll, tatsächlich genutzt wird, wäre eine gewisse Galgenfrist von mindestens 1 Tag bis vielleicht 1 Woche mehr als angemessen. Insbesondere bei einer Massenaktion mit einem Umfang von mehreren Dutzend Zertifikaten ist mir persönlich nämlich schleierhaft, wie man die Zertifikate im Rahmen von Change-Prozessen derart schnell auf die Produktivserver katapultieren soll. </p>
<p>Wenn man nochmal 30 Sekunden drüber nachdenkt, kommt man übrigens zur Erkenntnis, daß es auch mit einem einzigen Zertifikat kaum sauber hinzubekommen ist. Auf einer hochgradig produktiven SSL-Site muß man, wenn die CA einen OCSP Distribution Point bereitstellt, in Zukunft auf den Re-Issue verzichten und additiv ein neues Zertifikat dazukaufen, um es überhaupt ohne Ausfall tauschen zu können. Ob das wirklich im Sinne des Erfinders ist?</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[checksum - verify your data]]></title>
<link>http://kanabies.wordpress.com/?p=164</link>
<pubDate>Wed, 09 Jul 2008 07:32:49 +0000</pubDate>
<dc:creator>sgk</dc:creator>
<guid>http://kanabies.wordpress.com/2008/07/09/checksum-verify-your-data/</guid>
<description><![CDATA[====================================================================
title: checksum - verify your d]]></description>
<content:encoded><![CDATA[<p>====================================================================<br />
title: checksum - verify your data<br />
post author: SGK<br />
date posted: june, 26th 2008<br />
posted in: Tips&#38;Trick<br />
====================================================================</p>
<p><strong>apaan sih checksum?</strong></p>
<p><strong><a href="http://en.wikipedia.org/wiki/Checksum" target="_blank">checksum</a></strong> itu adalah salah satu skema dari "<strong><a href="http://en.wikipedia.org/wiki/Redundancy_check" target="_blank">redundary check</a></strong>"(RC). RC adalah proses pendeteksian dan pengkoreksian error dari sebuah data, ini merupakan sebuah solusi mudah buat ngelindungin integritas/keaslian dari sebuah data yang dikirim via jaringan internet. jadi singkat cerita...checksum itu adalah salah satu "teknik" buat ngecek+ngoreksi error dari sebuah data untuk ngetes keaslian dari data tersebut.<br />
<strong></strong></p>
<p><strong>cara kerja checksum?</strong><br />
<strong><a href="http://en.wikipedia.org/wiki/Checksum" target="_blank">cara kerjanya</a></strong> adalah dengan menambahkan data tambahan (biasanya berupa bit-bit) terhadap data, dan nilai hasil dari proses penggabungan itu nantinya bisa digunain ama penerima data yang kemudian akan membandingkan hasil dari ototentikasi checksum tersebut, dan apabila sama dengan hasil checksum di sumber maka akan menghasikan kesimpulan kalo data yang diterima ga korup, disisipi virus/trojan, atau lain kata: data yang diterima adalah asli!!!</p>
<p><strong>beberapa skema pengecekan error:<br />
</strong><a href="http://en.wikipedia.org/wiki/Redundancy_check#Error_detection_schemes" target="_blank">repetition schemes<br />
parity schemes<br />
checksum<br />
cylic redundancy checks<br />
hamming distance based checks<br />
hash function<br />
horizontal and vertical redundancy check<br />
polarity scheme</a></p>
<p><strong>POC (proof of concept)<br />
</strong></p>
<p>praktek!!! setelah puyeng ama teori diatas, mari kita praktekin aja langsung...kali aja malah tambah puyeng :P</p>
<p>kali ini saya bakal bahas cara ngecek integritas data pake program bawaan UNIX (mac os x termasuk keluarga unix...) yaitu <strong><a href="http://docs.info.apple.com/article.html?artnum=25490" target="_blank">sha1</a></strong>:</p>
<p>* buka terminal (kalo di <span style="text-decoration:line-through;">windows</span> ... command prompt)</p>
<p>* ketikin: /usr/bin/openssl sha1 [path file]</p>
<blockquote><p><strong>contoh:</strong> kanabies:~ sgk$ /usr/bin/openssl sha1 /Users/sgk/Documents/test-checksum.txt</p></blockquote>
<p>kemudian sha-1 digest (hasil RC) akan menampilkan: sha1 ([full path to the file])= [checksum amount]</p>
<blockquote><p><strong>contoh:</strong> SHA1(/Users/sgk/Documents/test-checksum.txt)= da39a3ee5e6b4b0d3255bfef95601890afd8070</p></blockquote>
<p>nah sekarang kalo hasil <strong><a href="http://en.wikipedia.org/wiki/Hash_function" target="_blank">hash</a></strong> (da39a3ee5e6b4b0d3255bfef95601890afd8070) nya sama dengan hash sumber maka bisa ditarik kesimpulan kalo data yang anda dapatkan itu asli...</p>
<p><strong><a href="http://www.abbreviations.com/" target="_blank">CMIIW</a></strong></p>
<p>=====================================================================</p>
<p>faq</p>
<p><strong><a href="http://en.wikipedia.org/wiki/Redundancy_check" target="_blank">apa itu redundary check???</a></strong><br />
<strong><a href="http://en.wikipedia.org/wiki/Redundancy_check" target="_blank">apa itu checksum???</a></strong><br />
<strong><a href="http://en.wikipedia.org/wiki/Checksum" target="_blank">gimana cara kerja checksum???</a></strong><br />
<strong><a href="http://en.wikipedia.org/wiki/Redundancy_check#Error_detection_schemes" target="_blank">ada berapa skema RC???</a></strong><br />
pertanyaan kamu ga ada di daftar faq???<strong><br />
</strong> coba cari <strong><a href="http://google.com/" target="_blank">disini</a></strong>, <strong><a href="http://wikipedia.org/" target="_blank">disana</a></strong>, baru <strong><a href="mailto:admins@kanabies.co.cc" target="_blank">kesini</a></strong> (semoga aja bisa jawab :p)</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[One Way Hash functions -- OpenSSL]]></title>
<link>http://sycure.wordpress.com/?p=30</link>
<pubDate>Wed, 02 Jul 2008 07:39:47 +0000</pubDate>
<dc:creator>yadab das</dc:creator>
<guid>http://sycure.wordpress.com/2008/07/02/one-way-hash-functions-openssl/</guid>
<description><![CDATA[Hash or Fingerprint generation functions are always an interesting Chapter in Cryptography as they a]]></description>
<content:encoded><![CDATA[<div>Hash or Fingerprint generation functions are always an interesting Chapter in Cryptography as they are the basics of the most cryptographic protocols.</div>
<div>Definition for a Cryptographic Hash Functions</div>
<div>=============================</div>
<div>Let us consider that M is the message and h is it's hash value after applying the hash function H. Or, it can be stated mathematically as: H (M) :=h. Where H will also satisfy the following characteristics.</div>
<ol>
<li>Given M, it is easy to compute h</li>
<li>Given h, it is hard to compute M such that H(M) = h</li>
<li>Given M, it is hard to find another messag, M1 , such that H(M) = H(M1)</li>
</ol>
<p>SHA-*, MD* and RIPEMD-* are the most popular Hash functions. OpenSSL provides both generic APIs to these Hash functions also provides direct APIs. Accessing through generic API (the EVP) is preferred.</p>
<p style="text-align:left;">Now let us first use the Hash APIs from OpenSSL and generate fingerprint or calculate hash value. The alorithm, that we will use, is <a title="RFC for MD5" href="http://www.ietf.org/rfc/rfc1321.txt">MD5</a>. MD5 (MD stands for Message Digest ) is One way hash algorithm from Ron Rivest. There are test vectors in <a title="MD5 RFC" href="http://www.ietf.org/rfc/rfc1321.txt">MD5 RFC</a>, which we can use to calculate (or validate) the hash values. The following figure shows the process of calculation MD5 hash using OpenSSL :-<a href="http://sycure.wordpress.com/files/2008/07/openssl-hash-md5.png"><img class="aligncenter size-medium wp-image-31" src="http://sycure.wordpress.com/files/2008/07/openssl-hash-md5.png?w=242" alt="OpenSSL - Using Message Digest APIs" width="242" height="300" /></a></p>
<p style="text-align:left;">Below is an example to calculate message digest using MD5 algorithm.</p>
<p style="text-align:left;"><em><strong>Code Snippet :</strong></em></p>
<pre><span style="color:#ff0000;">openSSlExmpleHashMd5.cpp

</span>#include &#60;stdio.h&#62;
#include &#60;string.h&#62;
#include &#60;openssl/evp.h&#62;

int main(int argc, char *argv[  ]) {

	int i,j;
	const int	totalTestVectors = 7;
	/*
	The ouput length for the claculated
	digest. This will be fixed for a parti-
	cular Hash algorithm and will very algo-
	rithm to algorithm.
	*/
  unsigned int	outputLength;
	/*
	The Message Digest Context object, which
	will hold the intermediate state.
	*/

  EVP_MD_CTX    messageDigestContext;

	/*
	The buffer to store message digest after
	computing. 64 bytes is enough for any hash
	function. For MD5 128/8 would be fine as
	MD5 has 128 bit output length.
	Someone can directly use the 128/8 as
	the size but if you change the Hash
	algorithm, for example SHA1,has 160 bit
	output, the length need to be changed to
	160/8 bytes.
	*/

  unsigned char messageDigest[EVP_MAX_MD_SIZE];

  /*
  Hashes will be calculated for the following strings.
  These strings are from the MD5 RFC.
  */
  const char *strMessages[] =
  {	"", // Input String : 1
        "a", // Input String : 2
	"abc",// Input String : 3
	"message digest",// Input String : 4
	"abcdefghijklmnopqrstuvwxyz",// Input String : 5
	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",// Input String : 6
	"12345678901234567890123456789012345678901234567890123456789012345678901234567890"};// Input String : 7
	  /*
	  For each Input string the Expected Output are (from RFC,
	  this is to make sure that, this implementation is not bogus):
	  1: d41d8cd98f00b204e9800998ecf8427e
	  2: 0cc175b9c0f1b6a831c399e269772661
	  3: 900150983cd24fb0d6963f7d28e17f72
	  4: f96b697d7cb7938d525a2f31aaf161d0
	  5: f96b697d7cb7938d525a2f31aaf161d0
	  6: d174ab98d277d9f5a5611c2c9f419d9f
	  7: 57edf4a22be3c955ac49da2e2107b67a
	  */

	/*
	Initialize the Message Digest Context
	Calculate Message Digest
	*/
	//EVP_DigestInit(&#38;messageDigestContext, EVP_md5());
  for (j=0;j&#60;totalTestVectors; j++)
  {
	  EVP_DigestInit(&#38;messageDigestContext, EVP_md5()); // for SHA1 use EVP_sha1()
	  EVP_DigestUpdate(&#38;messageDigestContext, strMessages[j], strlen(strMessages[j]));
	  EVP_DigestFinal(&#38;messageDigestContext, messageDigest, &#38;outputLength);
	  printf("Test Vector : \"%s\" \n, Digest : = \"",strMessages[j]);
	  for (i = 0;  i &#60; outputLength;  i++) printf("%02x", messageDigest[i]);
	  printf("\"\n");
  }
  return 0;
}</pre>
<p style="text-align:left;">The above code work fine on windows or Linux but you should have</p>
<p style="text-align:left;">already openssl libs with you or you can download it.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Mini tutorial para encriptar datos con certificados digitales en PHP]]></title>
<link>http://elblogdepablot.wordpress.com/?p=380</link>
<pubDate>Fri, 27 Jun 2008 15:39:06 +0000</pubDate>
<dc:creator>pablot</dc:creator>
<guid>http://elblogdepablot.wordpress.com/2008/06/27/mini-tutorial-para-encriptar-datos-con-certificados-digitales-en-php/</guid>
<description><![CDATA[Resulta que estoy trabajando en un proyecto que requiere tener un cuidado especial con ciertos datos]]></description>
<content:encoded><![CDATA[<p>Resulta que estoy trabajando en un proyecto que requiere tener un cuidado especial con ciertos datos y me puse a buscar una alternativa segura para hacerlo. Luego de investigar un poco, <a href="http://elblogdepablot.wordpress.com/mini-tutorial-para-encriptar-datos-con-certificados-digitales-en-php/">decidí escribir un mini-tutorial</a> para quienes necesiten algo parecido. Esto es solo la punta del iceberg, ya que brinda muchas más posibilidades de las que menciono en el tutorial. Espero que les sirva tanto como a mi.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[OpenVPN Guide]]></title>
<link>http://lockup.wordpress.com/?p=60</link>
<pubDate>Fri, 27 Jun 2008 06:02:10 +0000</pubDate>
<dc:creator>glenn0</dc:creator>
<guid>http://lockup.wordpress.com/2008/06/27/openvpn-guide/</guid>
<description><![CDATA[I&#8217;ve finally finished my OpenVPN guide. It&#8217;s based on the guide I used from It&#8217;s a]]></description>
<content:encoded><![CDATA[<p>I've finally finished my OpenVPN guide. It's based on the <a href="http://www.itsatechworld.com/2006/01/29/how-to-configure-openvpn/" target="_self">guide</a> I used from It's a Tech World, but I've beefed up the security and added explanations and detail to some of the more complicated steps.</p>
<p>Here is the URL (it's linked from the homepage as well): <a href="http://lockup.wordpress.com/configure-openvpn/" target="_self">http://lockup.wordpress.com/configure-openvpn/</a></p>
<p>As I mentioned in a previous post, using this configuration of OpenVPN, you'll be able to securely connect to your host network from anywhere, access files, services and the host internet connection, but you're host network will remain completely invisible to ports scans.</p>
<p>This product is amazingly effective, simple to use (once setup) and, with the right configuration, secure. I think my guide is fairly comprehensive, but if you have any suggestions, feel free to comment.</p>
<p>Big thanks to Riley at It's a Tech World for writing such a great guide.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Vulnerabilidades no OpenSSL]]></title>
<link>http://penguim.wordpress.com/?p=356</link>
<pubDate>Thu, 26 Jun 2008 16:20:54 +0000</pubDate>
<dc:creator>penguim</dc:creator>
<guid>http://penguim.wordpress.com/2008/06/26/vulnerabilidades-no-openssl/</guid>
<description><![CDATA[Foram encontradas novas vulnerabilidades no OpenSSL que afetam o seguinte sistema:
Ubuntu 8.04 Hardy]]></description>
<content:encoded><![CDATA[<p>Foram encontradas novas vulnerabilidades no OpenSSL que afetam o seguinte sistema:</p>
<p>Ubuntu 8.04 Hardy Heron</p>
<p>As vulnerabilidades permitem que um atacante remoto  envie pacotes forjados causando um DoS. O Ubuntu 8.04 LTS não compila extensões do servidor TLS por padrão. (CVE-2008-0891)</p>
<p>Para maiores informações sobre estas e outras vulnerabilidades acessem a seção <strong>ALERTAS</strong> na wiki page do <a href="http://wiki.ubuntu-br.org/TimeDeSeguranca">Time de Segurança</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Decoding Base 64 with OpenSSL]]></title>
<link>http://kahdev.wordpress.com/?p=5</link>
<pubDate>Wed, 25 Jun 2008 12:58:36 +0000</pubDate>
<dc:creator>kahgoh</dc:creator>
<guid>http://kahdev.wordpress.com/2008/06/25/decoding-base-64-with-openssl/</guid>
<description><![CDATA[Base 64 is a form of encoding that converts groups of 24 bits to four ASCII characters. The details ]]></description>
<content:encoded><![CDATA[<p>Base 64 is a form of encoding that converts groups of 24 bits to four <strong>ASCII</strong> characters. The details of base 64 encoding is detailed on the <a title="Base 64 - Wikipedia" href="http://en.wikipedia.org/wiki/Base64">Base 64 (Wikipedia)</a> page. The information on that page should be enough for you to write your own base 64 decoder. Alternatively, we can use OpenSSL to do it for us.</p>
<p>The <a href="http://www.openssl.org/docs/crypto/BIO_f_base64.html">OpenSSL documentation on BIO_f_base64</a> actually provides an example of how to use the library to perform the decoding with the library. The example on that page:</p>
<blockquote>
<pre>
    BIO *bio, *b64, *bio_out;
    char inbuf[512];
    int inlen;  

    b64 = BIO_new(BIO_f_base64());
    bio = BIO_new_fp(stdin, BIO_NOCLOSE);
    bio_out = BIO_new_fp(stdout, BIO_NOCLOSE);
    bio = BIO_push(b64, bio);  

    while((inlen = BIO_read(bio, inbuf, 512)) &#62; 0)
        BIO_write(bio_out, inbuf, inlen);</pre>
</blockquote>
<p>In the example, three BIOs are created - for decoding, outputting to standard output and another for taking in encoded data. The call to <strong>BIO_push</strong> creates a BIO chain (it adds the input BIO to the base 64 BIO) and then we loop until all of the decoded data is read. In each iteration, the decoded data is, first, read into the character array <strong>inbuf </strong>before it is outputted to standard output by writing to the BIO <strong>bio_out</strong>. In the example, each chunk of decoded data is outputted to standard output, but it is likely that you would want to store the decoded data in memory for some sort of processing. The most obvious way of doing this is to allocate memory to hold the <strong>entire</strong> decoded data and append each decoded chunk of data during each iteration of the loop.</p>
<p>If you are using C++, you can easily use C++ string to hold the decoded data and append during each loop. If you are using just C, one possibility around this problem is to allocate some initial memory and then use <strong>realloc</strong> to resize the memory during each iteration of the loop to hold in more and more data. But this seems rather inefficient because of the need to increase the size of the allocated memory. Note that <strong>realloc</strong> could also have to move the memory. We could avoid having to resize the memory during each iteration by allocating the memory before reading back the decoded data. Another inefficient method is to perform the loop twice - once to determine the length of the decoded data and another time to store the decoded data. It is more efficient to simply allocate the memory first and then read through the loop once, but how do you know the length of decoded data?</p>
<p>To determine exactly how long the decoded data should be, you have to go back to how base 64 encoding works - a group of 24 bits is mapped to a group of four ASCII characters. Note that valid base 64 encoded data will always have a length that is divisible by four. If the length of base 64 encoded data is not divisible for four, there is something wrong with the encoded data. For are given encoded data with x number of ASCII characters, the number of bits, y, in the decoded data is found as follows:</p>
<pre>
        24 bits = 4 ASCII characters
        y bits = x ASCII characters
        y = (24 * x) / 4 = (6 * x) bits
</pre>
<p>Next, we have to account for padding. Padding is present when the last group of 24 bits in the data that was encoded did fully occupy 24 bits. The base 64 standard states that there are three possibilities for padding - there will be either no, only one or only two padding characters (see the bottom of page 5 in <a href="http://tools.ietf.org/html/rfc4648#page-6">RFC 4648</a>). Also, note that the standard uses the equal sign ("=") as the padding character. For each instance of this padding character at the <strong>end</strong> of the encoded data, subtract eight bits from y to get the final expected decoded length.</p>
<p>Now that the calculation has been explained, we can turn this into code:</p>
<pre>
     char *encoded = "WU9ZTyEA";
     int result = 0;
     int padding = 0;
     int strLength = strlen(encoded);

     // Check that the string is not empty and that the length is a multiple of four.
     if ((strLength &#62; 0) &#38;&#38; ((strLength % 4) == 0))
     {
         // First, we check if the last character is padding.
         if (encoded[strLength - 1] == PADDING_CHAR)
         {
             padding++;

             // The second last character could also be padding!
             if (encoded[strLength - 2] == PADDING_CHAR)
             {
                 padding++;
             }
         }

         // Now that we know the amount of padding, we can caculate the expected
         // length. If groups of 24 bits (3 characters) get encoded into 32 bits
         // (4 characters) ...
         result = (3 * strLength) / 4;

         // Accounting for the padding:
         result = result - padding;
     }
     else
     {
         printf("Either there is no data to decode or its length is incorrect.\n");
     }</pre>
<p>Note one important assumption was made in this code ... that one char occupies 8 bits!</p>
<p>There is also one thing that I have come across when using OpenSSL to perform base 64 decoding. If the encoded data is greater than 64 characters long, I have had to insert a newline character after every 64 characters. This could be because OpenSSL mainly deals with the PEM format, which uses base 64 encoding. The PEM format uses line lengths of 64 characters (see <a href="http://tools.ietf.org/html/rfc4648#page-3">RFC 4648, section 3.1</a>). I have also had to make sure that the last line of the encoded data has a newline character at the end.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Surfin' the post 5/13 world.]]></title>
<link>http://binblog.wordpress.com/?p=144</link>
<pubDate>Sat, 21 Jun 2008 22:27:32 +0000</pubDate>
<dc:creator>martin</dc:creator>
<guid>http://binblog.wordpress.com/2008/06/21/surfin-the-post-513-world/</guid>
<description><![CDATA[Das audit-ssl-Script (.tar.gz) ist funktional in der Lage, Seiten mit angreifbaren SSL-Zertifikaten ]]></description>
<content:encoded><![CDATA[<p>Das <a href="http://www.gokickrocks.us/wp-content/uploads/2008/05/audit-ssl.tar.gz">audit-ssl-Script</a> (.tar.gz) ist funktional in der Lage, Seiten mit angreifbaren SSL-Zertifikaten zu erkennen. Komfortabler und plattformübergreifend tut es aber die <a href="http://codefromthe70s.org/sslblacklist.asp">SSL Blacklist Extension</a> für den Firefox:</p>
<p><a href="http://binblog.files.wordpress.com/2008/06/screenshot-ssl-blacklist.jpg"><img src="http://binblog.wordpress.com/files/2008/06/screenshot-ssl-blacklist.jpg" alt="" width="351" height="255" class="alignnone size-full wp-image-145" /></a></p>
<p>Auch zu empfehlen als kleiner Warnschuß an Anwender, die sich weigern, Zertifikate auszutauschen: <em>"Firefox zeigt bereits eine Warnmeldung an. Was wirst Du Deinen Kunden erzählen, wenn der Internet Explorer das nach dem nächsten Microsoft-Patchday ebenfalls macht?"</em></p>
]]></content:encoded>
</item>

</channel>
</rss>
