/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. #import <Foundation/Foundation.h>
  9. @class Signer;
  10. // PlistSigner
  11. //
  12. // Instances of this class use a Signer instance to sign, validate, and unsign
  13. // property lists.
  14. //
  15. // Example:
  16. //
  17. // NSData *publicKey = [NSData dataWithContentsOfFile:...];
  18. // Signer *signer = [Signer signerWithPublicKey:publicKey privateKey:nil];
  19. // NSDictionary *plist = ...
  20. //
  21. // PlistSigner *plistSigner = [[PlistSigner alloc] initWithSigner:signer
  22. // plist:plist];
  23. // if ([plistSigner isPlistSigned]) {
  24. // ...
  25. // }
  26. //
  27. @interface PlistSigner : NSObject {
  28. @private
  29. Signer *signer_;
  30. NSDictionary *plist_;
  31. }
  32. // Designated initializer. The returned instance will use |signer| to sign and
  33. // verify the |plist|.
  34. - (id)initWithSigner:(Signer *)signer plist:(NSDictionary *)plist;
  35. // Returns the plist. This plist may be different than the one passed to the
  36. // initializer because the plist may have been signed or the signature may have
  37. // been removed.
  38. - (NSDictionary *)plist;
  39. // Returns YES if the plist is already signed, and the signature is valid.
  40. - (BOOL)isPlistSigned;
  41. // Signs the plist, and returns YES if all went well.
  42. - (BOOL)signPlist;
  43. // Removes the signature from the plist.
  44. - (BOOL)unsignedPlist;
  45. @end