TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | BSD |
ReleasedLast Release | Feb 2016 |
Maintained by Guilherme Rambo.
Simple code signature verification for OS X apps.
GRCodeSignatureVerifier can be used to check if an app has been tampered with by verifying It's code signature.
let verifier = GRCodeSignatureVerifier.sharedInstance()
// requirements are optional, but they make the verification stronger
verifier.codeRequirements = "identifier = \"com.yourcompany.AppName\""
if !verifier.isSignatureValid {
NSLog("The app was modified. Exiting... \(verifier.validationError)")
exit(1)
}
GRCodeSignatureVerifier *verifier = [GRCodeSignatureVerifier sharedInstance];
verifier.codeRequirements = @"identifier = \"com.yourcompany.AppName\"";
if (!verifier.isSignatureValid) {
NSLog("The app was modified. Exiting... %@", verifier.validationError);
exit(1);
}
You can use the tool csreq
to compile code requirements:
$ csreq -r requirements.txt -b requirements.bin
To use precompiled code requirements you set the codeRequirementsData
property:
verifier.codeRequirementsData = [NSData dataWithContentsOfFile:@"/path/to/requirements.bin"];
To learn more about what are code requirements and the code requirements language, check out this document from Apple.
Just download the code and add GRCodeSignatureVerifier.framework
to the Embedded Binaries
section of your app's target config.
Alternatively, you can just drop GRCodeSignatureVerifier.h
and GRCodeSignatureVerifier.m
in your app and use It directly.