<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: openssl code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 04:28:37 GMT</pubDate>
    <description>DZone Snippets: openssl code</description>
    <item>
      <title>Extract a server certificate from a HTTPS connection.</title>
      <link>http://snippets.dzone.com/posts/show/3409</link>
      <description>You can simply extract information about the SSL certificate of HTTP connections using OpenSSL&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;openssl s_client -connect ${URL}:${PORT}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;openssl s_client -connect checkout.google.com:443&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;From there, it is only redirecting the output to a file or extracting information out of the stream with Perl.</description>
      <pubDate>Sat, 03 Feb 2007 22:34:31 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3409</guid>
      <author>purestorm ()</author>
    </item>
    <item>
      <title>encrypting data with ruby and OpenSSL</title>
      <link>http://snippets.dzone.com/posts/show/576</link>
      <description>&lt;code&gt;require 'openssl'&lt;br /&gt;require 'digest/sha1'&lt;br /&gt;c = OpenSSL::Cipher::Cipher.new("aes-256-cbc")&lt;br /&gt;c.encrypt&lt;br /&gt;# your pass is what is used to encrypt/decrypt&lt;br /&gt;c.key = key = Digest::SHA1.hexdigest("yourpass")&lt;br /&gt;c.iv = iv = c.random_iv&lt;br /&gt;e = c.update("crypt this")&lt;br /&gt;e &lt;&lt; c.final&lt;br /&gt;puts "encrypted: #{e}\n"&lt;br /&gt;c = OpenSSL::Cipher::Cipher.new("aes-256-cbc")&lt;br /&gt;c.decrypt&lt;br /&gt;c.key = key&lt;br /&gt;c.iv = iv&lt;br /&gt;d = c.update(e)&lt;br /&gt;d &lt;&lt; c.final&lt;br /&gt;puts "decrypted: #{d}\n"&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;provided by menik from #rubyonrails</description>
      <pubDate>Thu, 11 Aug 2005 13:16:40 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/576</guid>
      <author>technoweenie (Rick Olson)</author>
    </item>
    <item>
      <title>Easy file encryption and decryption from the shell</title>
      <link>http://snippets.dzone.com/posts/show/341</link>
      <description>Works on OS X, Linux, anywhere with OpenSSL installed:&lt;br /&gt;&lt;br /&gt;To encrypt a file:&lt;br /&gt;&lt;code&gt;openssl des3 -salt -in infile.txt -out encryptedfile.txt&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To decrypt the file:&lt;br /&gt;&lt;code&gt;openssl des3 -d -salt -in encryptedfile.txt -out normalfile.txt&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Do not specify the same file as input and output on encryption.. I have noticed weird effects on OS X (it eats the file). Remove the -in * stuff if you want to pipe data into it (e.g. a tarred folder). Omit the -out * stuff if you want it to pipe data out on STDOUT.</description>
      <pubDate>Fri, 27 May 2005 11:17:25 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/341</guid>
      <author>peter (Peter Cooperx)</author>
    </item>
  </channel>
</rss>
