<?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>Security &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/security/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.xojo.com</link>
	<description>Blog about the Xojo programming language and IDE</description>
	<lastBuildDate>Tue, 02 Aug 2022 21:14:52 +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>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>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>App Transport Security on macOS</title>
		<link>https://blog.xojo.com/2018/12/14/app-transport-security-on-macos/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Fri, 14 Dec 2018 16:17:26 +0000</pubDate>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=5249</guid>

					<description><![CDATA[With Xojo 2018 Release 4, we updated the macOS SDK to 10.14. This means that App Transport Security is now something you need to be aware of for your Mac apps.]]></description>
										<content:encoded><![CDATA[<p>With Xojo 2018 Release 4, we updated the macOS SDK to 10.14. This means that <a href="http://documentation.xojo.com/topics/communication/internet/using_non-secure_urls_on_macos_and_ios.html">App Transport Security</a> is now something you need to be aware of for your Mac apps.</p>
<p><span id="more-5249"></span></p>
<p>From <a href="https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33">Apple’s docs</a>:</p>
<blockquote><p>Starting in iOS 9.0 and OS X v10.11, a new security feature called App Transport Security (ATS) is available to apps and is enabled by default. It improves the privacy and data integrity of connections between an app and web services by enforcing additional security requirements for HTTP-based networking requests. Specifically, with ATS enabled, HTTP connections must use HTTPS (RFC 2818). Attempts to connect using insecure HTTP fail. Furthermore, HTTPS requests must use best practices for secure communications.</p></blockquote>
<p>I first talked about <a href="https://blog.xojo.com/2016/07/27/app-transport-security-for-ios/">App Transport Security when it started affecting iOS</a>. Starting with Xojo 2018 Release 4, this change matters to your Mac apps because Xojo is now using the updated Mac libraries that have this requirement. Simply stated, it means that if your Mac apps use <a href="http://documentation.xojo.com/api/networking/urlconnection.html">URLConnection</a>, <a href="http://documentation.xojo.com/api/deprecated/xojo.net.httpsocket.html">Xojo.Net.HTTPSocket</a>, <a href="http://documentation.xojo.com/api/deprecated/httpsocket.html">HTTPSocket</a> (now deprecated), <a href="http://documentation.xojo.com/api/deprecated/httpsecuresocket.html">HTTPSecureSocket</a> or <a href="http://documentation.xojo.com/api/deprecated/htmlviewer.html">HTMLViewer</a>, then your URLs have to be secure and use https. If they are not secure, you will either get an error returned or no page displayed.</p>
<p>If you are relying on other services or URLs that do not yet support https, then what do you do? Apple has provided a workaround: you have to specify an exemption in your plist file. In the plist you identify specific URLs for which you want to allow unsecured connections. To do this, create a text file called Info.plist, add this content to it and drag the file to the Navigator to add it to your project:</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
  &lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
  &lt;dict&gt;
    &lt;key&gt;NSExceptionDomains&lt;/key&gt;
    &lt;dict&gt;
      &lt;key&gt;firstsite.com&lt;/key&gt;
      &lt;dict&gt;
        &lt;key&gt;NSIncludesSubdomains&lt;/key&gt;
        &lt;true/&gt;
        &lt;key&gt;NSTemporaryExceptionAllowsInsecureHTTPLoads&lt;/key&gt;
        &lt;true/&gt;
      &lt;/dict&gt;
      &lt;key&gt;secondsite.com&lt;/key&gt;
      &lt;dict&gt;
        &lt;key&gt;NSIncludesSubdomains&lt;/key&gt;
        &lt;true/&gt;
        &lt;key&gt;NSTemporaryExceptionAllowsInsecureHTTPLoads&lt;/key&gt;
        &lt;true/&gt;
      &lt;/dict&gt;
    &lt;/dict&gt;
  &lt;/dict&gt;
&lt;/dict&gt;
&lt;/plist&gt;</pre>
<p>Replace the domain names (or add more) based on your needs. You can also allow all unsecured connections, but Apple may reject App Store submissions that use this without valid reasons:</p>
<pre>&lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
&lt;dict&gt;
  &lt;!-- Include to allow all connections; avoid if possible --&gt;
  &lt;key&gt;NSAllowsArbitraryLoads&lt;/key&gt;
  &lt;true/&gt;
&lt;/dict&gt;</pre>
<p>Keep in mind that Apple may reject your App Store submission if you allow arbitrary URLs without a good reason.</p>
<p>For additional information, refer to the <a href="https://documentation.xojo.com/topics/application_structure/ios/using_a_plist.html#using-a-plist">Using a plist</a>, <a href="http://documentation.xojo.com/api/networking/urlconnection.html">URLConnection</a>, <a href="http://documentation.xojo.com/api/deprecated/xojo.net.httpsocket.html">Xojo.Net.HTTPSocket</a> and <a href="http://developer.xojo.com/ioshtmlviewer">HTMLViewer</a> pages in the Docs.</p>
<p>Need easy server hosting with 1-click SSL support so you can avoid App Transport Security? Be sure to check out <a href="https://www.xojo.com/cloud/">Xojo Cloud</a>!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>#JustCode Challenge Week 2 &#8211; Password Generator</title>
		<link>https://blog.xojo.com/2018/06/29/just-code-challenge-week2/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Fri, 29 Jun 2018 01:00:53 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[#JustCode]]></category>
		<category><![CDATA[Challenge]]></category>
		<category><![CDATA[Passwords]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=4364</guid>

					<description><![CDATA[#JustCode Challenge Week 2! This week I took inspiration from a feature in 1Password that can generate a password suggestion. This desktop app allows you to specify a desired password length and the number of digits and symbols to include in it.]]></description>
										<content:encoded><![CDATA[<p>In week 2 of the <a href="https://blog.xojo.com/2018/06/18/jump-right-in-just-code-challenge/">Just Code challenge</a> I took inspiration from a feature in <a href="https://1password.com">1Password</a> that can generate a password suggestion. This desktop app allows you to specify a desired password length and the number of digits and symbols to include in it.</p>
<p><span id="more-4364"></span></p>
<p><img decoding="async" class="size-full wp-image-4367 aligncenter" src="https://blog.xojo.com/wp-content/uploads/2018/06/2018-06-06_12-25-22.png" alt="" width="366" height="259" /></p>
<p>Here is the Window layout in the Xojo IDE:</p>
<p><img decoding="async" class="alignnone size-full wp-image-4369" src="https://blog.xojo.com/wp-content/uploads/2018/06/2018-06-06_11-53-55.png" alt="" width="1159" height="694" /></p>
<p>I&#8217;m using a read-only <a href="http://developer.xojo.com/textfield">TextField</a> to display the generated password. There are a couple <a href="http://developer.xojo.com/pushbutton">PushButtons</a> for copying the password text to the clipboard and for generating a new password. I use Slider controls to set the length of the password and the number of digits and symbols to include, along with corresponding labels.</p>
<p>When the window opens, it populates some arrays with the acceptable characters that can be used for letters, digits and symbols. In particular, some characters are excluded such as &#8220;O&#8221;, &#8220;o&#8221;, &#8220;0&#8221; and quotes because those are difficult to distinguish. The code to do this is in the Open event:</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4370" src="https://blog.xojo.com/wp-content/uploads/2018/06/2018-06-06_13-29-50.png" alt="" width="853" height="785" /></p>
<p>The last line calls the GeneratePassword method which uses the settings from the user interface to generate a password. This way you&#8217;ll have a password displayed immediately when the window appears.</p>
<p>The GeneratePassword method first determines how many digits are needed, making sure it does not exceed the requested password length. Then it adds any symbols, also ensuring it does not exceed the set length. Lastly, if more characters are needed it adds letters to reach the desired length.</p>
<p>The characters are added to a String array that is then shuffled to mix all the parts together. Try commenting the Shuffle line out and when you run the project you&#8217;ll see that numbers always appear first, followed by symbols and then the letters. Here is the GeneratePassword code:</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4371" src="https://blog.xojo.com/wp-content/uploads/2018/06/2018-06-06_13-30-49.png" alt="" width="853" height="785" /></p>
<p>A similar technique is used by the RandomDigit, RandomLetter and RandomSymbol. It uses the Shuffle method to randomize the appropriate array and then returns the first item.</p>
<p><a href="http://files.xojo.com/JustCode/PasswordGenerator.zip">Download the Password Generator project file</a>.</p>
<p>Download and check out earlier projects:</p>
<p>Week 1: <a href="https://blog.xojo.com/2018/06/22/just-code-challenge-week1/">Color Picker Desktop App</a></p>
<p>Discuss your Week 2 project in the Xojo forum:</p>
<p><a href="https://forum.xojo.com/48550-just-code-challenge-week-2-projects">Just Code Challenge Week 2 Projects</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Avoiding False-Positive Virus Detection in Windows Apps</title>
		<link>https://blog.xojo.com/2018/01/29/avoiding-false-positive-virus-detection-in-your-windows-apps/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Mon, 29 Jan 2018 18:10:37 +0000</pubDate>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[64-bit]]></category>
		<category><![CDATA[Anti-Virus]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[LLVM]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=3853</guid>

					<description><![CDATA[Anti-virus software can be a bit over-zealous about detecting what it believes to be apps that have viruses embedded within them. We have had reports over the years that apps made with Xojo are sometimes falsely identified as being infected with a virus. If you're having problems with such false positives, recompiling your apps for 64-bit may solve the problem. Doing this is not a 100% guarantee but it can reduce the chances of a false-positive occurring.]]></description>
										<content:encoded><![CDATA[<p>Viruses continue to be a big problem on Windows. As a result, anti-virus software can be a bit over-zealous about detecting what it believes to be apps that have viruses embedded within them. We have had reports over the years that apps made with Xojo are sometimes falsely identified as being infected with a virus. This sometimes occurs because the 32-bit Xojo compiler puts executable code in a location where the anti-virus software doesn&#8217;t expect to find it. We&#8217;ve seen this occur even when users are debugging apps from the IDE. Fortunately in that case, there&#8217;s a <a href="https://blog.xojo.com/2015/06/11/norton-internet-security-and-xojo/">fairly easy solution</a>.</p>
<p><span id="more-3853"></span></p>
<p>With the <a href="https://blog.xojo.com/2017/12/04/llvm-everywhere/">move to LLVM</a> as the backend of our compiler, the format of our Windows executables changed somewhat. LLVM puts the executable code in a different location that doesn&#8217;t set off those same flags for anti-virus software. If you&#8217;re having problems with such false positives, recompiling your apps for 64-bit may solve the problem. Doing this is not a 100% guarantee but it can reduce the chances of a false-positive occurring.</p>
<p>This is even more true if you are using console-based helper apps especially if you&#8217;re launching multiple instances of them. Despite this being a known and often-used technique for taking advantage of multiple cores (and one we <a href="https://blog.xojo.com/2018/01/25/supporting-multiple-cores/">wrote about</a> recently), it can make anti-virus software more suspicious. If your helper app has code that the anti-virus software thinks is in the wrong place, recompiling it for 64-bit may help.</p>
<p>Having said all of this, false is still false. If your apps (compiled for 32-bit or 64-bit) are falsely identified as having a virus, contact the anti-virus software company so they can update their software. Many have established protocols for reporting false positives.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Xojo Cloud Lowers the Price of Security and Convenience</title>
		<link>https://blog.xojo.com/2014/03/12/xojo-cloud-lowers-the-price-of-security-and-convenience/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 12 Mar 2014 00:00:00 +0000</pubDate>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Xojo Cloud]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[MySQL]]></category>
		<guid isPermaLink="false">http://blogtemp.xojo.com/2014/03/12/xojo-cloud-lowers-the-price-of-security-and-convenience/</guid>

					<description><![CDATA[Xojo Cloud Lowers the Price of Security and Convenience]]></description>
										<content:encoded><![CDATA[<p>Xojo Cloud is now available with plans starting at just $49 per month for a fully managed and secure cloud server for running your Xojo web apps. What does this mean for your web apps?</p>
<p><span id="more-106"></span></p>
<p>Without Xojo Cloud, you have to manage a Linux server to host your Xojo web apps. Have you ever managed a Linux server? If not, perhaps you have no idea how difficult it can be.</p>
<p>Here are just <em>some</em> of the things you&#8217;ll have to worry about when you have to manage a Linux server with other hosting services.</p>
<h2>Keeping your chosen version of Linux up-to-date</h2>
<p>This is a lot harder than it sounds. Linux distributions are updated often to fix bugs and security holes.</p>
<p>I&#8217;ve had a Linux virtual private server (VPS) for several years that I have used to run a few web sites and the occassional Xojo web app. It turns out that my version of Debian Linux is getting a bit old and I need to upgrade it. But my hosting company does not make this easy. The control panel I am using no longer supports Debian and my hosting company only offers it with Ubuntu. There is no way for me to fix this myself as I cannot just create a new VPS container using Ubuntu while retaining my existing files. Instead I have to back up everything, get a new VPS created with Ubuntu and then manually set everything back up. This is going to take a tremendous amount of time, so I&#8217;m actually working on moving my stuff away from the VPS. I no longer want to spend my valuable time managing my own Linux server. <a href="http://en.memory-alpha.org/wiki/I'm_a_doctor,_not_a...">I&#8217;m a programmer, not a Linux system administrator</a>.</p>
<p>With Xojo Cloud, we keep Linux updated for you.</p>
<h2>32-bit Libraries</h2>
<p>To run Xojo apps on your server, you&#8217;ll need either a 32-bit version of Linux or you&#8217;ll have to install the 32-bit compatibility libraries needed by Xojo apps. Few hosting companies offer 32-bit Linux distributions. For 64-bit distributions, finding and installing these libraries can be easy with some distributions and rather difficult with others. Regardless, you better be comfortable with the Terminal, SSH, apt-get, yum and other Linux tools and commands.</p>
<p>With Xojo Cloud, we ensure the proper libraries are installed so your Xojo apps runs smoothly.</p>
<h2>Firewall Management</h2>
<p>Are you familiar with <a href="http://en.wikipedia.org/wiki/Iptables">iptables</a>? You&#8217;ll need to learn how to use it to manage your firewall so that your server is not open to attacks if you leave the wrong port open.</p>
<p>Xojo Cloud has an smart, adaptive firewall that watches the traffic coming in to your Xojo Cloud server and looks for the patterns that indicate a hacker. It can then lock the hacker out before they get in.</p>
<h2>Secure Uploads</h2>
<p>How are you going to get files to your web server? FTP is the most common answer, but it&#8217;s not secure. You&#8217;ll want to ensure you configure <a href="http://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol">SFTP</a> so that you can securely transfer files. Uploading is also an extra step when building and deploying your Xojo apps. You&#8217;ll have to do a the build and then use your FTP client to transfer the build over to the server. Although before you do that, make sure to head over to the server to stop (or quit) your web app if it is already running.</p>
<p>With Xojo Cloud, you can securely upload your web apps right from Xojo itself with one click. Or you can use the built-in SFTP server to upload files yourself.</p>
<h2>Permissions</h2>
<p>Once you have your web app (and any related files) uploaded, you&#8217;ll need to make sure that the permissions are set correctly. Often, the permissions set by an SFTP upload do not match the permissions needed by Apache to access and execute files. You&#8217;ll need to become quite intimate with the Terminal and the chown and chmod commands.</p>
<p>Your app permissions are set for you automatically when you upload directly from Xojo to Xojo Cloud.</p>
<h2>Apache</h2>
<p>Configuring the <a href="http://httpd.apache.org">Apache</a> web server can get pretty complex. There are <a href="http://www.apachebookstore.com/confluence/oss/display/BOOKS/Books+on+Apache+HTTP+Server+%28httpd%29">lots of books</a> written about it, but it might take some time to get through them all. Xojo web apps use <a href="http://en.wikipedia.org/wiki/Common_Gateway_Interface">CGI</a> in conjunction with <a href="http://en.wikipedia.org/wiki/Perl">Perl</a> to communicate with Apache, neither of which may be enabled by default.</p>
<p>With Xojo Cloud this is all automatically enabled and properly configured for you.</p>
<h2>SSL Certificates</h2>
<p>Does your host provide an easy way for you to add an <a href="http://en.wikipedia.org/wiki/SSL_certificate">SSL certificate</a> to your web site? You absolutely need this is your web app has a login page, otherwise all data, including user IDs and passwords, are sent in plain text.</p>
<p>Xojo Cloud has a simple wizard to walk you through the processing of obtaining an SSL Certificate and installing it.</p>
<h2>Database Support</h2>
<p>Hosting services sometimes have MySQL available as an option. But few offer PostgreSQL, a more powerful open-source database. And most hosting companies do not provide a way for you to access the DB from outside a web app running on the server.</p>
<p>With Xojo Cloud you can easily enable MySQL or PostgreSQL. Plus you can also turn on an SSH tunnel so you can connect to the DB from outside the server to use your favorite admin tools or even connect from a desktop app. You can even easily create a <a href="http://developer.xojo.com/eddies-electronics-web-service">Xojo Cloud web app that acts as a web service</a> to a DB so that you can easily connect from any type of app, even iOS.</p>
<h2>TL;DR: Why Xojo Cloud?</h2>
<p>We don&#8217;t want you to have to worry about any of the above, which is why we created Xojo Cloud: security and convenience. It goes without saying that you&#8217;ve heard a story of some major company or web service having its data compromised. We take security seriously and want you to as well. Security is complex, but Xojo Cloud makes it easy for you to have a secure server with very little effort on your part.</p>
<p><span style="line-height: 1.62;">We use a Xojo-optimized version of <a href="http://wiki.centos.org/HowTos/SELinux">Security Enhanced Linux</a> (SELinux), which is based on CentOS. You don&#8217;t have to worry about keeping it up-to-date and you don&#8217;t have to worry about installing libraries needed by Xojo.</span></p>
<p><span style="line-height: 1.62;">The Xojo Cloud firewall is an impressive piece of engineering. The firewall watches the traffic and uses heuristics to try to determine potential denial-of-service and other hacking attempts. Not to mention the additional layers of intrusion detection and file change detection.</span></p>
<p><span style="line-height: 1.62;">Since Xojo Cloud is integrated with Xojo itself, you get fast, easy and secure uploads of your web applications and associated files. The permissions are set for you automatically. This is all done by simply clicking the &#8220;Deploy&#8221; button on the main toolbar.</span></p>
<p><span style="line-height: 1.62;">You don&#8217;t even every have to worry about Apache. You just upload your web app, it goes into its own folder and then you can make it available for the world to use. How much easier could it be? We even have a wizard to walk you through getting and installing an SSL certificate, something that can be challenging with some VPS hosts.</span></p>
<p><span style="line-height: 22.68px;">Lastly, the Xojo Cloud database support gives you fast and easy access to MySQL and PostgreSQL for use in your own web, desktop and iOS apps.</span></p>
<h2><span style="line-height: 1.62;">Security &amp; Convenience<br />
</span></h2>
<p>So why does Xojo Cloud start at $49 per month when you can get hosting from &lt;insert other hosting provider&gt; for $25 per month? The reason is because security and convenience are not free. Most VPS hosting is not as fully managed as you might think. You are given access to a control panel but generally have to manage most things yourself. There is typically a list of specific tasks that the hosting company will also do for you if you file a support ticket. Of course, if you are comfortable doing this and have the free time, a VPS might be a reasonable option. Certainly, it was the best option available before Xojo Cloud. But for most people that want to spend their time creating great software and not acting as a Linux administrator, Xojo Cloud is a bargain.</p>
<p>We think Xojo with Xojo Cloud is the most secure and and easiest way yet to create web applications. We hope you do as well. Now go forth and create web apps!</p>
<p>Update: Xojo Cloud Database Support is here, click below to read about it!</p>
<p><!--HubSpot Call-to-Action Code --> <span id="hs-cta-wrapper-61f037c4-107a-426b-8728-b9201384f0c7" class="hs-cta-wrapper"> <span id="hs-cta-61f037c4-107a-426b-8728-b9201384f0c7" class="hs-cta-node hs-cta-61f037c4-107a-426b-8728-b9201384f0c7"><br />
<!-- [if lte IE 8]>


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


<![endif]--> <a href="http://blog.xojo.com/2015/03/19/xojo-cloud-databases-add-connect-manage/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" id="hs-cta-img-61f037c4-107a-426b-8728-b9201384f0c7" class="hs-cta-img aligncenter" style="border-width: 0px; margin: 0 auto; display: block; margin-top: 20px; margin-bottom: 20px;" src="https://blog.xojo.com/wp-content/uploads/2013/06/61f037c4-107a-426b-8728-b9201384f0c7.png" alt="Xojo Cloud Database Postgres MySQL" width="591" height="100" align="middle" /></a></span></span><br />
<!-- end HubSpot Call-to-Action Code --></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
