]>
git.saurik.com Git - apple/security.git/blob - Security/libsecurity_codesigning/lib/detachedrep.h
2 * Copyright (c) 2006-2008,2011-2013 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 // detachedrep - prefix diskrep representing a detached signature stored in a file
27 #ifndef _H_DETACHEDREP
28 #define _H_DETACHEDREP
34 namespace CodeSigning
{
38 // We use a DetachedRep to interpose (filter) the genuine DiskRep representing
39 // the code on disk, *if* a detached signature was set on this object. In this
40 // situation, mRep will point to a (2 element) chain of DiskReps.
42 // This is a neat way of dealing with the (unusual) detached-signature case
43 // without disturbing things unduly. Consider DetachedDiskRep to be closely
44 // married to SecStaticCode; it's unlikely to work right if you use it elsewhere.
46 // Note that there's no *writing* code here. Writing detached signatures is handled
47 // specially in the signing code.
49 class DetachedRep
: public FilterRep
{
51 DetachedRep(CFDataRef sig
, DiskRep
*orig
, const std::string
&source
); // SuperBlob of all architectures
52 DetachedRep(CFDataRef sig
, CFDataRef gsig
, DiskRep
*orig
, const std::string
&source
); // one architecture + globals
54 CFDataRef
component(CodeDirectory::SpecialSlot slot
);
56 bool fullSignature() const { return mFull
; }
57 const std::string
&source() const { return mSource
; }
60 CFCopyRef
<CFDataRef
> mSig
, mGSig
;
61 bool mFull
; // full detached signature (explicitly given)
62 const EmbeddedSignatureBlob
*mArch
; // current architecture; points into mSignature
63 const EmbeddedSignatureBlob
*mGlobal
; // shared elements; points into mSignature
64 std::string mSource
; // source description (readable)
68 } // end namespace CodeSigning
69 } // end namespace Security
71 #endif // !_H_DETACHEDREP