Sending push-notifications from coldfusion? - ssl

DISCLAIMER: I have never used coldfusion before and am in a bit of a hurry to get a small code snippet implemented.
So, I have the app working and receiving notifications from a php script: device token is hardcoded into script, script has access to the needed certificate to encrypt the message using SSL, message is sent to apple servers and passed on to the device.
I need to do the same thing from coldfusion. That is what the production server is using.
Is there any way to do so from coldfusion, or will I have to use some other programming language to do so? I have read that coldfusion plays well with .net and with java. I would prefer .net, and I see they have the SSL stream class (http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx) available. Could any coldfusion experts write some simple sample code to let me know how I should go about it?
Thank you.
-EDIT: in reply to the comment below, this is exactly what I want to do: connect through TCP over TLS or SSL to a server (in this case the Apple Push Notification server, APNs) using a local certificate I have in .pem format (if the certificate needs to be installed on the server or needs to be in another format for coldfusion, I can do that as well), and send it a binary stream (my notification).

The answer is yes, this can be done with ColdFusion. In fact, it can be done with pretty much any programming language that has the requisite cryptographic libraries to open a private key store and sign messages to the destination server (i.e., Apple's push servers).
Though ColdFusion does appear to have some native support for accessing and using a PKCS12 keystore, it seems to be far more common to let Java do the heavy lifting, and simply reference the Java library from within ColdFusion.
Here is a link demonstrating the simple use case of initiating a push notification from ColdFusion, using a Java library for the actual sending of the notification:
http://www.raymondcamden.com/index.cfm/2010/9/13/Guest-Post-Apple-Push-Notifications-From-ColdFusion-in-Ten-Minutes-or-Less

Related

Recommended WebRTC Server Configuration for Native app (iOS/Android)?

I tried to build a server for integrating the webrtc native APIs in an native app, but I am not sure about how the server should be configured, like the ICE/STUN/TURN, signaling, media server etc..
So far as I know is the open source project: https://github.com/priologic/easyrtc
Can anybody give some recommendations?
Thanks
In a WebRTC infrastructure, there are several things involved. The client part is written in JavaScript and runs on the browser.
But as you said it is a server side part. First there is a ICE/STUN/TURN server that it's used for a client to discover its public IP address if it is located behind a NAT. Depending on your requirements could not be necessary to build/deploy your own server, but use an already public (and free) existing one - here's a list. You can also deploy an open source one like Stuntman.
Then it comes the signaling part, used by two clients to negotiate and start a webrtc session. There is no standard here and you have a few options.
You can use an XMPP server with a Jingle extension. You can deploy an existing XMPP server, like OpenFire or Tigase
You can also use SIP, a protocol much more encountered for VoIP. You can use JAIN-SIP or SIP Servlets.
Or you can develop your own signaling protocol using something like websockets.
The server side options that I was giving you were Java based ones, but you can find similar for other infrastructures too.
STUN/TURN is required. Use public ones (not absolutely stable) or get a Ubuntu machine ans install from the source: https://code.google.com/p/rfc5766-turn-server/
Signaling is trivial. You just forward messages between peers. Just build a simple chat server.
Media server is whole different story and require sophisticated client-server configuration.

How to implement secure FTP connection on iOS

Apple provide a CFNetwork guide, where described how to work with FTP. I interested to work with SFTP. Everywhere chilkat ftp library is suggested, but he has a too big feature list, that is unnecessary to pay.
Are there any way to connect to SFTP only for download, upload and viewing directory lists?
/n software IP*Works! SSH for iOS (www.nsoftware.com/ipworks/ssh/) is another commercial solution. It includes an SFTP library as well as a number of other iOS communications libraries.
SFTP is just an extension of the SSH protocol. I would look for an open source SSH library, such as this one. Most have support for the SFTP protocol.
One thing to note, if you intend to use it in an App Store app, you may want to remove the server capability from the library, as Apple probably wouldn't allow it. If, by some slight chance, the library even builds and runs with the SSH server capability, you may be able to get it into the App Store if you don't enable the server.
Of course, I'm sure there are libraries out there with client-only capabilities if removing server support yourself doesn't sound all that dandy.

ios backup using http

I've spent hours now looking for an answer to this question and I can't seem to find it anywhere.
Are there any tutorials or sample code that help with setting up an http connection so that a user can use the browser to save the application coredata sqlite file to the desktop and/or send a previous sqlite backup to the app?
Thanks in advance.
You can use the Cocoa HTTP Server. I have used it before, and it works great.
It has:
Built in support for bonjour broadcasting IPv4 and IPv6 support
Asynchronous networking using GCD and standard sockets
Password protection support
SSL/TLS encryption support
Extremely FAST and memory efficient
Extremely scalable (built entirely upon GCD)
Heavily commented code
Very easily extensible WebDAV is supported too!

How to check via web if .NET Framework4 Client is installed

Is it possible to check via web site if end use has installed .NET Framework4 Client ?
It's desirable if this way doesn't use any plugins (flash or silverlight).
From the server side, the best you can do is sniff the user agent that is sent with the request to the website. In it you'll usually see something along the lines of:
.NET <version number>
Or something to that effect.
Of course, there are major drawbacks to this (as there is with any user agent detection) which warrant not doing this:
The user agent can be spoofed
Parsing strings that are not structured is generally error-prone
Not all browsers (i.e. non-IE browsers) are obligated to send this information
That said, ChrisF's comment asking why is somewhat relevant, in the sense that you are better off having code execute on the client side to detect this, as there are more definitive ways (checking the registry) of determining if .NET 4.0 is installed on the client, using mechanisms that you just don't have available to you from the server side.
The thing is, if the code is served up from the server side, then it will probably be sandboxed in some way, and you'll have to figure out a way to access the registry (which is typically restricted in most sandboxes for code downloaded from the web).

How to implement websockets on an embedded device server?

I am working with an electronics appliance manufacturer to embed LAN based control systems into the products. The idea is to serve up a system configuration/control interface through a web browser so clients never need to install software. We can communicate with the appliance by sending and receiving serial data through the embedded module. Since the appliance can also be controlled from a front panel UI, it creates a challenge to keep a remote web interface in sync with very low latency. It seems like websockets or some sort of Push is what we need for handling real time events from the server to clients.
I am using a Lantronix Mathport AR embedded device server. Out of the box the unit will serve up any custom HTML and java servlets/applets. We have the option to install a lightweight Linux distro if we need more flexibility. I am not sure how to implement any server side apps since the device is not running standard Apache. I believe it is using Boa.
Can anyone guide me in the right direction of how to do this?
Some general info...The WebSocket protocol (draft spec here) is a simple layer on top of TCP. What this means is that, if you already have a TCP server for your platform, implementing the WebSocket is just a matter of hours. The protocol specifies a handshake and two ways of sending data frames.
I strongly suggest you start by reading the 39 pages spec.
As Tihauan already mentioned, start by reading the spec, and also note that there are still some changes ongoing, although websockets is now more stable than it was 1 year ago.
Key point for me was the requirement that websocket data is entirely UTF-8 text, which lends itself nicely to JSON based message definitions.
Our system uses a form of embedded linux, so we then added and made use of the following libraries:
"libwebsockets" from:
http://git.warmcat.com/cgi-bin/cgit/libwebsockets/
"jansson" from:
http://www.digip.org/jansson/
Using the above as support libraries, we created an internal lightweight "client/server" that allowed our other software modules to register for certain, applicable, websocket messages, and respond as needed. Worked great.
Good luck and best regards,
I'm a bit late, but Mozilla posted a guide entitled "Writing WebSocket servers", which literally guides you through writing a websocket server.
You will need to already know how HTTP works and have medium programming experience. Depending on language support, knowledge of TCP sockets may be required. The scope of this guide is to present the minimum knowledge you need to write a WebSocket server.
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers