Last fall I got a new iMac that I only use during the Weekends. I’ve just recently noticed that I still didn’t have Code Signing running. I’ve done quite some searching and even tried to debug what codesign does when it tries to match certificates. Only then I noticed that even though I had all certificates in place, the problem was that these Certificates needed the private key as well. The fix was as simple as exporting and importing the private key from one mac to the other.
As I’ve had problems with Code Signing before, I decided that it’d be a lot more helpful to not have to google around the webs like crazy over and over again but instead have some app that contains the knowledge and gives proper tips.
The result is CertificateHelper, which you can find over at GitHub. Currently it only supports those problems that I was having (no certificates/no private key).
To add new Problems to the app, simply subclass CertificateProblem and implement the following methods:
- + (void) load - here you need to call [self registerSubclass] so that the app finds this new problem
- + (id) problemIfExists - this method returns an instance of the class or nil, depending of if the problem exists or not
- - (NSString*) htmlDescription – a small snippet of HTML code that describes the problem and how to solve it
- - (NSArray*) infoObjects – objects that are displayed at the bottom list, if needed (defaults to an empty array
- - (ProblemSeverity) severity – returns the severity of the problem. If multiple problems occur, this value is used to sort the problems. The one with the highest severity is then displayed to the user.
I think the most problematic part of the implementation is the work with the keychain. There’s the CertificateAccess class right now which tries to simplifies that.