PageRenderTime 22ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/core/autoinstaller/UpdateEngineExtensions/PlistSigner.h

http://macfuse.googlecode.com/
C++ Header | 55 lines | 13 code | 10 blank | 32 comment | 0 complexity | b8d93c74bf7bb18237bbeff1fab036dc MD5 | raw file
 1//
 2//  SignedPlist.h
 3//  autoinstaller
 4//
 5//  Created by Greg Miller on 7/18/08.
 6//  Copyright 2008 Google Inc. All rights reserved.
 7//
 8
 9#import <Foundation/Foundation.h>
10
11
12@class Signer;
13
14// PlistSigner
15//
16// Instances of this class use a Signer instance to sign, validate, and unsign
17// property lists.
18//
19// Example:
20//
21// NSData *publicKey = [NSData dataWithContentsOfFile:...];
22// Signer *signer = [Signer signerWithPublicKey:publicKey privateKey:nil];
23// NSDictionary *plist = ...
24//
25// PlistSigner *plistSigner = [[PlistSigner alloc] initWithSigner:signer
26//                                                          plist:plist];
27// if ([plistSigner isPlistSigned]) {
28//    ...
29//  }
30//
31@interface PlistSigner : NSObject {
32 @private
33  Signer *signer_;
34  NSDictionary *plist_;
35}
36
37// Designated initializer. The returned instance will use |signer| to sign and
38// verify the |plist|.
39- (id)initWithSigner:(Signer *)signer plist:(NSDictionary *)plist;
40
41// Returns the plist. This plist may be different than the one passed to the 
42// initializer because the plist may have been signed or the signature may have
43// been removed.
44- (NSDictionary *)plist;
45
46// Returns YES if the plist is already signed, and the signature is valid.
47- (BOOL)isPlistSigned;
48
49// Signs the plist, and returns YES if all went well.
50- (BOOL)signPlist;
51
52// Removes the signature from the plist.
53- (BOOL)unsignedPlist;
54
55@end