2 * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 // signer - Signing operation supervisor and controller
30 #include "CodeSigner.h"
31 #include "cdbuilder.h"
32 #include "signerutils.h"
33 #include "StaticCode.h"
34 #include <security_utilities/utilities.h>
37 namespace CodeSigning
{
41 // The signer driver class.
42 // This is a workflow object, containing all the data needed for the various
43 // signing stages to cooperate. It is not meant to be API visible; that is
44 // SecCodeSigner's job.
46 class SecCodeSigner::Signer
{
48 Signer(SecCodeSigner
&s
, SecStaticCode
*c
) : state(s
), code(c
) { }
49 void sign(SecCSFlags flags
);
52 SecStaticCode
* const code
;
55 void signMachO(Universal
*fat
); // sign a Mach-O binary
56 void signArchitectureAgnostic(); // sign anything else
58 void populate(DiskRep::Writer
&writer
); // global
59 void populate(CodeDirectory::Builder
&builder
, DiskRep::Writer
&writer
,
60 InternalRequirements
&ireqs
, size_t offset
= 0, size_t length
= 0); // per-architecture
61 CFDataRef
signCodeDirectory(const CodeDirectory
*cd
);
64 RefPointer
<DiskRep
> rep
; // DiskRep of Code being signed
65 CFRef
<CFDataRef
> resourceDirectory
; // resource directory
66 std::string identifier
; // signing identifier
67 uint32_t cdFlags
; // CodeDirectory flags
68 size_t pagesize
; // size of main executable pages
69 CFAbsoluteTime signingTime
; // signing time for CMS signature (0 => none)
73 } // end namespace CodeSigning
74 } // end namespace Security
76 #endif // !_H_CODESIGNER