<?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>epicgeeks.net</title>
	<atom:link href="http://epicgeeks.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://epicgeeks.net</link>
	<description>gaming, development, and life.</description>
	<lastBuildDate>Wed, 21 Dec 2011 01:48:28 +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>IDA Patcher for Windows</title>
		<link>http://epicgeeks.net/2011/12/ida-patcher-for-windows/</link>
		<comments>http://epicgeeks.net/2011/12/ida-patcher-for-windows/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 01:33:20 +0000</pubDate>
		<dc:creator>J. Newing</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://epicgeeks.net/?p=23</guid>
		<description><![CDATA[Not too long ago I found myself needing to patch a .dll with a .dif file produced from IDA, after a very quick and admittedly quite lazy google turned up nothing I decided I needed to just write a quick one. I figured I would share with you the result. It&#8217;s quite simple, select the [...]]]></description>
			<content:encoded><![CDATA[<p>Not too long ago I found myself needing to patch a .dll with a .dif file produced from IDA, after a very quick and admittedly quite lazy google turned up nothing I decided I needed to just write a quick one. I figured I would share with you the result.</p>
<p>It&#8217;s quite simple, select the target file you wish to patch and select a .dif file with the patches you wish to make. Note: the .dif files produced by IDA need to either have their first 4 lines removed or simply add a ; to the lines with text (turning them into what my patcher sees as a comment and ignores) otherwise it expects a format of:</p>
<p><strong>Example Dif File</strong></p><pre><code>;This difference file has been created by IDA Pro
;
;some file.dll
;
; this is just a sample comment that can be placed inside a .dif file
00005031: 03 17
00005035: 03 17
00005872: 28 00
00005873: 58 00
00005874: 01 00
00005876: 06 00
00005C3A: 18 17
00010F56: 06 16</code></pre>
<p>As you can see above this .dif file would make 8 bytes changes within the specified target file.</p>
<p><a href="http://epicgeeks.net/2011/12/ida-patcher-for-windows/ida_patcher/" rel="attachment wp-att-24"><img class="alignnone size-medium wp-image-24" title="ida_patcher" src="http://epicgeeks.net/wp-content/uploads/2011/12/ida_patcher-300x233.png" alt="" width="300" height="233" /></a></p>
<a class="downloadlink" href="http://epicgeeks.net/wp-content/plugins/download-monitor/download.php?id=3" title=" downloaded 83 times" >IDAPatch (83)</a>
]]></content:encoded>
			<wfw:commentRss>http://epicgeeks.net/2011/12/ida-patcher-for-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Crayon Plugin</title>
		<link>http://epicgeeks.net/2011/10/wordpress-crayon-plugin/</link>
		<comments>http://epicgeeks.net/2011/10/wordpress-crayon-plugin/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 18:33:08 +0000</pubDate>
		<dc:creator>J. Newing</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://epicgeeks.net/?p=21</guid>
		<description><![CDATA[So as I&#8217;ve been designing this blog I decided I needed a good syntax highlighter as hopefully I&#8217;ll be posting lots of yummy source code for all kinds of interesting things. After a little while of searching I discovered found Crayon Syntax Highlighter by Aram Kocharyan, in short. WOW. This plugin is wonderful, uses jQuery [...]]]></description>
			<content:encoded><![CDATA[<p>So as I&#8217;ve been designing this blog I decided I needed a good syntax highlighter as hopefully I&#8217;ll be posting lots of yummy source code for all kinds of interesting things. After a little while of searching I discovered found <a href="http://ak.net84.net/projects/crayon-syntax-highlighter/">Crayon Syntax Highlighter</a> by Aram Kocharyan, in short. WOW. This plugin is wonderful, uses jQuery and boasts a robust, but elegant syntax highlighting schema.</p>
<p>Hands down this plugin has been wonderful to use in every way, the only think I found it lacked (that I personally wanted) was the ability to pop code out of my blog into a another window, as you can see this blog is very thin and makes for lack luster code reading. After a quick contact with the plugin&#8217;s author low and behold the same day he build the feature into the plugin. How&#8217;s that for service! </p>
<p>Finally I built my own theme, for here at epicgeeks.net however I&#8217;ve made this theme available for download here: <a class="downloadlink" href="http://epicgeeks.net/wp-content/plugins/download-monitor/download.php?id=2" title="Version1.0 downloaded 74 times" >Epicgeeks Crayon Theme (74)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://epicgeeks.net/2011/10/wordpress-crayon-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using PKs C# to PHP</title>
		<link>http://epicgeeks.net/2011/10/using-pks-c-to-php/</link>
		<comments>http://epicgeeks.net/2011/10/using-pks-c-to-php/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 18:18:43 +0000</pubDate>
		<dc:creator>J. Newing</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://epicgeeks.net/?p=7</guid>
		<description><![CDATA[So lately I&#8217;ve been seeing more and more C# application talking to the web, web interaction and applications is something that can be beneficial to both the end user and the developer making a plethora of things simpler and streamlined. However while talking two and from you application one needs to make sure the information is [...]]]></description>
			<content:encoded><![CDATA[<p>So lately I&#8217;ve been seeing more and more C# application talking to the web, web interaction and applications is something that can be beneficial to both the end user and the developer making a plethora of things simpler and streamlined. However while talking two and from you application one needs to make sure the information is secure at all times.</p>
<p>There are several methods to doing this, and one way is using public, private key-pair cryptography. In the example below I&#8217;ve shown a PHP script that is able to talk to a C# application using an openssl public, private key-pair.</p>
<p>In this post I&#8217;ve included <span id="more-7"></span>the source to everything in a .rar file listed for download at the bottom.</p>
<p><strong>Openssl Class</strong></p><pre><code>&lt;?php


/**
 ******************************************************************************************
 * OpenSSL                                                                    * synmuffin *
 ******************************************************************************************
 * 
 * OpenSSL class that was designed to work with C/C++/C# applications. This class allows
 * users who want to build a secure API to Rx/Tx data from the web (website or server)
 * through to their end users application.
 * 
 *
 * author: synmuffin
 * email: synmuffin@savelab.net
 * version: 1.0
 * date:
 *
 */
class OpenSSL {
	
	/*
	|================================================================================
	| PUBLIC VARS
	|================================================================================
	*/


	/*
	|================================================================================
	| PRIVATE VARS
	|================================================================================
	*/
	
	
	/**
	 * $publicKey
	 * Public key instance used throughout the class. This must be initialized via the
	 * LoadPublicKey() function.
	 */
	private $publicKey 		= NULL;
	
	
	/**
	 * $privateKey
	 * Private key instance used throughout the class. This must be initialized via the
	 * LoadPrivateKey() function.
	 */
	private $privateKey 	= NULL;


	/**
	 * $padding
	 * Padding, currently not in use as it seems to not work.
	 */
	private $padding 		= NULL;		// OPENSSL_PKCS1_PADDING, OPENSSL_SSLV23_PADDING, OPENSSL_PKCS1_OAEP_PADDING, OPENSSL_NO_PADDING.

    
    /**
     * Class constructor, currently no paramaters are needed.
     */
    public function __construct($params = FALSE)
    {
        if (!$params)
            return;
        
        if (array_key_exists('public_key', $params))
        {
            if (file_exists($params['public_key']))
                $this-&gt;LoadPublicKey($params['public_key']);
            else
                trigger_error(&quot;Unable to find Public key file {$params['public_key']}.&quot;, E_USER_ERROR);
        }

        if (array_key_exists('private_key', $params))
        {
            if (file_exists($params['private_key']))
                $this-&gt;LoadPrivateKey($params['private_key']);
            else
                trigger_error(&quot;Unable to find Private key file {$params['private_key']}.&quot;, E_USER_ERROR);
        }
    }
    // ---------------------------------------------------------------------


    /*
	|================================================================================
	| PUBLIC FUNCTIONS
	|================================================================================
	*/

    
    /**
     * public LoadPrivateKey(string $privkey_path [, string $privkey_pass])
     *
     * Function will load a private key via the passed string file location of $privkey_path. This fucntion also
     * takes and optional second paramter that will allow for private keys locked with a DES passphrase to be used.
     *
     * @param string $privkey_path	- Path to the private key file.
     * @param string $privkey_pass	- Private key passphrase.
     *
     * @return none
     */
    public function LoadPrivateKey($privkey_path, $privkey_pass = FALSE)
    {
    	if (!$privkey_pass || $privkey_pass == NULL)
    	{
    		if (!($this-&gt;privateKey = openssl_get_privatekey('file://' . $privkey_path)))
    			trigger_error(&quot;Unable to load private key from file {$privkey_path}.&quot;, E_USER_ERROR);
    	}
    	else
    	{
    		if (!($this-&gt;privateKey = openssl_get_privatekey('file://' . $privkey_path, $privkey_pass)))
    			trigger_error(&quot;Unable to load private key from file {$privkey_path}.&quot;, E_USER_ERROR);
    	}
    }
    // ---------------------------------------------------------------------


    /**
     * public LoadPublicKey(string $pubkey_path)
     *
     * Function will load a public key via the passed string file location of $pubkey_path.
     *
     * @param string $pubkey_path 	- Path to public key file.
     *
     * @return none
     */
    public function LoadPublicKey($pubkey_path)
    {
    	if (!($this-&gt;publicKey = openssl_get_publickey('file://' . $pubkey_path)))
    		trigger_error(&quot;Unable to load public key from file {$pubkey_path}.&quot;, E_USER_ERROR);
    }
    // ---------------------------------------------------------------------

    
    /**
     * public PrivateKeyEncrypt(string $raw_data [, bool $base64 = TRUE])
     *
     * Function will try and encrypte the passed string $raw_data using the loaded (hopefully) $this-&gt;privateKey
     * resource. This function also takes an optional second paramter allowing the user to spepcified if they wish
     * to have the encrypted data returned base64 encoded, be default this is set to true.
     *
     * @param string $raw_data	- Raw data to be encrypted.
     * @param bool $base64 		- Bool value to return data base64 encoded.
     *
     * @return string $encrypted_data
     */
    public function PrivateKeyEncrypt($raw_data, $base64 = TRUE)
    {
    	if ($this-&gt;privateKey == NULL)
    		trigger_error(&quot;Private key has not been sepcified.&quot;, E_USER_ERROR);
		
    	if (!openssl_private_encrypt($raw_data, $encrypted_data, $this-&gt;privateKey))
    		trigger_error(&quot;Unable to encrypt data.&quot;, E_USER_ERROR);

    	return ($base64) ? base64_encode($encrypted_data) : $encrypted_data;
    }
    // ---------------------------------------------------------------------

    
    /**
     * public PrivateKeyDecrypt(string $raw_data [, bool $base64 = TRUE])
     *
     * Function will try and decrypt the passed $raw_data using the loaded (hopefully) $this-&gt;privateKey resource. This
     * function, much like it's counter-part, takes an optional second paramter specifiing whether or not the $raw_data
     * is base64 encoded. By default is assumes it is.
     *
     * @param string $raw_data 	- Raw data to be decrypted.
     * @param bool $base64 		- Bool value to assume $raw_data is base64 encoded.
     *
     * @return string $decrypted_data
     */
    public function PrivateKeyDecrypt($raw_data, $base64 = TRUE)
    {
		if ($this-&gt;privateKey == NULL)
			trigger_error(&quot;Private key has not been specified.&quot;, E_USER_ERROR);

    	
    	if (!openssl_private_decrypt(($base64) ? base64_decode($raw_data) : $raw_data, $decrypted_data, $this-&gt;privateKey, $this-&gt;padding))
    			trigger_error(&quot;Unable to decrypt data.&quot;, E_USER_ERROR);

    	return $decrypted_data;
    }
    // ---------------------------------------------------------------------

    
    /**
     * public PublicKeyEncrypt(string $raw_data [, bool $base64 = TRUE])
     *
     * Function will try and encrypte the passed string $raw_data using the loaded (hopefully) $this-&gt;publicKey
     * resource. This function also takes an optional second paramter allowing the user to spepcified if they wish
     * to have the encrypted data returned base64 encoded, be default this is set to true.
     *
     * @param string $raw_data	- Raw data to be encrypted.
     * @param bool $base64 		- Bool value to return data base64 encoded.
     *
     * @return string $encrypted_data
     */
    public function PublicKeyEncrypt($raw_data, $base64 = TRUE)
    {
    	if ($this-&gt;publicKey == NULL)
    		trigger_error(&quot;Public key has not been specified.&quot;, E_USER_ERROR);

    	if (!openssl_public_encrypt($raw_data, $encrypted_data, $this-&gt;publicKey))
    		trigger_error(&quot;Unable to encrypt data.&quot;, E_USER_ERROR);

    	return ($base64) ? base64_encode($encrypted_data) : $encrypted_data;
    }
    // ---------------------------------------------------------------------

    
    /**
     * public PublicKeyDecrypt(string $raw_data [, bool $base64 = TRUE])
     *
     * Function will try and decrypt the passed $raw_data using the loaded (hopefully) $this-&gt;privateKey resource. This
     * function, much like it's counter-part, takes an optional second paramter specifiing whether or not the $raw_data
     * is base64 encoded. By default is assumes it is.
     *
     * @param string $raw_data 	- Raw data to be decrypted.
     * @param bool $base64 		- Bool value to assume $raw_data is base64 encoded.
     *
     * @return string $decrypted_data
     */
    public function PublicKeyDecrypt($raw_data, $base64 = TRUE)
    {
    	if ($this-&gt;publicKey == NULL)
    		trigger_error(&quot;Public key has not been specified.&quot;, E_USER_ERROR);
    	
    	if (!openssl_public_decrypt(($base64) ? base64_decode($raw_data) : $raw_data, $decrypted_data, $this-&gt;publicKey))
    		trigger_error(&quot;Unable to decrypt data.&quot;, E_USER_ERROR);
    	
    	return $decrypted_data;
    }
    // ---------------------------------------------------------------------


    /*
	|================================================================================
	| PRIVATE FUNCTIONS
	|================================================================================
	*/
	

}
?&gt;</code></pre>
<p><strong>Web usage example</strong></p><pre><code>&lt;?php
	// include the lib
	require_once('../lib/OpenSSL.php');

	// now to keep this nice and secure this should always be done and called
	// over a a HTTPS layer for added security. However in this example I've provided
	// a way to turn this check off just in case you want to run soem quick http tests.
	//
	// Simply comment out the next two lines if you wish to run http NOT https.
	
	if ($_SERVER['HTTPS'] != 'on')
		exit(&quot;You should use HTTPS not HTTP.&quot;);

	// in this example I'm going to use the $raw_data variable and just stick some text data in it,
	// however in a RWS this would be sensitive data that I've returned via a call or check from
	// a database or something along those lines.
	//
	// More to the point I want to pass something back to my application here, as encrypted data.
	$raw_data = &quot;This is my data that I want to keep a secret!&quot;;

	// next we init our class
	$ssl = new OpenSSL();

	// load our private key
	$ssl-&gt;LoadPrivateKey('/home/your/path/to/privatekey.key');

	// now we can encrypt our data (provided the key was valid)
	// note: with default optiosn like this it will return the data base64 encoded
	$encrypted_data = $ssl-&gt;PrivateKeyEncrypt($raw_data);

	// now we are just going to print this data (assuming this was our C# app that made this call)
	// we print the data right to output buffer, so we can use things like HTTP_GET requests.
	print $encrypted_data;
?&gt;</code></pre><p>
<p>Using the above example in conjunction with the C# application you can demo how this would work. Download the attached file to get a copy of all .php files as well as a full C# application.</p>
<a class="downloadlink" href="http://epicgeeks.net/wp-content/plugins/download-monitor/download.php?id=1" title=" downloaded 40 times" >PHP to C# Example (40)</a>
]]></content:encoded>
			<wfw:commentRss>http://epicgeeks.net/2011/10/using-pks-c-to-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Welcome</title>
		<link>http://epicgeeks.net/2011/10/welcome/</link>
		<comments>http://epicgeeks.net/2011/10/welcome/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 03:34:07 +0000</pubDate>
		<dc:creator>J. Newing</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.epicgeeks.net/?p=4</guid>
		<description><![CDATA[Hi there, welcome to epicgeeks.net the blog of synmuffin (J. Newing) where I&#8217;ll be posting random tidbits of general goodness. Everything from gaming, programming, reverse engineering and anything else I feel like. Thanks for stopping in and hope you enjoy.]]></description>
			<content:encoded><![CDATA[<p>Hi there, welcome to epicgeeks.net the blog of synmuffin (J. Newing) where I&#8217;ll be posting random tidbits of general goodness. Everything from gaming, programming, reverse engineering and anything else I feel like.</p>
<p>Thanks for stopping in and hope you enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://epicgeeks.net/2011/10/welcome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://epicgeeks.net/2011/10/hello-world/</link>
		<comments>http://epicgeeks.net/2011/10/hello-world/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 00:18:31 +0000</pubDate>
		<dc:creator>J. Newing</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.epicgeeks.net/?p=1</guid>
		<description><![CDATA[Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!]]></description>
			<content:encoded><![CDATA[<p>Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!</p>
]]></content:encoded>
			<wfw:commentRss>http://epicgeeks.net/2011/10/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

