<?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>iPhone Development Blog &#187; Security</title>
	<atom:link href="http://iPhoneIncubator.com/blog/category/security/feed" rel="self" type="application/rss+xml" />
	<link>http://iPhoneIncubator.com/blog</link>
	<description>Tips and Tricks for iPhone, iPod, iPad and iOS Developers</description>
	<lastBuildDate>Tue, 03 Apr 2012 15:55:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Looking for a PCI Compliance Testing Consultant With iPhone Experience</title>
		<link>http://iPhoneIncubator.com/blog/security/looking-for-a-pci-compliance-testing-consultant-with-iphone-experience</link>
		<comments>http://iPhoneIncubator.com/blog/security/looking-for-a-pci-compliance-testing-consultant-with-iphone-experience#comments</comments>
		<pubDate>Tue, 15 Dec 2009 21:35:57 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://iPhoneIncubator.com/blog/?p=386</guid>
		<description><![CDATA[An iPhone application that we&#8217;re developing for a client handles credit card information on the device. Therefore we need to have the app tested and certified against the Payment Application Data Security Standard (PA-DSS).
Unfortunately the consultant we had lined up for the testing self-destructed.
Do you know anyone in this business with experience testing iPhone apps? [...]<p>Post from <a href="http://iPhoneIncubator.com/blog">iPhone Development Blog</a> Copyright &copy; 2011 Nick Dalton - <a href="http://iPhoneIncubator.com/blog/portfolio">iPhone Developer</a><br/><br/><a href="http://iPhoneIncubator.com/blog/security/looking-for-a-pci-compliance-testing-consultant-with-iphone-experience">Looking for a PCI Compliance Testing Consultant With iPhone Experience</a></p>
]]></description>
			<content:encoded><![CDATA[<p>An iPhone application that we&#8217;re developing for a client handles credit card information on the device. Therefore we need to have the app tested and certified against the Payment Application Data Security Standard (<a href="http://en.wikipedia.org/wiki/PA-DSS">PA-DSS</a>).</p>
<p>Unfortunately the consultant we had lined up for the testing self-destructed.</p>
<p>Do you know anyone in this business with experience testing iPhone apps? Are you a PCI consultant looking for a gig? Please let me know in the comments below. Thanks!</p>
<p>Post from <a href="http://iPhoneIncubator.com/blog">iPhone Development Blog</a> Copyright &copy; 2011 Nick Dalton - <a href="http://iPhoneIncubator.com/blog/portfolio">iPhone Developer</a><br/><br/><a href="http://iPhoneIncubator.com/blog/security/looking-for-a-pci-compliance-testing-consultant-with-iphone-experience">Looking for a PCI Compliance Testing Consultant With iPhone Experience</a></p>
]]></content:encoded>
			<wfw:commentRss>http://iPhoneIncubator.com/blog/security/looking-for-a-pci-compliance-testing-consultant-with-iphone-experience/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Security By Obscurity</title>
		<link>http://iPhoneIncubator.com/blog/security/security-by-obscurity</link>
		<comments>http://iPhoneIncubator.com/blog/security/security-by-obscurity#comments</comments>
		<pubDate>Thu, 12 Feb 2009 19:23:55 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[stringWithFormat]]></category>

		<guid isPermaLink="false">http://iPhoneIncubator.com/blog/?p=91</guid>
		<description><![CDATA[In a previous post I listed a line of code that looked like this:
NSString *credentials = [NSString stringWithFormat:@”%c%s%@%c%c%s%@”, ‘u’, “ser:”, @”pas”, ’s’, ‘w’, “ord”, @”@”];
Reader Matt asked me to expand on this in his comment. (Hint: Don&#8217;t be afraid to suggest topics for this blog.)
The reason for the curious looking line above is to avoid [...]<p>Post from <a href="http://iPhoneIncubator.com/blog">iPhone Development Blog</a> Copyright &copy; 2011 Nick Dalton - <a href="http://iPhoneIncubator.com/blog/portfolio">iPhone Developer</a><br/><br/><a href="http://iPhoneIncubator.com/blog/security/security-by-obscurity">Security By Obscurity</a></p>
]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://iPhoneIncubator.com/blog/security/a-simple-way-to-download-data-from-a-password-protected-web-page">previous post</a> I listed a line of code that looked like this:</p>
<pre name="code" class="c">NSString *credentials = [NSString stringWithFormat:@”%c%s%@%c%c%s%@”, ‘u’, “ser:”, @”pas”, ’s’, ‘w’, “ord”, @”@”];</pre>
<p>Reader Matt asked me to expand on this in his <a href="http://iPhoneIncubator.com/blog/security/a-simple-way-to-download-data-from-a-password-protected-web-page#comment-303">comment</a>. (Hint: Don&#8217;t be afraid to suggest topics for this blog.)</p>
<p>The reason for the curious looking line above is to avoid the whole string to be easily visible in the binary application file. Had I just done this:</p>
<pre name="code" class="c">NSString *credentials = @"user:password";</pre>
<p>it is trivial to search the binary file and find this information in clear text in the file. But by breaking up the string into mixed parts of characters, C strings and Objective-C strings, the content is dispersed in the binary file making it more difficult to find. </p>
<p>Other ways you can obscure strings is to manipulate the string before it&#8217;s used. An easy example is to add 1 to each byte in the string so that &#8220;HAL&#8221; becomes &#8220;IBM&#8221;. Of course you can make that function as complex as you want.</p>
<p>Keep in mind that <a href="http://en.wikipedia.org/wiki/Security_through_obscurity">security by obscurity</a> is simply hiding information, which is very different from employing encryption using a mathematically proven algorithm. While it may take a long time to find a needle in a haystack, it just requires luck or patience. Whereas cracking a good safe is really difficult. When you think about security for your application you need to decide when a haystack is good enough for the information you&#8217;re trying to protect. And when that is the case, feel free to use a variation of the techniques described here.</p>
<p>Post from <a href="http://iPhoneIncubator.com/blog">iPhone Development Blog</a> Copyright &copy; 2011 Nick Dalton - <a href="http://iPhoneIncubator.com/blog/portfolio">iPhone Developer</a><br/><br/><a href="http://iPhoneIncubator.com/blog/security/security-by-obscurity">Security By Obscurity</a></p>
]]></content:encoded>
			<wfw:commentRss>http://iPhoneIncubator.com/blog/security/security-by-obscurity/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A simple way to download data from a password protected web page</title>
		<link>http://iPhoneIncubator.com/blog/security/a-simple-way-to-download-data-from-a-password-protected-web-page</link>
		<comments>http://iPhoneIncubator.com/blog/security/a-simple-way-to-download-data-from-a-password-protected-web-page#comments</comments>
		<pubDate>Tue, 03 Feb 2009 23:02:49 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[NSData]]></category>

		<guid isPermaLink="false">http://iPhoneIncubator.com/blog/?p=87</guid>
		<description><![CDATA[To download a small amount of data from a URL it&#8217;s very convenient to use:
NSData *downloadData = [NSData dataWithContentsOfURL:url];
To get data from a URL that requires authentication there several classes that specifically deal with this, e.g. NSURLAuthenticationChallengeSender and NSURLCredential, which require that you use NSURLConnection instead. 
NSURLConnection has several other advantages such as asynchronous downloading, but if you just want a [...]<p>Post from <a href="http://iPhoneIncubator.com/blog">iPhone Development Blog</a> Copyright &copy; 2011 Nick Dalton - <a href="http://iPhoneIncubator.com/blog/portfolio">iPhone Developer</a><br/><br/><a href="http://iPhoneIncubator.com/blog/security/a-simple-way-to-download-data-from-a-password-protected-web-page">A simple way to download data from a password protected web page</a></p>
]]></description>
			<content:encoded><![CDATA[<p>To download a small amount of data from a URL it&#8217;s very convenient to use:</p>
<pre name="code" class="c">NSData *downloadData = [NSData dataWithContentsOfURL:url];</pre>
<p>To get data from a URL that requires authentication there several classes that specifically deal with this, e.g. NSURLAuthenticationChallengeSender and NSURLCredential, which require that you use NSURLConnection instead. </p>
<p>NSURLConnection has several other advantages such as asynchronous downloading, but if you just want a one-liner, you can still use NSData dataWithContentsOfURL with basic authentication using the following method.</p>
<p>Normally the URL that you pass to dataWithContentsOfURL looks something like https://www.mysite.com/getmydata</p>
<p>You can add a username and password directly in the URL like this https://username:password@www.mysite.com/getmydata and this type of URL works just fine with NSData dataWithContentsOfURL.</p>
<h3>Security Implications</h3>
<ul>
<li>When you include the username and password in the URL, they may be stored in the web server&#8217;s log file.</li>
<li>If you don&#8217;t use SSL, the username and password are sent in clear text.</li>
<li>Don&#8217;t store the URL including the username and password in a property file or plist. These files can easily be viewed by someone looking inside your app bundle.</li>
<li>Don&#8217;t store the credentials like this: NSString *credentials = @&#8221;user:password@&#8221;; This string is very easy to find in the executable file. If your security requirements are low then you can apply some mild obfuscation: NSString *credentials = [NSString stringWithFormat:@"%c%s%@%c%c%s%@", 'u', "ser:", @"pas", 's', 'w', "ord", @"@"]; If you have real security requirements, use real encryption.</li>
</ul>
<p> </p>
<p>Post from <a href="http://iPhoneIncubator.com/blog">iPhone Development Blog</a> Copyright &copy; 2011 Nick Dalton - <a href="http://iPhoneIncubator.com/blog/portfolio">iPhone Developer</a><br/><br/><a href="http://iPhoneIncubator.com/blog/security/a-simple-way-to-download-data-from-a-password-protected-web-page">A simple way to download data from a password protected web page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://iPhoneIncubator.com/blog/security/a-simple-way-to-download-data-from-a-password-protected-web-page/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/4 queries in 0.005 seconds using disk: basic
Object Caching 458/458 objects using disk: basic

Served from: iphoneincubator.com @ 2012-05-17 02:48:49 -->
