]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurityd/lib/ssblob.h
Security-59306.140.5.tar.gz
[apple/security.git] / OSX / libsecurityd / lib / ssblob.h
index e39414be98214ff579fb33faa3f421944fafb7ed..145d376cdd470a17025cd70162a3c3a2e05cceed 100644 (file)
@@ -75,12 +75,18 @@ public:
     
     static const uint32 magicNumber = 0xfade0711;
 
+    static const uint32 version_none = 0x0;                 // dummy value for default parameters. Never set this as an actual version.
     static const uint32 version_MacOS_10_0 = 0x00000100;       // MacOS 10.0.x
     static const uint32 version_MacOS_10_1 = 0x00000101;       // MacOS 10.1.x and on
-       static const uint32 version_partition = 0x00000200;             // MacOS 10.11.2 and on, supporting partitioning
+    static const uint32 version_partition = 0x00000200;                // MacOS 10.11.4 and on, supporting partitioning
     static const uint32 currentVersion = version_partition;
     
-  static uint32 getCurrentVersion();
+    static uint32 getCurrentVersion();
+
+    //Returns the version this database should be, given its filesystem location (as dbName)
+    static uint32 getCurrentVersionForDb(const char* dbName);
+
+    static bool pathInHomeLibraryKeychains(const string& path);
 public:
     void initialize();
     void initialize(uint32 version);
@@ -220,6 +226,36 @@ public:
 };
 
 
+//
+// This class implements a "system keychain unlock record" store
+//
+class SystemKeychainKey {
+public:
+    SystemKeychainKey(const char *path);
+    ~SystemKeychainKey();
+
+    bool matches(const DbBlob::Signature &signature);
+    CssmKey &key();
+
+    // returns true if we have actually retrieved the key
+    bool valid();
+
+private:
+    std::string mPath;                  // path to file
+    CssmKey mKey;                       // proper CssmKey with data in mBlob
+
+    bool mValid;                        // mBlob was validly read from mPath
+    UnlockBlob mBlob;                   // contents of mPath as last read
+
+    Time::Absolute mCachedDate;         // modify date of file when last read
+    Time::Absolute mUpdateThreshold;    // cutoff threshold for checking again
+
+    static const int checkDelay = 1;    // seconds minimum delay between update checks
+
+    bool update();
+};
+
+
 } // end namespace SecurityServer
 } // end namespace Security