I’m looking into doing a little cryptographic stuff in python. Nothing fancy, just some standard stuff. Not for the first time I’m bumping into this brick wall of “batteries included”, the notion that the python library comes with a lot of stuff that should be good enough for whatever you need to do. Only problem is that it doesn’t. XML parsing stinks in Python; http IO stinks (need lots of third party stuff to make that usable); no UTF-8 by default; etc.
Out of the box python is bloody useless unless you want to do some very simplistic stuff. So basically my problem is very simple: I need to be able to sign stuff and verify signatures in a way that is compatible with how stuff like this stuff is commonly done on the internet ™. I.e. you’d expect some pretty mature, well tested libraries to be around for whatever programming language you’d like to use. I know exactly where to go to get this stuff for Java, for example.
So we’re looking at some very basic capability to do stuff with algorithms like RSA, SHA1, MD5 etc. Batteries not included with python at all so I Google a bit to find out what people commonly use for this in python and stumble upon what seems to be the most popular library pycrypto. It seems to have all the algorithms, great! Only one minor detail that has had me crawl all over Google for the entire afternoon:
Public keys usually come as base64 encoded thingies: how the hell do I get them in and out of the functions/classes and what not provided by pycrypto. Batteries not included. After a long search, I find this nice post.
Basically it’s telling me that various people have bothered to provide nice libraries with relevant code for python but somehow all of them have neglected to provide this very basic functionality that you will need 100% guaranteed. That just sucks. In the hypothetical case that you’d actually want to use this stuff to do hypothetically useful things like verifying a signature attached to some http request you will basically find yourself reverse engineering this poorly documented library and figuring out how to get from a base 64 encoded RSA key to a properly configured RSA class instance and back again. I had lots of fun (not) reading about the details of RSA, x.509, etc.
Eventually I found some sample code here that seems to half do what I need. But I’d just prefer to be able to reuse something that is hassle free instead of copy pasting somebody else’s code and debugging it until it works as expected and basically reinventing the wheel by making what would amount to Jilles private little python crypto library. I have better things to do.
I’ve added about 60 photos to my photosite.
This place is crazy. Indoor canals + gondolas. Nuff said.
Picking up the car from Hertz this morning.
Hertz Guy? what car do you want? I’ve got X, Y, and a two seat mustang
Me: Mustang sounds cool ….
Screw Al Gore, this car is cool. I don’t even want to know the mileage.
Yesterday was another shitty day weather wise. I amused myself by visiting the De Young museum and the Legion of Honor museum (both of which are very much worth a visit) using just one ticket from my city pass. After that the weather seemed to clear up and I headed for the Golden Gate bridge.
The weather is more than a little disappointing. The San Francisco Chronicle was labeling yesterday’s storm as the storm of the decade. In case you are wondering, jet lags are funny and I’ve been reading the hotel paper since 5.30 am when it was delivered. The only news in the world seems to be Britney + Ohio primaries, at least according to this waste of dead trees. CNN seems to concur, alternating their non stop coverage between the two non issues.
Of course that kind of qualifications in a US news paper always need to be taken with a grain of salt but it sure was no fun walking in San Francisco yesterday morning. To see what the (predicted) 30 feet (10 meter) waves look like, I took the N-line to the Ocean Beach end point and stared at the ferocious mix of horizontal flying sand + rain and the predictably rather wild but not so high waves breaking for about 30 seconds before deciding that getting soaked like this was probably not a good idea. The rest of the day I did the Moma (great!) and in the afternoon I took the cable car to Fisherman’s Wharf when the weather had cleared up somewhat. Today I’m planning to do the de young museum and then, weather permitting, walk onto the golden gate bridge. My city pass ticket for the De Young also gives me access to the legion of honor museum so I will likely go there as well. Tomorrow I’ll use my bay cruise ticket and use a few more of the museum tickets.
Despite the nasty weather, I’m really enjoying San Francisco. Hopefully, I’ll get some sun light and warmth in Las Vegas next week.
I flew to San Francisco yesterday to do some sight seeing, visit my colleagues in NRC Palo Alto, and attend CCNC in Las Vegas next week. The flight was pretty long. I took the 6:15 flight to Amsterdam from Helsinki (i.e. I got up 3:30 am) and was supposed to leave to SF at 11:10. Unfortunately some idiot left some drugs (cocaine??) on the plane which resulted in a 1.5 hour delay to search the plane for more. The flight itself was pretty uneventful. The plane was a Boeing 777-200 which I liked a whole lot better than the 747’s I’ve flown so far on trans atlantic flights. The food was pretty decent (considering quality of usual in flight meals). Additionally, the in flight entertainment system was much better than what I’ve seen before. I saw several nice movies during the flight: Rush Hour 3, Mr Bean’s Holiday, Star Dust and Wallace & Gromit: Curse Of The Were-Rabbit. The system had a pretty decent selection of a few dozen movies with quite a few recent ones. Plenty to see on the way back.
Additionally, I met an old friend from Groningen where I lived a few years ago on the plane (six seats behind me!). She is living in San Franciso now with her husband and I’m having dinner at their place tonight. Small world.
My jet lag was nicely compensated by not sleeping for 26 hours. So I had no problems falling asleep at 21:00 and waking up well rested at 7:30. The hotel is pretty cool. It’s the Pickwick, 1 block from Powel Street station on Market Street. This morning I was planning to take the cable train from there (somebody gave me a ticket before I left). Unfortunately they had some mechanical trouble so I had to walk. I walked all the way to Fisherman’s Wharf and got some great views of San Francisco on the way. It seems to me the cable tram is for sissies anyway.
The only disappointment seems to be the weather. This morning it was pretty cloudy and around noon it started raining. On my way back I visited the Apple store to drool at over the cool stuff they have there. I played a bit with the ipod touch and was pretty impressed with it. Particularly the browser is very cool and I was very impressed with how it scrolls and zooms in and out of pages.
If it had a bit more flash memory I would probably buy one. 60+ GB would be about right for me (right now max is 16). My current ipod photo has 60 GB and that seems to be plenty for me.
Right now I’m relaxing a bit in my hotel room, sipping a coke and enjoying the free (!) wifi. Of course I am taking lots of pictures (despite the weather). I’ve gimped up one, the rest will follow when I’m back home and can use photoshop (the Gimp is comparatively useless/unusable):
I might post a few more over the next few days.