]>
git.saurik.com Git - apple/security.git/blob - Security/libsecurity_codesigning/gke/gkunpack.cpp
2 // gkunpack - an ad-hoc tool for unpacking certain binary data from a detached code signature
4 // gkunpack <detached_signature_data >prescreen_filter_data
6 #include <security_utilities/macho++.h>
7 #include <security_codesigning/codedirectory.h>
8 #include <security_codesigning/sigblob.h>
10 using namespace CodeSigning
;
13 int main(int argc
, const char * argv
[])
15 if (const EmbeddedSignatureBlob
*top
= (const EmbeddedSignatureBlob
*)BlobCore::readBlob(stdin
)) {
16 if (top
->magic() == DetachedSignatureBlob::typeMagic
) { // multiple architectures - pick the native one
17 Architecture local
= Architecture::local();
18 const EmbeddedSignatureBlob
*sig
= EmbeddedSignatureBlob::specific(top
->find(local
.cpuType()));
20 sig
= EmbeddedSignatureBlob::specific(top
->find(local
.cpuType() & ~CPU_ARCH_MASK
));
24 if (const CodeDirectory
*cd
= top
->find
<const CodeDirectory
>(cdCodeDirectorySlot
)) {
25 printf("%s\n", cd
->screeningCode().c_str());
29 fprintf(stderr
, "Invalid signature structure\n");