]>
Commit | Line | Data |
---|---|---|
b1ab9ed8 A |
1 | #ifndef __APPLE_MANIFEST__ |
2 | #define __APPLE_MANIFEST__ | |
3 | ||
4 | ||
5 | ||
6 | /* | |
d8f41ccd | 7 | * Copyright (c) 2004,2011,2014 Apple Inc. All Rights Reserved. |
b1ab9ed8 A |
8 | * |
9 | * @APPLE_LICENSE_HEADER_START@ | |
10 | * | |
11 | * This file contains Original Code and/or Modifications of Original Code | |
12 | * as defined in and that are subject to the Apple Public Source License | |
13 | * Version 2.0 (the 'License'). You may not use this file except in | |
14 | * compliance with the License. Please obtain a copy of the License at | |
15 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
16 | * file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
25 | * | |
26 | * @APPLE_LICENSE_HEADER_END@ | |
27 | */ | |
28 | ||
29 | ||
30 | ||
31 | #include "ManifestSigner.h" | |
32 | #include <Security/SecCmsBase.h> | |
33 | #include <vector> | |
34 | ||
35 | ||
36 | typedef std::vector<SecIdentityRef> SignerList; | |
37 | ||
38 | class AppleManifest : public ManifestSigner | |
39 | { | |
40 | protected: | |
41 | void AddDataBlobToManifest (CFMutableDataRef manifest, ManifestDataBlobItem* db); | |
42 | void AddDirectoryToManifest (CFMutableDataRef manifest, ManifestDirectoryItem* directory); | |
43 | void AddFileToManifest (CFMutableDataRef manifest, ManifestFileItem* file); | |
44 | void AddSymLinkToManifest (CFMutableDataRef manifest, ManifestSymLinkItem* file); | |
45 | void AddOtherToManifest (CFMutableDataRef manifest, ManifestOtherItem* other); | |
46 | void AddManifestItemListToManifest (CFMutableDataRef manifest, ManifestItemList &itemList); | |
47 | void CreateManifest (CFMutableDataRef manifest, ManifestInternal& internalManifest); | |
48 | ||
49 | void AddSignersToCmsMessage (SecCmsMessageRef cmsMessage, SecCmsSignedDataRef signedData); | |
50 | ||
51 | void ReconstructDataBlob (uint32& finger, const uint8* data, ManifestDataBlobItem*& db); | |
52 | void ReconstructDirectory (uint32& finger, const uint8* data, ManifestDirectoryItem*& directory); | |
53 | void ReconstructFile (uint32& finger, const uint8* data, ManifestFileItem *& file); | |
54 | void ReconstructSymLink (uint32& finger, const uint8* data, ManifestSymLinkItem*& file); | |
55 | void ReconstructOther (uint32& finger, const uint8* data, ManifestOtherItem*& other); | |
56 | void ReconstructManifestItemList (uint32 &finger, const uint8* data, ManifestItemList &itemList); | |
57 | void ReconstructManifest (uint8* data, uint32 length, ManifestInternal& manifest); | |
58 | ||
59 | SignerList mSignerList; | |
60 | ||
61 | SecCmsMessageRef GetCmsMessageFromData (CFDataRef data); | |
62 | ||
63 | public: | |
64 | AppleManifest (); | |
65 | virtual ~AppleManifest (); | |
66 | ||
67 | virtual CFDataRef Export (ManifestInternal& manifest); | |
68 | void Verify (CFDataRef data, SecManifestTrustSetupCallback setupCallback, void* setupContext, | |
69 | SecManifestTrustEvaluateCallback evaluateCallback, void* evaluateContext, | |
70 | SecPolicyRef policyRef, ManifestInternal *manifest); | |
71 | virtual void AddSigner (SecIdentityRef identityRef); | |
72 | }; | |
73 | ||
74 | ||
75 | ||
76 | #endif |