This project is read-only.

Phone Exchange Service
Exchange data between your pc and your windows phone 7

 

Phone Exchange Service is a windows service which hosts a WCF REST service in order to enable windows phone 7 apps to exchange data with the Pc.

A phone that uses the service can decide to use either a public folder which can be observed by any app (reading folders and files) or a private folder secured by a 128bit key (or 256bit) which is only accessible by the app that uses the folder or with the windows explorer locally on the pc.

Phone Exchange Service uses the root folder C:\users\public\Documents\PhoneExchange\ (or similar) to be exposed by the WCF service. The service will not expose any other folders outside that root.

The WCF service is a REST service, which means that he is accessible with simple html which are hosted in the root http://localhost:7998/PhoneExchangeService.

The service knows the following syntax:

http://localhost:7998/PhoneExchangeService/version
to return the currently installed version of the service

http://localhost:7998/PhoneExchangeService/dirs?path=myPath
to return all directory names without previous folder path in the specified myPath root in plain text separated by linefeed. For security reasons,  myPath does not allow any syntax like /../ or /./.

http://localhost:7998/PhoneExchangeService?files?path=myPath
to return all file names without  path in the specified myPath root in plain text separated by linefeed. For security reasons, myPath does not allow any syntax like /../ or /./.

http://localhost:7998/PhoneExchangeService?file?path=myPath
to upload, download or delete a file  (depending on whether to use GET, POST or DELETE) where myPath contains path and name of the file to download.

http://localhost:7998/PhoneExchangeService?dir?path=myPath
to create a new folder.

An optional parameter ?id={base64_guid} is allowed on all urls to specify a private folder. If id is not specified the public folder is used as the root folder, otherwise the folder with the given id.
Id should be a a base64 encoded guid which is generated when the app is installed, and will be different on every installation to prevent access to the folder from any other app. It’s also possible to use any other id, e.g. a 256 bit encoded aes key, or a simple folder name. But keep in mind that using a simple name makes the folder vulnurable. 
Note that even if the folder is private and it is not likely to guess the 128 key to access it, I recommend to additionally encrypt the files inside the folder depending on how secure they need to be.

 

example for private folder access:

http://localhost:7998/PhoneExchangeService?file?path=myPath&id=xZXlMN98RkLW4IP1qQf

 

The setup installs the windows service and opens the 7998 port in the windows firewall automatically. You’ll need to start the windows service named “PhoneExchangeService” after installation manually or restart your pc to run for the first time. If other firewalls are in use, ensure to enable the port for intranet use (not through internet!).

Last edited May 22, 2011 at 7:00 PM by Tom69, version 2