]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_codesigning/lib/filediskrep.h
2 * Copyright (c) 2006-2007,2011 Apple 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 // filediskrep - single-file executable disk representation
27 #ifndef _H_FILEDISKREP
28 #define _H_FILEDISKREP
30 #include "singlediskrep.h"
32 #include <security_utilities/cfutilities.h>
35 namespace CodeSigning
{
39 // A FileDiskRep represents a single code file on disk. We assume nothing about
40 // the format or contents of the file and impose no structure on it, other than
41 // assuming that all relevant code is contained in the file's data bytes.
42 // By default, we seal the entire file data as a single page.
44 // This is the ultimate fallback disk format. It is used if no other pattern
45 // applies. As such it is important that we do not introduce any assumptions
46 // here. Know that you do not know what any of the file means.
48 // FileDiskrep stores components in extended file attributes, one attribute
49 // per component. Note that this imposes size limitations on component size
50 // that may well be prohibitive in some applications.
52 // This DiskRep does not support resource sealing.
54 class FileDiskRep
: public SingleDiskRep
{
56 FileDiskRep(const char *path
);
58 CFDataRef
component(CodeDirectory::SpecialSlot slot
);
61 const Requirements
*defaultRequirements(const Architecture
*arch
, const SigningContext
&ctx
);
64 DiskRep::Writer
*writer();
69 CFDataRef
getAttribute(const char *name
);
70 static std::string
attrName(const char *name
);
75 // The write side of a FileDiskRep
77 class FileDiskRep::Writer
: public SingleDiskRep::Writer
{
78 friend class FileDiskRep
;
80 void component(CodeDirectory::SpecialSlot slot
, CFDataRef data
);
83 bool preferredStore();
86 Writer(FileDiskRep
*r
) : SingleDiskRep::Writer(r
, writerLastResort
) { }
87 RefPointer
<FileDiskRep
> rep
;
88 std::set
<std::string
> mWrittenAttributes
;
92 } // end namespace CodeSigning
93 } // end namespace Security
95 #endif // !_H_FILEDISKREP