<?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>Encryption &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/encryption/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.xojo.com</link>
	<description>Blog about the Xojo programming language and IDE</description>
	<lastBuildDate>Mon, 18 Aug 2025 20:38:25 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Xojo Web Rescues a .NET Project</title>
		<link>https://blog.xojo.com/2024/10/23/xojo-web-rescues-a-net-project/</link>
		
		<dc:creator><![CDATA[Wayne Golding]]></dc:creator>
		<pubDate>Wed, 23 Oct 2024 16:40:14 +0000</pubDate>
				<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Rapid Application Development]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[URLConnection]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13909</guid>

					<description><![CDATA[I had a call recently from a customer whose upstream supplier informed them that they would not be accepting anything less than TLS 1.2 encryption.&#8230;]]></description>
										<content:encoded><![CDATA[
<p>I had a call recently from a customer whose upstream supplier informed them that they would not be accepting anything less than TLS 1.2 encryption. The customer’s application is written using .NET 1.1 (they are testing a new version but aren’t ready to deploy to production just yet). Their supplier insisted on a 1-week time limit. Can I help?</p>



<p>My answer was, of course, “Let me have a look and get back to you.”</p>



<p>I went to my favourite dev tool, Xojo, and went through the process of developing a solution.&nbsp;The connection is a REST API, so I’ll start with a web project and use the HandleURL event. And I’ll use a URLConnection to pass on the request.&nbsp; Wait … could it be that simple?</p>



<pre class="wp-block-code"><code>Function HandleURL(request As WebRequest, response As WebResponse) Handles HandleURL as Boolean

  // Create the outbound connection
  Var connector As New URLConnection
 
  // Copy the content of the request
  connector.SetRequestContent(request.Body, request.MIMEType)

  // Send the request
  Var result As String
  Try
    result = connector.SendSync("POST", kAddress + request.Path)
  Catch err As RuntimeException
    // Catch DNS, Certificate &amp; Timeout errors
    response.Status = 500
    response.Write(err.Message)
    Return True
  End

  // Return the result of the request
  response.Status = connector.HTTPStatusCode
  response.Write(result)

  Return True

End Function</code></pre>



<p>The answer is, &#8220;Yes!&#8221;&nbsp; This is all the code in the entire project.</p>



<p>You will notice that there is no security, but in this instance that is fine as the virtual machine is running this is on the same network as the client server and the firewall is configured to only allow connections from that server.</p>



<p>After processing over 60 thousand requests, memory use is 7.3MB and never exceeded 13MB.&nbsp;CPU usage was at the maximum 1.5%.</p>



<p>Even after using Xojo for 20 years this still blows my mind.</p>



<p><em>Wayne Golding has been a Xojo developer since 2005 and is a Xojo MVP. He operates the IT Company <a href="http://www.axisdirect.nz">Axis Direct Ltd </a>which primarily develops applications using Xojo that integrate with Xero www.xero.com. Wayne’s hobby is robotics where he uses Xojo to build applications for his Raspberry Pi, often implementing IoT for remote control.</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PDFDocument: How To Encrypt PDFs</title>
		<link>https://blog.xojo.com/2022/07/25/pdfdocument-how-to-encrypt-pdfs/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Mon, 25 Jul 2022 13:54:00 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Xojo Cloud]]></category>
		<category><![CDATA[2022r2]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[PDF]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=10486</guid>

					<description><![CDATA[One of the PDFDocument features added in Xojo 2022r2 is the ability to encrypt PDF files created with Xojo. Continue reading and I will show&#8230;]]></description>
										<content:encoded><![CDATA[
<p>One of the PDFDocument features added in Xojo 2022r2 is the ability to encrypt PDF files created with Xojo. Continue reading and I will show you how.</p>



<span id="more-10486"></span>



<p>Encrypting PDF files with PDFDocument is based in the use of the PDFPermissions class. You&#8217;ll need to create a new instance of the class passing along the &#8220;Owner&#8221; and &#8220;User&#8221; passwords. For example:</p>



<pre class="wp-block-code"><code>Var d As New PDFDocument
Var g As Graphics = d.Graphics

Var p As New PDFPermissions("OwnerPassword","UserPassword")</code></pre>



<p>In addition, you can set other properties for the PDFPermissions instance; all of them are read/write and will be applied by the PDF viewer app for when the document is opened using the &#8220;user&#8221; password.</p>



<ul class="wp-block-list"><li><strong>AllowCopyingContents</strong> is set to <code>False</code> by default. When set to <code>True</code> it will allow copying contents from the PDF, as for example the selected text or image.</li><li><strong>AllowModifyingContents</strong> is set to <code>False</code> by default. When set to <code>True</code> it will all to modify the contents of the protected PDF document.</li><li><strong>AllowPrinting</strong> is se to <code>False</code> by default. When it is set to <code>True</code> it will be possible to print the PDF.</li></ul>



<p>Once the PDFPermissions instance has been created and the desired properties had been set, all you need to do is to assign such instance to the Permissions property for the PDFDocument instance you want to encrypt:</p>



<pre class="wp-block-code"><code>d.Permissions = p</code></pre>



<p>Then, when it&#8217;s saving the document to a file, PDFDocument will encrypt all the streams of data containing sensitive information, as it can be the text or Images rendered on every one of the PDF pages plus the metadata information itself. The used encryption algorithm is AES 128 bits.</p>



<p>That&#8217;s all! You can distinguish an encrypted PDF file from an unencrypted one because, usually, the first one will be displayed with the image of a Lock in the icon. When you open an encrypted PDF in the viewer app you&#8217;ll be asked to type a password. If you enter the passord set to the &#8220;Owner&#8221; user, you&#8217;ll be able to do all the kind of operations allowed by the viewer app, while if you enter the &#8220;User&#8221; password, then the kind of options available will be determined by those set using the PDFPermissions properties.</p>



<p><em>Javier Menendez is an engineer at Xojo and has been using Xojo since 1998. He lives in Castellón</em>, <em>Spain and hosts regular Xojo hangouts en español. Ask Javier questions on Twitter at <a href="https://twitter.com/xojoes" target="_blank" rel="noreferrer noopener">@XojoES</a> or on the <a href="https://forum.xojo.com/u/javier_menendez/summary" target="_blank" rel="noreferrer noopener">Xojo Forum</a>.</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Crypto Improvements</title>
		<link>https://blog.xojo.com/2021/11/18/crypto-improvements/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Thu, 18 Nov 2021 12:40:00 +0000</pubDate>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Crypto]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=9589</guid>

					<description><![CDATA[Xojo 2021 Release 3 has a few improvements to the Crypto module that you might find useful such as SHA3, BlowFish/TwoFish and CRC-32.]]></description>
										<content:encoded><![CDATA[
<p>Xojo 2021 Release 3 has a few improvements to the <a href="https://documentation.xojo.com/api/cryptography/crypto.html">Crypto</a> module that you might find useful.</p>



<h3 class="wp-block-heading">SHA3</h3>



<p>A new <a href="https://en.wikipedia.org/wiki/SHA-3">SHA3</a> algorithm is available for use with the Hash function. You can now use SHA3-256 (SHA3 with 256-bit digest) and SHA3-512 (SHA3 with a 512 bit digest) from the <a href="https://documentation.xojo.com/api/cryptography/crypto.html#crypto-hashalgorithms">Crypto.HashAlgorithms</a> enumeration for stronger encryption or compatibility with something else that uses them.</p>



<pre class="wp-block-preformatted">Var hash As String
hash = Crypto.Hash("YourPasswordSentence", Crypto.HashAlgorithms.SHA3_512)</pre>



<h3 class="wp-block-heading">BlowFish / TwoFish</h3>



<p>The BlowFish and TwoFish encryption algorithms can now be used in Xojo. These two algorithms are similar, with <a href="https://en.wikipedia.org/wiki/Blowfish_(cipher)">BlowFish</a> being the original algorithm and <a href="https://en.wikipedia.org/wiki/Twofish">TwoFish</a> being a newer, more secure version that was derived from BlowFish.</p>



<p>You can use them in Xojo with the <a href="https://documentation.xojo.com/api/cryptography/crypto.html#crypto-blowfishencrypt">Crypto.BlowFishEncrypt</a>, <a href="https://documentation.xojo.com/api/cryptography/crypto.html#crypto-blowfishdecrypt">Crypto.BlowFishDecrypt</a>, <a href="https://documentation.xojo.com/api/cryptography/crypto.html#crypto-twofishencrypt">Crypto.TwoFishEncrypt</a> and <a href="https://documentation.xojo.com/api/cryptography/crypto.html#crypto-twofishdecrypt">Crypto.TwoFishDecrypt</a> methods.</p>



<p>You can use either to encrypt data, but in general you&#8217;ll want to avoid BlowFish for your own code, although it might prove useful for compatibility with other libraries or tools.</p>



<h3 class="wp-block-heading">AES</h3>



<p>AES (Advanced Encryption Standard) is also used to encrypt data. You can do this using the <a href="https://documentation.xojo.com/api/cryptography/crypto.html#crypto-aesencrypt">Crypto.AESEncrypt</a> and <a href="https://documentation.xojo.com/api/cryptography/crypto.html#crypto-aesencrypt">Crypto.AESDecrypt</a> methods. Here is a quick sample:</p>



<pre class="wp-block-preformatted">Var encrypted As MemoryBlock

Var dataToEncrypt As MemoryBlock = "Secret!"
Var key As MemoryBlock = Crypto.GenerateRandomBytes(16)
Var initVector As MemoryBlock = Crypto.GenerateRandomBytes(16)
encrypted = Crypto.AESEncrypt(key, dataToEncrypt, Crypto.BlockModes.CBC, initVector)

Var decrypted As MemoryBlock
decrypted = Crypto.AESDecrypt(key, encrypted, Crypto.BlockModes.CBC, initVector)
// decrypted = "Secret!"</pre>



<p></p>



<h3 class="wp-block-heading">CRC-32</h3>



<p>CRC32 is just a simple way to test data integrity and is not cryptographically secure. It still has its uses for fast data comparison and simple hash tables. It can be called like this:</p>



<pre class="wp-block-preformatted">Var crc32 As String
crc32 = Crypto.Hash("StringOrDataToTest", Crypto.HashAlgorithms.CRC32)</pre>



<h3 class="wp-block-heading">RSASign</h3>



<p>RSASign now takes an optional parameter and RSASignModes let you specify the hash to use.</p>



<p>Learn more about the Crypto module in the <a href="https://documentation.xojo.com/api/cryptography/crypto.html">Xojo Documentation</a>.</p>



<p></p>



<p>Updated (Nov 22, 2021): Added AES section</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Code Tip: How to Implement the ARC4 Encryption Algorithm</title>
		<link>https://blog.xojo.com/2020/06/25/code-tip-how-to-implement-the-arc4-encryption-algorithm/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Thu, 25 Jun 2020 10:00:00 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[ARC4]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=7137</guid>

					<description><![CDATA[ARC4 is a symmetric encryption algorithm fast and easy to implement. Being symmetric does means that it uses the same function with the same key (varying from 40 to 2048 bits) both for cyphering and de-cyphering a block of data.]]></description>
										<content:encoded><![CDATA[<p>ARC4 is a symmetric encryption algorithm fast and easy to implement. Being symmetric does means that it uses the same function with the same key (varying from 40 to 2048 bits) both for cyphering and de-cyphering a block of data.</p>
<p>Is it the most secure or robust encryption algorithm around? Not really. But it provides a good amount of performance and you can take further steps in order to correct some of its flaws. So, continue reading if you are interested in having this one in your developer toolset implemented as a Class with separate methods to encrypt and decrypt a block of information (even if it uses the same function in both cases).<span id="more-7137"></span></p>
<p>Add a new Class to your project and name it ARC4. Next, add the three properties needed to implement it:</p>
<ul>
<li><strong>Name:</strong> mBox</li>
<li><strong>Type:</strong> MemoryBlock</li>
<li><strong>Scope:</strong> Private</li>
</ul>
<ul>
<li><strong>Name:</strong> mKeyBlock</li>
<li><strong>Type:</strong> MemoryBlock</li>
<li><strong>Scope:</strong> Private</li>
</ul>
<ul>
<li><strong>Name:</strong> mKeyLength</li>
<li><strong>Type:</strong> Integer</li>
<li><strong>Scope:</strong> Private</li>
</ul>
<p>ARC4 uses a main state box with a length of 256 bytes and the first one will be the one pointed by the <code>mBox</code> property. The second one, <code>mKeyBlock</code>, is declared as a <code>MemoryBlock</code> just to be more efficient in accessing the individual bytes of the provided Key. Lastly, the <code>mKeyLength</code> property is just a convenience property so we can access the original Key length from our Methods.</p>
<p><img fetchpriority="high" decoding="async" class="size-full wp-image-7140 aligncenter" src="https://blog.xojo.com/wp-content/uploads/2020/06/ARC4Demo.png" alt="" width="714" height="706" srcset="https://blog.xojo.com/wp-content/uploads/2020/06/ARC4Demo.png 714w, https://blog.xojo.com/wp-content/uploads/2020/06/ARC4Demo-300x297.png 300w" sizes="(max-width: 714px) 100vw, 714px" /></p>
<p>Now, let&#8217;s add the required Class methods, starting with the <code>Constructor</code>. This one will let the user provide the Key string as part of the instance initialization; so we don&#8217;t need to provide it again every time we want to encrypt or decrypt a new block of data.</p>
<p>With our ARC4 class selected in the Navigator, add a new method and type the following values in the Inspector Panel:</p>
<ul>
<li><strong>Name:</strong> Constructor</li>
<li><strong>Parameters:</strong> Key As String</li>
<li><strong>Scope:</strong> Public</li>
</ul>
<p>Next, type the following snippet of code in the associated Code Editor for the method:</p>
<pre>// If Key is not an empty String
// We call the Key method in order
// to initialize the State box

If Not (key.IsEmpty) Then
  Me.Key = key
Else
  // Empty String, so we raise an exception
  Raise New RuntimeException(kkeynotinitialized,Integer(ARCError.KeyNotInitialized))
End If</pre>
<p>As you can see, the main thing that the Constructor does is call the <code>Key</code> Method; it&#8217;s in charge of initializing the required state box with the provided key. If the key is an empty String, it will raise a Runtime Exception giving a descriptive error message an error number.</p>
<p>Now, let&#8217;s add the Key method to our RC4 class:</p>
<ul>
<li><strong>Name:</strong> Key</li>
<li><strong>Parameters:</strong> Assigns Value As String</li>
<li><strong>Scope:</strong> Public</li>
</ul>
<p>Being a Public method means that you can change the Key String without needing to create a new instance, if that is what you want to do. For example, you may want to initialize the Class instance using a key, encrypt some blocks of data using that one and then change to a different key in order to encrypt other blocks of data. Just remember that you&#8217;ll need to use the same keys in order to reverse to plain data those blocks encrypted with a given key.</p>
<p>In addition, the use of the <code>Assigns</code> keyword is simply syntactic sugar to make it possible to call the method using the equal operator to pass along the required parameter instead of using the regular syntax when calling a method in Xojo code. So, for example, you can use call it using:</p>
<pre>MyRC4Instance.Key = "MySecretKey"</pre>
<p>Instead of:</p>
<pre>MyRC4Instance.Key("MySecretKey")</pre>
<p>This is the code snippet that&#8217;s going to execute this method:</p>
<pre>// Disabling some features for better speed
#Pragma DisableBackgroundTasks
#Pragma DisableBoundsChecking
#Pragma NilObjectChecking False
#Pragma StackOverflowChecking False

// Initialize the index values
Var mFirstIndex As UInt8
Var mSecondIndex As UInt8

// Let's check that this is not an Empty Key String
If Not (value.IsEmpty) Then

  // Trim key length if greater than 256 = max 2048 bits supported by ARC4
  If value.Length &gt; 256 Then value = value.Left(256)

  // Pad the key if it is less than the required min 40 bits (5 bytes)
  // We are going to pad the key repeating the remaining 'n' characters
  // from the begining of the key.
  If value.Length &lt; 5 Then

    Var pad As Integer = 5-value.Length

    value = value + value.Left(pad)

  End If

  // Initialize the State Box if this is the first call to the method.
  // The State box has a maximum of 256 bytes.
  If mBox = Nil Then mBox = New MemoryBlock(256)

  // Just in case there is an older Key in use
  // Let's get rid of the old MemoryBlock storing it
  // And create a new one with the Key lenght (in bytes)
  mKeyBlock = Nil
  mkeyBlock = value
  mKeyLength = value.Length

  // Required initialization of the State Box
  For n As Integer = mFirstIndex To 255
    mBox.UInt8Value(n) = n
  Next

  mFirstIndex = 0

  // Last step on State Box initialization
  // Permutation of values in the State Box
  // using for that the provided Key.

  For n As Integer = mFirstIndex To 255

    mSecondIndex = (mSecondIndex + mBox.UInt8Value(n) + mkeyblock.UInt8Value(n Mod mKeyLength)) Mod 256

    SwapValues(n,mSecondIndex)

  Next

Else

  // If the provided key is an empty String, we raise a new Runtime Exception
  // with a descriptive error message and error number.
  Raise New RuntimeException(kKeyNotInitialized, Integer(ARCError.KeyNotInitialized))
End If</pre>
<p>As you can see, both the Constructor and the Key methods raise a Runtime Exception if the provided Key is an empty string. Both the message and error number are defined as a <code>Constant</code> (the message error) and an <code>Enumerator</code> (Error value) as part of the class itself. So go ahead and add a Constant to the ARC4 class using these values:</p>
<ul>
<li><strong>Constant Name:</strong> kKeyNotInitialized</li>
<li><strong>Default Value:</strong> Key Not Initialized</li>
<li><strong>Type:</strong> String</li>
<li><strong>Scope:</strong> Protected</li>
</ul>
<p>And for the Enumerator:</p>
<ul>
<li><strong>Name:</strong> ARCError</li>
<li><strong>Type:</strong> Integer</li>
<li><strong>Scope:</strong> Public</li>
<li><strong>Value:</strong> KeyNotInitialized = -1</li>
</ul>
<p>In addition, the Key method calls the <code>SwapValues</code> method in order to make the values permutation in the State Box. So add a new method using these values in the Inspector Panel:</p>
<ul>
<li><strong>Method Name:</strong> SwapValues</li>
<li><strong>Parameters:</strong> FirstValue As UInt8, SecondValue As UInt8</li>
<li><strong>Scope:</strong> Private</li>
</ul>
<p>While the code to type in the associated Code Editor will be:</p>
<pre>Var tmp As UInt8

tmp = mBox.UInt8Value(SecondValue)
mBox.UInt8Value(SecondValue) = mBox.UInt8Value(FirstValue)
mBox.UInt8Value(FirstValue) = tmp</pre>
<p>Now just two additional methods left to be added to the class- the ones in charge of encrypting and decrypting a given block of data.</p>
<p>In order to encrypt the data, add a new Method with the following values in the Inspector Panel:</p>
<ul>
<li><strong>Method Name:</strong> Encrypt</li>
<li><strong>Parameters:</strong> Value As String</li>
<li><strong>Return Type:</strong> MemoryBlock</li>
<li><strong>Scope:</strong> Public</li>
</ul>
<p>And with the following block of code in the associated Code Editor:</p>
<pre>// Disabling some features for better speed
#Pragma DisableBackgroundTasks
#Pragma DisableBoundsChecking
#Pragma NilObjectChecking False
#Pragma StackOverflowChecking False

// Index initialization
Var mFirstIndex As Integer
Var mSecondIndex As Integer

Var k As UInt8

// If we have a non initialized mKeyBlock
// that means that the key has not being initialized
// so we raise an exception
If mKeyBlock &lt;&gt; Nil Then

  // Initialize Key again

  me.Key = mKeyBlock.StringValue(0,mKeyBlock.Size)

  // Let's put the text to encrypt into a memoryblock
  // so it is faster to iterate through their bytes
  Var target As MemoryBlock = value
  Var temp As UInt8
  Var maxSize As Integer = target.Size-1

  // And we calculate the new bytes values (encrypted values)
  // using the ARC4 algorithm
  // Basically, every byte in the source block will be XORed
  // with the calculated byte from the State box.
  For n As Integer = 0 To maxSize

    mFirstIndex = (mFirstIndex + 1) Mod 256
    mSecondIndex = (mSecondIndex + mBox.UInt8Value(mFirstIndex)) Mod 256

    SwapValues(mFirstIndex,mSecondIndex)

    k = mBox.UInt8Value((mBox.UInt8Value(mFirstIndex) + mBox.UInt8Value(mSecondIndex)) Mod 256)

    target.UInt8Value(n) = target.UInt8Value(n) Xor k
  Next

  //…and return the block of data already encrypted
  Return target

Else
  Raise New RuntimeException(kKeyNotInitialized, Integer(ARCError.KeyNotInitialized))
End If</pre>
<p>And the last Method, the one in charge of decrypting a block of ARC4 encrypted data:</p>
<ul>
<li><strong>Method Name:</strong> Decrypt</li>
<li><strong>Parameters:</strong> Source As MemoryBlock</li>
<li><strong>Return Type:</strong> MemoryBlock</li>
<li><strong>Scope:</strong> Public</li>
</ul>
<p>Typing the following code fragment in the associated Code Editor:</p>
<pre>If Not (Source Is Nil) Then

  // Simply call the same method we use to
  // encrypt data, avoiding code duplication
  // and returning the now deciphered data to the caller
  Return Me.Encrypt(Source)

End If</pre>
<p>And, that&#8217;s all! If you are interested in more information about the ARC4 algorithm you can <a href="https://en.wikipedia.org/wiki/RC4">read this article on the Wikipedia</a>. Or better yet, read the excellent books &#8220;<a href="https://www.schneier.com/books/applied_cryptography/">Applied Cryptography</a>&#8221; and &#8220;<a href="https://www.schneier.com/books/cryptography_engineering/">Cryptography Engineering</a>&#8221; to dig in even more on this and other cyphering algorithms. Of course, remember that the <a href="https://documentation.xojo.com/api/cryptography/crypto.html">Crypto module</a> included in the Xojo framework has a good bunch of these ready to use!</p>
<p>Of course, you also can download the Xojo example project that includes this Class ready to use <a href="https://www.dropbox.com/s/xvija6zf3ru6t36/ARC4Demo.xojo_binary_project.zip?dl=1">from this link</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>A compromise to security is always just that.</title>
		<link>https://blog.xojo.com/2017/08/28/a-compromise-to-security-is-always-just-that/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Mon, 28 Aug 2017 18:22:02 +0000</pubDate>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Crypto]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Mobile]]></category>
		<guid isPermaLink="false">http://blog.xojo.com/?p=3192</guid>

					<description><![CDATA[Governments debate requiring companies to build "backdoors" into their technology. The problem is that if the government or the company can get in, others will inevitably find a way to exploit that same back door too, making us and our data less safe and secure.]]></description>
										<content:encoded><![CDATA[<p>Last month the Australian government <a href="https://www.macobserver.com/news/australia-attorney-general-apple-encryption-back-door/">suggested</a> they might require tech companies to provide back doors into their systems to help law enforcement use those back doors to catch bad guys. Apple immediately dispatched people to go talk with them about it. Apple&#8217;s stance has been that such back doors don&#8217;t help catch bad guys and just make the rest of us less secure. Is that really true?</p>
<p><span id="more-3192"></span></p>
<p>Systems like Apple&#8217;s iMessage (their text messaging service) use encryption ensuring that all messages sent between Apple devices via iMessage are encrypted with keys that Apple does not have. They keys are on your device. Law enforcement agencies want Apple and others to provide a means of decrypting those messages without having to obtain the device itself. <strong>The problem is that if the government and Apple can get in, others will inevitably find a way to exploit that same back door too, making us and our data less safe and secure.</strong></p>
<p>What some governments have failed to understand is that the bad guys can bypass any back door by using their own encryption. The smart bad guys probably assume that these back doors exist now (or at least aren&#8217;t taking any chances) and are already using their own encryption for their communications. How hard is it to write software to encrypt and decrypt messages? Do bad guys have access to programmers smart enough to do this? Yes, they almost certainly do.</p>
<p>Let&#8217;s take a look at what is involved in using <a href="http://www.xojo.com">Xojo</a> to write an app that encrypts and decrypts messages. First, two keys need to be generated, a public key and a private one. The public key allows anyone to encrypt a message that only the holder of the matching private key can decrypt. Public keys can only encrypt. They are no good for decrypting messages. This means you can give anyone your public key which they can then use to send encrypted messages to you that no one else but you can decrypt.</p>
<pre>Dim privateKey As String
Dim publicKey As String
If Crypto.RSAGenerateKeyPair(KeySize, privateKey, publicKey) Then
 PrivKey.Text = privateKey
 PubKey.Text = publickey
 SaveNewKeys(privateKey, publicKey)
Else
 Beep
 MsgBox "An error has occured. Keys could not be generated."
End If
</pre>
<p>This is just 10 lines of code and it could be further reduced. I wrote this to make it easier to read. The important function is RSAGenerateKeyPair on the third line. Next, you need to be able to encrypt a message using someone else&#8217;s public key. Let&#8217;s take a look at the code to do that:</p>
<pre>Dim publicKey As String = RecipientsPublicKey.Text
Dim msg As MemoryBlock = OriginalMessage.Text
try
 Dim encryptedData As MemoryBlock = Crypto.RSAEncrypt(msg, publicKey)
 beep
 If encryptedData = Nil Then
  MsgBox("Encryption failed.")
 else
  Dim c As New Clipboard
  c.Text = Encodebase64(encryptedData)
  c.close
  MsgBox("Your encrypted message has been copied to the clipboard.")
 End If
Catch rte As RuntimeException
 If rte IsA CryptoException Then
  Beep
  MsgBox "Encryption failed because the Public key provided is not valid."
 Else
  Raise rte
 End If
End Try</pre>
<p>This is 21 lines of code, most of which is handling errors. The one line that is really doing the work is the fourth one that contains RSAEncrypt. Next we need to be be able to decrypt. Here&#8217;s what that code looks like:</p>
<pre>Dim privateKey As String = privKey.Text
try
 Dim decryptedData As MemoryBlock = Crypto.RSADecrypt(DecodeBase64(EncryptedMessage.Text), privateKey)
 Decryptedmessage.Text = DefineEncoding(decryptedData.StringValue(0, decryptedData.size), Encodings.UTF8)
Catch rte As RuntimeException
 If rte IsA CryptoException Then
 Beep
 MsgBox "The message could not be decrypted because the incorrect key was provided."
 Else
 Raise rte
 End If
End Try</pre>
<p>This is 12 lines of code and like the other code examples, is mostly error checking. The important line is the third one that calls RSADecrypt. There is some additional code to save the keys to a text file and load them back in automatically when the app is launched. However, even adding in all that code gets you to only about 80 lines total. <strong>In other words, this is not a big app and not beyond the ability of someone with intermediate programming skills or even perhaps a very dedicated novice.</strong> (To learn about this in more depth, read <a href="http://blog.xojo.com/2014/02/05/using-publicprivate-key-encryption-in-xojo/">Using Public/Private Key Encryption in Xojo</a>).</p>
<p>If you&#8217;d like to try out encrypting messages with the app from which the code above originated, you can download <a href="http://blog.xojo.com/wp-content/uploads/2017/08/CryptoMessage-Mac.zip">CryptoMessage for macOS</a>, <a href="http://blog.xojo.com/wp-content/uploads/2017/08/CryptoMessage-Windows.zip">CryptoMessage for Windows</a> or <a href="http://blog.xojo.com/wp-content/uploads/2017/08/CryptoMessage-Linux.zip">CryptoMessage for Linux</a>. Have a friend do it as well and you can send encrypted messages back and forth. If you&#8217;re more adventurous and would like to try playing around with the source code itself, make sure you have <a href="http://www.xojo.com">Xojo</a> installed (which can be <a href="http://www.xojo.com/download">downloaded</a> and used for free) then download the <a href="http://blog.xojo.com/wp-content/uploads/2017/08/CryptoMessage.zip">CryptoMessage Xojo Project</a>.</p>
<p>Xojo has a <a href="http://developer.xojo.com/xojo-crypto">crypto library</a> (the part that provides key generation, encryption and decryption) built-in to it. However, if a programmer wasn&#8217;t using Xojo, they could easily find a crypto library on the Internet to use. In other words, building your own app to encrypt and decrypt messages is not very challenging. As I mentioned earlier, the bad guys (at least the smart ones) are likely already doing this as they are probably sufficiently paranoid that despite public announcements to the contrary, the back doors already exist.</p>
<p><strong>The assumption that compromising our security enables catching more bad guys is a flawed one that I have <a href="http://blog.xojo.com/2016/01/27/smartphone-encryption-is-a-red-herring/">written about</a> <a href="http://blog.xojo.com/2016/02/04/if-smartphone-encryption-is-a-red-herring-how-do-we-track-the-bad-guys/">before</a>.</strong> It won&#8217;t work and we will all suffer needlessly. Imagine not being able to carry on a private conversation via your smartphone. That would make your device feel <strong>a lot</strong> less useful. Some governments have &#8220;experts&#8221; that have suggested it would be possible to have a back door Law Enforcement could use but could not be compromised by anyone else. That is a logical impossibility. Governments do not possess magic powers. They are made of up people like you and me. That is wishful thinking at best and negligent at worse.</p>
<p>When your government starts making noises about doing this, I advise you to make it clear to them that for the reasons I have stated in this post, such a compromising security is all downside with no upside at all.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>If Smartphone Encryption Is A Red Herring, How Do We Track The Bad Guys?</title>
		<link>https://blog.xojo.com/2016/02/04/if-smartphone-encryption-is-a-red-herring-how-do-we-track-the-bad-guys/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Thu, 04 Feb 2016 00:00:00 +0000</pubDate>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Crypto]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Mobile]]></category>
		<guid isPermaLink="false">http://blogtemp.xojo.com/2016/02/04/if-smartphone-encryption-is-a-red-herring-how-do-we-track-the-bad-guys/</guid>

					<description><![CDATA[Smartphone Encryption is a Red Herring, but the Good Guys have other options. We don't need universal back doors.]]></description>
										<content:encoded><![CDATA[<p>In the blog post <a href="http://blog.xojo.com/2016/01/27/smartphone-encryption-is-a-red-herring/">Smartphone Encryption is a Red Herring</a>, I pointed out the folly of requiring an encryption back door for the Good Guys to use. So the question arises- &#8220;What <em>can</em> be done? If we don&#8217;t want a global encryption back door that can be used by anyone, can we still track the Bad Guys?&#8221;</p>
<p>The answer is yes. There are plenty of options that don&#8217;t require a global back door. I&#8217;m not passing judgment on whether these are inherently good or bad options, just that they are available when there is a reason to track a Bad Guy.<br />
<span id="more-285"></span></p>
<p><strong>Keyloggers</strong><br />
A <a href="https://en.wikipedia.org/wiki/Keystroke_logging" target="_blank" rel="noopener">keylogger</a> is used to track everything someone types. They come in both software and hardware varieties. Once installed, they can provide regular data about passwords and other communications the Bad Guy is making. Some store the data for later retrieval, while others broadcast it on a regular basis. They exist in varieties for both computers and cell phones.</p>
<p><img decoding="async" style="display: block; margin-left: auto; margin-right: auto;" title="keyboard.png" src="https://blog.xojo.com/wp-content/uploads/2016/02/keyboard.pngt1466486449161ampwidth424ampheight322" sizes="(max-width: 424px) 100vw, 424px" alt="keyboard.png" width="424" height="322" /><br />
<strong>Online Man in the Middle</strong><br />
With proper authorization, the Good Guys <a href="https://en.wikipedia.org/wiki/Man-in-the-middle_attack" target="_blank" rel="noopener">can stand between</a> the Bad Guys and common online services they might be using. Working with their internet provider, they can gather data similar to keyloggers by intercepting and relaying data back and forth.</p>
<p><strong>Digital Evidence Collection</strong><br />
When a warrant is served and computers or mobile devices are retrieved for analysis, gathering evidence quickly is paramount. The Bad Guys may have countermeasures installed on their devices, so being able to copy data from hard drives and other storage mediums across platforms while they are still online is important. Once images of the data are created, the evidence can be safely analyzed without being concerned about time bombs or other countermeasures. Xojo has been used to create tools that are used for both digital evidence collection and analysis. Being a cross platform tool is a particular advantage in this scenario.</p>
<p>None of the above options require a global back door, and they can all be limited to just the Bad Guys in question when surveillance is warranted. A <a href="https://www.onthewire.io/harvard-study-questions-going-dark-crypto-problem/" target="_blank" rel="noopener">recently released Harvard study</a> has similar findings. Some options are better than others depending on the region in the world and the technical prowess of the Bad Guys. <a href="../../../com/xojo/blog/smartphone-encryption-is-a-red-herring.html" target="_blank" rel="noopener">Smartphone Encryption is a Red Herring</a>, but the Good Guys have other options. We don&#8217;t need universal back doors.</p>
<p>&nbsp;</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Smartphone Encryption is a Red Herring</title>
		<link>https://blog.xojo.com/2016/01/27/smartphone-encryption-is-a-red-herring/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Wed, 27 Jan 2016 00:00:00 +0000</pubDate>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Crypto]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Mobile]]></category>
		<guid isPermaLink="false">http://blogtemp.xojo.com/2016/01/27/smartphone-encryption-is-a-red-herring/</guid>

					<description><![CDATA[Encryption Red Herring: Proposed AES encryption backdoor will not work but will create an exponentially greater problem for everyone but the bad guys.]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" style="width: 320px; margin: 0px 10px 10px 0px; float: left;" title="EnigmaMachine.png" src="https://blog.xojo.com/wp-content/uploads/2016/01/EnigmaMachine.pngt1466486449161ampwidth320" sizes="(max-width: 320px) 100vw, 320px" alt="EnigmaMachine.png" width="320" data-constrained="true" />As the Founder and CEO of a <a href="https://xojo.com/" target="_blank" rel="noopener">software company</a> that makes a development tool for mobile platforms, as well as for desktop and web, I have a lot of experience with encryption. The current controversy over encryption is really important to me. During World War II, the Germans created a way of sending encrypted messages to commanders in the field. The device came to be known as an <a href="https://en.wikipedia.org/wiki/Enigma_machine" target="_blank" rel="noopener">Engima machine</a>. It looked like a typewriter but had an encryption key that changed a message into unreadable noise. That message could only be decoded if you knew the key used to encrypt it. The Allies worked very hard to get their hands on one of these devices so they could learn how it works and be able to decrypt the messages and know what the German military plans. Ultimately the Allies figured it out and it helped them win the war. If this has peaked your curiosity, check out the movie <a href="http://www.imdb.com/title/tt0141926/?ref_=nv_sr_1" target="_blank" rel="noopener">U-571</a> (a fictional account of the effort to obtain an Enigma machine) and <a href="http://www.imdb.com/title/tt2084970/" target="_blank" rel="noopener">The Imitation Game</a> about the team that figured out the encryption key.</p>
<p><span id="more-319"></span></p>
<p>Today, terrorists are using encryption to hide their communications just like the Nazis did in WWII. What makes encryption different today is that it is also being used by millions of ordinary people, many of whom have no idea they are even using it. Almost every smartphone in use today, encrypts text messages and other data automatically. This is all done behind the scenes without the user ever being aware of it.</p>
<p style="text-align: left;">The type of encryption used on the iPhone and Android is called <a href="https://en.wikipedia.org/wiki/Advanced_Encryption_Standard" target="_blank" rel="noopener">AES</a> and it&#8217;s formidable. Intercepting your text messages isn&#8217;t actually difficult but decrypting those messages is, at best, impractical. To decrypt a message, just like with the Enigma machine, you need to know the key that was used to encrypt it. If you don&#8217;t have that key, you&#8217;d have to guess at what the key might be then look at the results of decrypting the message with that key to see if you have anything but unintelligible gibberish. Even with access to the fastest computers in the world, it could literally take years to guess the right key. It will come as no surprise that governments at almost every level don&#8217;t like this one bit. At their most transparent, they are used to getting a search warrant and being able to look at whatever you&#8217;ve got to see if it supports their suspicion that you are in fact up to no good. At their least, they wish to get on your phone (ideally from a secure, remote location) and take your data without a warrant or you having any idea they were ever there. The problem for governments is that they can&#8217;t. In Apple&#8217;s case, even if Apple was willing to compile with a request that they decrypt the data on your phone, they can&#8217;t. The key is stored on your phone in a way that even Apple can&#8217;t get to it. In this sense, Apple is in complete alignment with you in terms of your privacy.</p>
<p><img decoding="async" style="display: block; margin-left: auto; margin-right: auto;" title="red_herring.png" src="https://blog.xojo.com/wp-content/uploads/2016/01/red_herring.pngt1466486449161ampwidth321ampheight225" sizes="(max-width: 321px) 100vw, 321px" alt="red_herring.png" width="321" height="225" /></p>
<p>There are lawmakers here in the United States that want to force companies like Apple and Google to provide a <em>back door</em>. This would be a way for Apple to get into your data should a search warrant (presumably) be issued. Apple&#8217;s CEO Tim Cook as <a href="http://www.theguardian.com/technology/2016/jan/13/apple-tim-cook-us-government-encryption" target="_blank" rel="noopener">pointed out</a> what a <a href="http://techcrunch.com/2015/06/02/apples-tim-cook-delivers-blistering-speech-on-encryption-privacy/" target="_blank" rel="noopener">bad idea</a> this is. <strong>Back doors don&#8217;t get used by just the good guys.</strong> They will get used by the bad guys as well. In an effort to make it possible for law enforcement to get at the data of the tiny percentage of the population that is doing wrong, we would be opening everyone up to being hacked remotely. It&#8217;s not possible to make a back door that only the good guys can use. Think about your contacts, text messages, email, photos, all being exposed. Just the increased level of extortion alone would be so bad that your smartphone would go back to being useful as nothing more than a phone. Do any of you really want to go back to the 1980s?</p>
<p>What is worse than that, however, is <strong>what is not being talked about in the news</strong>. Smartphone encryption is a <a href="https://en.wikipedia.org/wiki/Red_herring" target="_blank" rel="noopener">red herring</a>. A back door wouldn&#8217;t solve the problem. Bad guys would simply write their own apps to encrypt the data themselves before they send it. This is incredibly easy to do. <a href="http://www.xojo.com" target="_blank" rel="noopener">Xojo</a>, the development tool my company created, has this same type of AES encryption built-in. Many other development tools have it as well. I could write an app to encrypt a message in a few minutes. Even if you have never written a line of code in your life, after a few hours learning Xojo, you could write the same app yourself. <strong>If you or I can do it, the bad guys can too.</strong> The smartest of them are almost certainly <em>already</em> doing this today. The end result would be that every law-abiding citizen&#8217;s personal and private data would become hackable- causing a digital tsunami of cybercrime that would be impossible for law enforcement to stop while achieving next to nothing towards actual security.</p>
<p><img decoding="async" style="width: 320px; margin: 10px auto; display: block;" title="edited_lock_and_code.png" src="https://blog.xojo.com/wp-content/uploads/2016/01/edited_lock_and_code.pngt1466486449161ampwidth320" sizes="(max-width: 320px) 100vw, 320px" alt="edited_lock_and_code.png" width="320" data-constrained="true" />I understand why our lawmakers and law enforcement are concerned about encryption. It is a barrier to evidence for them. Tim Cook has argued that we have to balance law enforcement with our personal privacy. That&#8217;s certainly true. However, in this case, you don&#8217;t even have to go that far. <strong>What our elected officials are proposing will not work and will only create an exponentially greater problem.</strong> You may be asking yourself, &#8220;Surely they have thought of this, right?&#8221; Clearly they haven&#8217;t. Too often people make decisions without complete information or having taken sufficient time to to think the matter through. We have all seen this many times in our lives. Smartphone encryption is just the latest example. It&#8217;s not the first and won&#8217;t be the last. I&#8217;m all for looking for better ways to catch the bad guys but smartphone back doors <strong>will not work</strong>. Your elected officials are wasting your precious taxpayer dollars. If you want to stop this, contact them and ask them to better educate themselves on this topic. You can point them to this blog post to start. I can&#8217;t speak for countries outside the United States, but here elected officials give considerable weight to their constituents that reach out to them. You can contact your Representatives in the House <a href="http://www.house.gov/representatives/" target="_blank" rel="noopener">here</a> and your Senators <a href="http://www.senate.gov/senators/contact/" target="_blank" rel="noopener">here</a>.</p>
<p>Lastly, while I am proud of Tim Cook for fighting back on this issue, it saddens me that he appears alone on the world stage while doing this. Powerful people in technology such as Mark Zukerberg of Facebook, Larry Page and Sergey Brin of Google, Satya Nadella of Microsoft and others should be taking an equal stand. They are in an even better position than we are as individuals to make it clear that the proposed solution won&#8217;t work. Until then, contact your elected officials and tell them that dog won&#8217;t hunt.</p>
<p style="text-align: center;"><span id="hs-cta-wrapper-2f9a74a4-35c0-4f3d-b3d0-101223008c8b" class="hs-cta-wrapper"><span id="hs-cta-2f9a74a4-35c0-4f3d-b3d0-101223008c8b" class="hs-cta-node hs-cta-2f9a74a4-35c0-4f3d-b3d0-101223008c8b"> <!-- [if lte IE 8]></p>





<div id="hs-cta-ie-element"></div>


<![endif]--> <a href="http://blog.xojo.com/2016/02/04/if-smartphone-encryption-is-a-red-herring-how-do-we-track-the-bad-guys/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" id="hs-cta-img-2f9a74a4-35c0-4f3d-b3d0-101223008c8b" class="hs-cta-img aligncenter" style="border-width: 0px;" src="https://blog.xojo.com/wp-content/uploads/2013/08/2f9a74a4-35c0-4f3d-b3d0-101223008c8b.png" alt="Security: How to Track The Bad Guys" width="384" height="64" /></a></span></span><br />
<!-- end HubSpot Call-to-Action Code --></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
