Oddly, iOS doesn’t provide any OpenSSL implementation at all — If you want to do anything with crypto (like checking signatures, checksumming, etc.), you have to build in the library yourself.
I came across a great XCode project wrapper for OpenSSL yesterday, by Stephen Lombardo. This is an XCode project file that contains a target to build OpenSSL from source, and works with both Mac and iOS projects. I made some modifications to it, in order to make it work by just dropping in the OpenSSL source tarball, without having to dirty up your source tree with the extracted OpenSSL distribution.
Here’s how to use it:
- Download the OpenSSL source.
- Put the downloaded OpenSSL source tar.gz into the same folder
as openssl.xcodeproj (I put it in
Library/opensslwithin my project tree). - Drag the openssl.xcodeproj file into your main project tree in XCode.
- Right-click on your project target, and add openssl.xcodeproj under “Direct Dependencies” on the General tab.
On the Build tab for your project’s target, find the “Header Search Paths” option, and add the path:
$(SRCROOT)/Library/openssl/build/openssl.build/openssl/include(Assuming you’ve put openssl.xcodeproj at the path
Library/openssl— adjust as necessary).- Expand your target’s “Link Binary With Libraries” build stage, and drag libcrypto.a from the openssl.xcodeproj group.
Then, you can just import and use as normal (#import <openssl/dsa.h>, etc).



Breaking the limits: Storing data bigger than 1 Mb in Google App Engine’s Datastore
Google App Engine is a fantastic platform for hosting webapps, and a great resource for iOS developers who need an online component to their products. It’s hard to believe that the service is essentially free! I’m using it with The Cartographer, but I found myself coming up against a hard limit with the datastore.
You see, the datastore limits entities to 1 Mb. I’m trying to store XML data in there, and sometimes that can exceed the 1 Mb limit.
XML being the verbose creature that it is compresses very nicely, so it occurred to me that if I selectively compress the larger blocks, I should be able to quite easily squeeze in underneath the limit. Sure enough, a 1.6 Mb XML block compressed into about 200 Kb.
App Engine makes it very easy to define custom properties on data models, so I’ve written a
CompressibleTextPropertyclass that automatically compresses/decompresses properties above a certain size. This means that there’s no performance loss for entities that are small enough to fit easily, but still enables the storage of bigger blocks of content.The alternative was to break entities up into several different database entities, but this sounded like much more work, and sounded much less elegant.
So here’s what I came up with — it’s used the same way the other Property types are used. Read More »