Archive for the ‘code’ Category

Cryptography with C# in Windows Mobile

Monday, February 11th, 2008

I wrote last week about an evening I spent throwing together a password manager for Windows and Windows Mobile. As I wrote at the time, one of the motivations was to try writing some encryption code.

I’ve finally got around to writing it, and wanted to post it here with a few comments.

This is what I needed code to be able to do:

  • Encrypt and decrypt data based on a user-provided password
  • Encrypt/decrypt consistently on both Windows desktops and Windows Mobile devices – a file encrypted on a Windows Mobile PDA should be able to be decrypted on a Windows desktop, and vice versa

The System.Security.Cryptography library in .NET makes this fairly straightforward – the class I have written to add crypto support to the password manager app needed only a few hundred lines of code in total.

I’ve shared a simplified version of the source at the end of this post.

(more…)

Donating for freeware

Thursday, February 7th, 2008

If I’ve ever talked to you about Windows Mobile, the chances are I’ve probably mentioned my wiki note-taking app. Of all of the bits of mobile code hacking that I’ve done, it is the one that (a) I dont seem to shut up about, and (b) has been one of my most popular*.

The app has been around for over a year now, and gets downloaded from about 1000 – 1700 unique IP addresses each month (Plus a few thousand more from mirrors on freeware sites).

The forum set up for users to report bugs and request features has over sixty active users.

And I generally get emails from 20 or 30 other people with requests each month who don’t want to use the forum for whatever reason.

I’ve even had emails from people using the app far more than I ever envisaged: people who are using the wiki as a work intranet wiki, installing a copy for each of their staff; people who use the wiki to maintain and develop websites; and more.

It would seem that there is an audience and a demand for this app.

Nearly a year ago, I decided to try a little experiment to see how this demand would translate into people prepared to pay for it.

(more…)

Writing a mobile password manager

Thursday, February 7th, 2008

I miss developing mobile apps. With the exception of the never-ending tweaks and revisions to my mobile wiki app, I’ve not done any mobile development in weeks. (Is it very sad that I missed it? 😉 )

Until tonight. Hurrah – back to playing with fun stuff.

One of the things I typically want to use on my phone is a mobile password manager – particularly as I do more web browsing on my phone, and mobile browsers like Pocket Internet Explorer and Opera Mobile don’t remember passwords.

I’ve tried several existing password managers – I’ve even paid for a couple, like eWallet (love the way it shows credit card details to look like a pretend credit card) and SplashID (always loved the desktop version). But I never found one that I really liked. At the moment, I’m back to storing passwords in a text file, and using mobile Notepad to access it.

There were problems with all of them…

One-handed or stylus-free navigation is bad – Teeny-tiny controls. Drop-down lists that you need to not only touch the screen to open, but then scroll up and down in. Basically, take a look at a design doc like this and do the opposite of pretty much everything 🙂

Too many clicks/presses to get to a password – SplashID for example: to get a website password, you touch the screen to open the category drop-down list, touch the screen to scroll to the “Web Logins” category, scroll through the list to the website you want, touch the screen to select it, press the “Tools” button, then press “Unmask Fields”. Too much.

No clipboard access – Unforgivable, this one. I like to use randomly generated passwords where possible. Once you’ve used the fiddly controls, and gone through all the steps, you can see the password on the screen – hurrah! Can you copy it to the clipboard for pasting into a web form? Nope. Even Ctrl-C / Ctrl-X / Ctrl-V don’t work – and most apps at least leave that basic Windows clipboard support in. So you have to remember your password after reading it. And with my passwords, that’s a pain. I used to find a scrap of paper, and write it down to make it quicker to type back in. So secure(!)

Actually, to be honest, even after all that, the final straw that stopped me using SplashID was the fact that it’s sync plugin consistently hosed my ActiveSync. Not only would it not sync, but it’d crash ActiveSync and stop everything else from syncing too. The day I uninstalled SplashID, my phone became a million times more useful from that alone!

This was all enough of an excuse to try throwing together my own password manager.

(more…)

Adding remote system admin support to PowerShell (before PowerShell V2)

Thursday, January 17th, 2008

Jeffrey Snover of Microsoft has written a very interesting post on PowerShell cmdlet development, prompted by the release of my latest updates to the WebSphere MQ PowerShell cmdlets.

By way of background, the cmdlets let you administer WebSphere MQ from the Windows PowerShell command prompt and scripting environment. One of WebSphere MQ’s biggest strengths is the breadth of it’s platform support, so it was no surprise that one of the most requested features to be added to the cmdlet library has been to be able to use PowerShell with WebSphere MQ queue managers on non-Windows servers.

(more…)

Displaying constant names (rather than values) in PowerShell cmdlets

Wednesday, November 21st, 2007

I’ve mentioned before that I’m working on some PowerShell cmdlets for WebSphere MQ. I thought I’d pass on a few tips that I picked up this week on improving the usability of the information displayed by Get- cmdlets in PowerShell.

The easiest way to explain it is to demonstrate with an example:

(more…)

New file and directory open and save dialogs for Windows Mobile

Tuesday, November 20th, 2007

Windows Mobile – like standard Windows – has a default “file open” and a “file save” dialog that all applications can use. If you’re writing an app, you can use it in your code with just a few lines. Great!

Except… no. Because they’re rubbish.

This has come up as an issue raised with a couple of apps that I’ve written that use the standard dialogs. I would defend my apps by saying that I didn’t write the dialogs, and that they’re the same that you get in other Windows Mobile apps like Microsoft Word Mobile. But I can’t, really. For a user, this is just an excuse. Wherever the dialog came from, it is rubbish.

I’ve written a couple of new ones for use in my applications. They’re fairly small, so I’ve made them available if anyone else wants to use them with their apps.

In this post, I’ll quickly outline what is wrong with the standard dialogs, and introduce my new ones.

(more…)

Registering file extensions with Windows Mobile apps

Tuesday, November 20th, 2007

I took a break from playing with the Android SDK for the first time tonight by making a quick update to my Windows Mobile notepad app.

Previously, to open files I’ve had to launch the notepad, then use File -> Open and choose my file. I wanted to register the .txt file extension with the notepad app, so that I can open files in the notepad by clicking on them. It’s a fairly straightforward thing to do, but I thought it might be helpful to share.

I couldn’t find much information about it, but it’s fairly simple to work out if you use Visual Studio’s Remote Registry Editor to see how other apps do it.

(more…)

Shortest app yet – Windows Mobile reset

Tuesday, October 23rd, 2007

I have to reset my Windows Mobile PDAs depressingly often. Both the HTC Universal and Advantage seem to need resetting every other day or so.

This has one big problem. You can lose stuff if you’re not careful. From Windows Mobile 5 onwards, a lot of data is kept in memory for performance reasons – written to persistent storage periodically. If you reset before this has been done, you can lose the most recent data.

For example, if I get a text message, then reset the phone, that text message will almost certainly be lost.

The trick is, if you need to do a reset you switch the phone off, leave it for 20 seconds then reset it. Normally, after being idle for a bit the phone will write pending data to storage.

This is a bit unscientific, so (after losing stuff from Outlook again today) I looked for a software way to ensure recent stuff is saved.

(more…)