Secure Sockets on Windows

Hello Everyone,

I have not been able to get the example ssl program working on Windows 8.1 that is described in the Xojo article Web Standalone SSL. The program that was tried is the Example that is with Xojo 2014 r2.1 called SSLTest.xojo_binary_project.

The program has been tried in both compiled and IDE running mode, and I have tried different ports (usually 8081 from the article) and am not able to get this working.

Is there something that I am missing? Thanks for your thoughts.

Using the latest version of Xojo, on Windows 7.

It appears the certificate file has to be the same name as the executable but with the .crt extension. Since the debugger creates an executable named DebugSSLTest.exe, I changed the name of the supplied certificate file from SSLTest.crt to DebugSSLTest.crt and it worked. I assume that you are using the debugger method also.

By the way, I get a Build Step error up front because it is saying that it can’t copy the certificate to a none existent folder. So I just “Run-Paused” and copy the renamed certificate into the folder manually before running the standalone executable.

Yes, I see you tried both ways. :slight_smile:

What I wrote worked for me using the IDE method. I don’t have a licensed version of Xojo. I stuck with 2012r1.2 as my last available licensed version. Therefore, I couldn’t test the “Build” method. The only thing I saw that looked odd was that the parameter for the “Build” method should have probably been “–secureport=8081” instead of “–secureport-8081” as it says in the example. However, I have no way to know for sure. It just looked odd because I doubt that the built version’s parameter would be any different than the IDE method’s parameter.

it should be:

--secureport=8081

Ok, here the steps that I am doing for a build ssl file:

  1. Copy ssltest project to D:\user\Xojo\Eugene\Web\Chapter23\ directory
  2. Change Build Settings for Windows App Name to SSLTest in the Xojo IDE
  3. First build of program to create build directory and libs in D:\user\Xojo\Eugene\Web\Chapter23\Builds - SSLTest.xojo_binary_project\Windows\SSLTest folder
  4. copy SSLTest.crt from C:\Program Files (x86)\Xojo\Xojo 2014r2.1\Example Projects\Web\SSL to D:\user\Xojo\Eugene\Web\Chapter23\Builds - SSLTest.xojo_binary_project\Windows\SSLTest
  5. drag SSLTest.crt from D:\user\Xojo\Eugene\Web\Chapter23\Builds - SSLTest.xojo_binary_project\Windows\SSLTest and drag to CopySSLCertWindows, and delete previous file path that was there
  6. rebuild executable with updated data
  7. open command prompt and move to D:\user\Xojo\Eugene\Web\Chapter23\Builds - SSLTest.xojo_binary_project\Windows\SSLTest directory
  8. run in command prompt ssltest --secureport8081
  9. type https://127.0.0.1:8081 in browser
  10. recieve ‘This page is not available’ warning in Chrome browser

If there is a step which I may have missed, feel free to let me know :slight_smile:

Thank you.

The certificate file should be in the same directory as the executable.

  • and -

Step 8 should be:

ssltest --secureport=8081

The steps should be:

  1. Open SSLTest project
  2. Enable Windows Build
  3. Expand Windows Build Target and move the CopyFilesStep to after the build step. If you don’t, the destination directory doesn’t exist yet and it will fail to copy. (We’ll have to get that project fixed)
  4. In the IDE, change the port to something other than 80 (Shared->Build->Port). If you’re not an administrator, you can’t bind to a port below 1024 and the app may fail to load properly if you do.
  5. Run the app from the command prompt using this code: SSLTest --secureport=8081 --maxsecuresockets=50
  6. Make sure the app stays running. If an error occurs, it will be printed to the terminal window and your app will quit.
  7. Use a browser to connect to the app: https://127.0.0.1:8081/

For what it’s worth, these steps work for me on my Windows 7 VM.

It’s also worth noting which browsers did and did not work:

From my Mac, Safari, Chrome and Firefox all connected fine (albeit complaining about the self-signed certificate)
On Windows 7, Chrome and Firefox connected fine (same complaints), Internet Explorer 11 did not.

[quote=129129:@Greg O’Lone]The steps should be:

Open SSLTest project
Enable Windows Build
Expand Windows Build Target and move the CopyFilesStep to after the build step. If you don’t, the destination directory doesn’t exist yet and it will fail to copy. (We’ll have to get that project fixed)
In the IDE, change the port to something other than 80 (Shared->Build->Port). If you’re not an administrator, you can’t bind to a port below 1024 and the app may fail to load properly if you do.
Run the app from the command prompt using this code: SSLTest --secureport=8081 --maxsecuresockets=50
Make sure the app stays running. If an error occurs, it will be printed to the terminal window and your app will quit.
Use a browser to connect to the app: https://127.0.0.1:8081/
For what it’s worth, these steps work for me on my Windows 7 VM.[/quote]

Thanks to both Greg and Randy. This is making progress and am getting closer, but not quite there yet.

Here are the modified steps that were used of Gregs:

  1. Open SSLTest project
  2. Enable Windows Build
  3. Rename Windows App Name to SSLTest (otherwise the exe and crt name do not match, and the exe is My Application.exe)
  4. Changed the port in Shared -> Build -> Port to 8081
  5. Compiled Xojo Web App
  6. Copied SSLTest.crt to C:\Users\Eugene\Desktop
    ew\Builds - SSLTest\Windows\SSLTest\ folder
  7. Opened CMD in C:\Users\Eugene\Desktop
    ew\Builds - SSLTest\Windows\SSLTest\ folder
  8. Ran app with SSLTest --secureport=8081 --maxsecuresockets=50
  9. Opened Chrome browser and typed https://127.0.0.1:8081/
  10. Browser provided the message: “Establishing Secure Connection…”

In Internet Explorer, the response is: ‘This page can’t be displayed’

The good news is that when attempting to rerun the program by retyping ‘SSLTest --secureport=8081 --maxsecuresockets=50’, the error ‘App is shutting down: Unable to bind to port 8081, port is already in use.’ To free the port the computer is rebooted.

This is on a native Windows 8.1 Pro machine, with Xojo 2014 r2.1, tested on Chrome and IE browsers.

I’ll give it a try on my native Windows 7 machine.

Just tried this on a native Windows 7 machine with Xojo 2014 and tested on Chrome and IE browsers and this didn’t work on either browser.

Any other possible suggestions?

Thanks for trying.

For the record, it works for me on Windows 7 using both IE 11 and Firefox 32.0.1.

Try these steps:

  1. Open Xojo
  2. From the Project Chooser, select Examples->Web->SSL->SSLTest.xojo_binary.project
  3. Under build settings, make sure Windows is selected.
  4. Build the project.
  5. Go to the build directory and make sure the SSLTest.crt file is in the build folder.
  6. Execute the command: “SSLTest --secureport=8081”
  7. Make sure in the command console you see something like “Application Started”
  8. Browse to “https://localhost:8081

Not sure where your original example came from but the example should already exist in the examples folder (if you did a standard install)

Hope that helps.

[quote=129142:@Randy Baskin]For the record, it works for me on Windows 7 using both IE 11 and Firefox 32.0.1.

Try these steps:

  1. Open Xojo
  2. From the Project Chooser, select Examples->Web->SSL->SSLTest.xojo_binary.project
  3. Under build settings, make sure Windows is selected.
  4. Build the project.
  5. Go to the build directory and make sure the SSLTest.crt file is in the build folder.
  6. Execute the command: “SSLTest --secureport=8081”
  7. Make sure in the command console you see something like “Application Started”
  8. Browse to “https://localhost:8081

Not sure where your original example came from but the example should already exist in the examples folder (if you did a standard install)

Hope that helps.[/quote]

Hi Randy,

Thanks for the helpful steps. I added one step which made it work on the Windows 8.1 machine:

  1. Open Xojo
  2. From the Project Chooser, select Examples->Web->SSL->SSLTest.xojo_binary.project
  3. Under build settings, make sure Windows is selected.
  4. Change the Windows App Name to SSLTest
  5. Build the project.
  6. Go to the build directory and make sure the SSLTest.crt file is in the build folder.
  7. Execute the command: “SSLTest --secureport=8081”
  8. Make sure in the command console you see something like “Application Started”
  9. Browse to “https://localhost:8081

Thank you!!!

Yes, I forgot that step, sorry. :slight_smile:

I’m glad you were able to finally get it working.

If you get a chance, file a bug report about the errors in this example project.

Here is the example modification request for the executable name change.

<https://xojo.com/issue/35346>

This is the feedback request to change the default port number to 8081.

<https://xojo.com/issue/35347>

Here is the feedback request to change the command executable on the label:

<https://xojo.com/issue/35348>