# SSL Socket Question

**URL:** <https://forum.xojo.com/t/ssl-socket-question/23152>\
**Category:** General\
**Created:** [March 22, 2015, 4:33am UTC](https://forum.xojo.com/t/ssl-socket-question/23152 "2015-03-22T04:33:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jon\_Ogden](https://forum.xojo.com/user_avatar/forum.xojo.com/jon_ogden/32/494_2.png) [@Jon\_Ogden](https://forum.xojo.com/u/Jon_Ogden)\
**Post date:** [March 22, 2015, 4:33am UTC](https://forum.xojo.com/t/ssl-socket-question/23152/1 "2015-03-22T04:33:17Z")

</div>

Hey all,

i want to set up an SSL Socket that listens for connections. - That will allow people to connect using SSH - yes?

Question 2: The documentation says: [quote]When using an SSLSocket to Listen for a connection, you must specify a CertificateFile.[/quote]  
So how do you do this? And how do you know your user on the other end has the correct certificate file??

There’s no examples about how to do this so any pointers is greatly appreciated.

Jon

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [March 22, 2015, 4:43am UTC](https://forum.xojo.com/t/ssl-socket-question/23152/2 "2015-03-22T04:43:36Z")

</div>

> [@175667:@Jon Ogden](#):
>
> i want to set up an SSL Socket that listens for connections. - That will allow people to connect using SSH - yes?

No  
SSH is a an entire protocol [Secure Shell - Wikipedia](http://en.wikipedia.org/wiki/Secure_Shell#Standards_documentation)

Just like having a TCP socket doesn’t let people use HTTP a secure socket doesn’t enable SSH

---

<div class="post-metadata">

**Author:** ![Jon\_Ogden](https://forum.xojo.com/user_avatar/forum.xojo.com/jon_ogden/32/494_2.png) [@Jon\_Ogden](https://forum.xojo.com/u/Jon_Ogden)\
**Post date:** [March 22, 2015, 5:01am UTC](https://forum.xojo.com/t/ssl-socket-question/23152/3 "2015-03-22T05:01:00Z")

</div>

OK. And since Xojo doesn’t have any SSH controls, I’d need to come up with my own then - right?

Bottom line is this: I have an API in my app that people can connect to via telnet and send commands to make the app do things. I’ve had some requests for this to be done in a more secure method like SSH. Is there any way to utilize the SSLSocket to do a secure connection similarly to simply creating a TCPSocket? I get how I could use the SSLSocket in between my own apps. But if you wanted to just use an OS X shell for the connection. How would you do that? With unsecured TCP, I can simply open a telnet connection.

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [March 22, 2015, 9:03am UTC](https://forum.xojo.com/t/ssl-socket-question/23152/4 "2015-03-22T09:03:06Z")

</div>

MBS Plugin comes with SSH Classes:  
[http://www.monkeybreadsoftware.net/pluginpart-ssh2.shtml](http://www.monkeybreadsoftware.net/pluginpart-ssh2.shtml)

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [March 22, 2015, 12:42pm UTC](https://forum.xojo.com/t/ssl-socket-question/23152/5 "2015-03-22T12:42:00Z")

</div>

[quote=175676:@Jon Ogden]OK. And since Xojo doesn’t have any SSH controls, I’d need to come up with my own then - right?

Bottom line is this: I have an API in my app that people can connect to via telnet and send commands to make the app do things. I’ve had some requests for this to be done in a more secure method like SSH. Is there any way to utilize the SSLSocket to do a secure connection similarly to simply creating a TCPSocket? I get how I could use the SSLSocket in between my own apps. But if you wanted to just use an OS X shell for the connection. How would you do that? With unsecured TCP, I can simply open a telnet connection.[/quote]  
Have you thought about using a REST API instead? You can do all of that with a web app and protect it with an SSL certificate.

FWIW, Travis will be doing a session on building web services at XDC this year.

---

<div class="post-metadata">

**Author:** ![Jon\_Ogden](https://forum.xojo.com/user_avatar/forum.xojo.com/jon_ogden/32/494_2.png) [@Jon\_Ogden](https://forum.xojo.com/u/Jon_Ogden)\
**Post date:** [March 22, 2015, 2:20pm UTC](https://forum.xojo.com/t/ssl-socket-question/23152/6 "2015-03-22T14:20:01Z")

</div>

[quote=175698:@Greg O’Lone]Have you thought about using a REST API instead? You can do all of that with a web app and protect it with an SSL certificate.

FWIW, Travis will be doing a session on building web services at XDC this year.[/quote]

It’s not a Web interface that I have. It’s a command line interface.

---

<div class="post-metadata">

**Author:** ![Jon\_Ogden](https://forum.xojo.com/user_avatar/forum.xojo.com/jon_ogden/32/494_2.png) [@Jon\_Ogden](https://forum.xojo.com/u/Jon_Ogden)\
**Post date:** [March 22, 2015, 2:21pm UTC](https://forum.xojo.com/t/ssl-socket-question/23152/7 "2015-03-22T14:21:40Z")

</div>

[quote=175686:@Christian Schmitz]MBS Plugin comes with SSH Classes:  
[http://www.monkeybreadsoftware.net/pluginpart-ssh2.shtml[/quote]](http://www.monkeybreadsoftware.net/pluginpart-ssh2.shtml%5B/quote%5D)

Thanks. I was hoping to be able to simply do it with an SSLSocket as I already have a TCPSocket in place and code well defined for that. My hope was I could let the user choose a secure or normal connection simply by setting the Boolean “secure” property of the SSLSocket.

Once I delve into other classes, it becomes much more involved and not something I can quickly push out which was what I was hoping to do. Maybe not… ☹

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [March 22, 2015, 3:42pm UTC](https://forum.xojo.com/t/ssl-socket-question/23152/8 "2015-03-22T15:42:58Z")

</div>

Jon,

Didn’t you post this last year?

[https://forum.xojo.com/8560-telnet-class-for-xojo-update](https://forum.xojo.com/8560-telnet-class-for-xojo-update)

Last entry about having created an SSH class with Kem?

---

<div class="post-metadata">

**Author:** ![Jon\_Ogden](https://forum.xojo.com/user_avatar/forum.xojo.com/jon_ogden/32/494_2.png) [@Jon\_Ogden](https://forum.xojo.com/u/Jon_Ogden)\
**Post date:** [March 22, 2015, 4:25pm UTC](https://forum.xojo.com/t/ssl-socket-question/23152/9 "2015-03-22T16:25:33Z")

</div>

[quote=175718:@Greg O’Lone]Jon,

Didn’t you post this last year?

[https://forum.xojo.com/8560-telnet-class-for-xojo-update](https://forum.xojo.com/8560-telnet-class-for-xojo-update)

Last entry about having created an SSH class with Kem?[/quote]

Yes. But that is coded as a client. I’m looking for handling the server end of things. I’ll probably end up adapting that class to do what I want on the server end. But I was looking for something on the server side that was easy to implement as in like “no additional coding.” 🙂

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [March 22, 2015, 7:06pm UTC](https://forum.xojo.com/t/ssl-socket-question/23152/10 "2015-03-22T19:06:46Z")

</div>

[quote=175686:@Christian Schmitz]MBS Plugin comes with SSH Classes:  
[http://www.monkeybreadsoftware.net/pluginpart-ssh2.shtml[/quote]](http://www.monkeybreadsoftware.net/pluginpart-ssh2.shtml%5B/quote%5D)

Also your SSHv2 is Client only not Server side (Unless you added server side lately?)

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [March 22, 2015, 8:42pm UTC](https://forum.xojo.com/t/ssl-socket-question/23152/11 "2015-03-22T20:42:09Z")

</div>

Sorry, client only SSH.

---

<div class="post-metadata">

**Author:** ![Jon\_Ogden](https://forum.xojo.com/user_avatar/forum.xojo.com/jon_ogden/32/494_2.png) [@Jon\_Ogden](https://forum.xojo.com/u/Jon_Ogden)\
**Post date:** [March 22, 2015, 11:43pm UTC](https://forum.xojo.com/t/ssl-socket-question/23152/12 "2015-03-22T23:43:49Z")

</div>

> [@175667:@Jon Ogden](#):
>
> i want to set up an SSL Socket that listens for connections.

This is the key question I asked here. Christian’s classes are client only. The class Kem helped me with is client only.

So - does ANYONE have any advice on how to set up an SSLSocket that listens for connections. Not a Web or HTML socket. This is for a command line interface.

I can set up a secure SSLSocket and set it to listen. However, how do you connect to it? What do you use?

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [March 23, 2015, 1:13am UTC](https://forum.xojo.com/t/ssl-socket-question/23152/13 "2015-03-23T01:13:01Z")

</div>

Connect with another SSL Socket 🙂  
If you want to support the SSH protocol using that socket you need to implement it

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [March 23, 2015, 1:25am UTC](https://forum.xojo.com/t/ssl-socket-question/23152/14 "2015-03-23T01:25:58Z")

</div>

[quote=175770:@Jon Ogden]This is the key question I asked here. Christian’s classes are client only. The class Kem helped me with is client only.

So - does ANYONE have any advice on how to set up an SSLSocket that listens for connections. Not a Web or HTML socket. This is for a command line interface.

I can set up a secure SSLSocket and set it to listen. However, how do you connect to it? What do you use?[/quote]  
Its not possible yet in Xojo for since I had been searching for an SSH Server implementation and short of paying Christian to adapt C code to a plugin we don’t have that ability yet.

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [March 23, 2015, 1:30am UTC](https://forum.xojo.com/t/ssl-socket-question/23152/15 "2015-03-23T01:30:13Z")

</div>

> [@175786:@Mike Cotrone](#):
>
> Its not possible yet in Xojo for since I had been searching for an SSH Server implementation and short of paying Christian to adapt C code to a plugin we don’t have that ability yet.

This is exactly analogous to an HTTP Server, FTP server etc.  
None are built in - the sockets are but not specific protocols.  
The Socket provides the foundation to implement whatever protocols you want.

The one thing I think is missing is the ability for the server socket to listen securely.  
Basically it always listens unsecurely and hands connections off to a TCP socket or subclass.

---

<div class="post-metadata">

**Author:** ![Jon\_Ogden](https://forum.xojo.com/user_avatar/forum.xojo.com/jon_ogden/32/494_2.png) [@Jon\_Ogden](https://forum.xojo.com/u/Jon_Ogden)\
**Post date:** [March 23, 2015, 3:20am UTC](https://forum.xojo.com/t/ssl-socket-question/23152/16 "2015-03-23T03:20:48Z")

</div>

> [@175779:@Norman Palardy](#):
>
> Connect with another SSL Socket 🙂

Yeah, unfortunately, I need to be able to have something unknown and outside my control connect to it.

> [@](#):
>
> If you want to support the SSH protocol using that socket you need to implement it

Yeah, I figured. And I don’t think this would be a trivial task!

---

<div class="post-metadata">

**Author:** ![Jon\_Ogden](https://forum.xojo.com/user_avatar/forum.xojo.com/jon_ogden/32/494_2.png) [@Jon\_Ogden](https://forum.xojo.com/u/Jon_Ogden)\
**Post date:** [March 23, 2015, 3:21am UTC](https://forum.xojo.com/t/ssl-socket-question/23152/17 "2015-03-23T03:21:18Z")

</div>

> [@175786:@Mike Cotrone](#):
>
> Its not possible yet in Xojo for since I had been searching for an SSH Server implementation and short of paying Christian to adapt C code to a plugin we don’t have that ability yet.

Too bad. It’s surprising we don’t have it or that someone hasn’t done it…

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [March 23, 2015, 3:51am UTC](https://forum.xojo.com/t/ssl-socket-question/23152/18 "2015-03-23T03:51:31Z")

</div>

Shouldn’t the SSH connection go to the server (eg., the OS)? Then the user would use a normal Telnet connection withing the SSH tunnel. In my mind, SSH is external to the app and at the OS level.

---

<div class="post-metadata">

**Author:** ![Jon\_Ogden](https://forum.xojo.com/user_avatar/forum.xojo.com/jon_ogden/32/494_2.png) [@Jon\_Ogden](https://forum.xojo.com/u/Jon_Ogden)\
**Post date:** [March 23, 2015, 3:58am UTC](https://forum.xojo.com/t/ssl-socket-question/23152/19 "2015-03-23T03:58:37Z")

</div>

> [@175797:@Tim Hare](#):
>
> Shouldn’t the SSH connection go to the server (eg., the OS)? Then the user would use a normal Telnet connection withing the SSH tunnel. In my mind, SSH is external to the app and at the OS level.

That’s an interesting concept and quite an idea. It certainly makes things simple. OS X has a built in ssh server. That would make things quite simple…

I wonder if Putty has an SSH server in it for Windows…I’ll have to go look that up…

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [March 23, 2015, 8:12am UTC](https://forum.xojo.com/t/ssl-socket-question/23152/20 "2015-03-23T08:12:18Z")

</div>

Why not take a ServerSocket accepting connections and giving them to SSLSockets?

What does the other side want?  
HTTPS POST like more web services?  
You could accept that with a web app easily.

[Next page](https://forum.xojo.com/t/ssl-socket-question/23152.md?page=2)
