public LocalRecordStore(IRecord record, StorageFolder folder, string encryptionKey)
        {
            IObjectStore store = new FolderObjectStore(folder);
            if (!String.IsNullOrEmpty(encryptionKey))
            {
                store = new EncryptedObjectStore(store, new Cryptographer(), encryptionKey);
            }

            Initialize(record, store, null);
        }
        private void HandleEncryptionSetCache()
        {
            // Set up the encrypted local vault
            if (m_appSettings.UseEncryption)
            {
                var encryptedStore = new EncryptedObjectStore(
                    FolderObjectStore.CreateRoot(m_appSettings.Folder),
                    Client.Cryptographer,
                    Client.State.ProvisioningInfo.SharedSecret);

                m_localVault = new LocalVault(
                    this,
                    FolderObjectStore.CreateRoot(m_appSettings.Folder),
                    encryptedStore);
            }

            // Set the cache setting
            m_localVault.RecordStores.MaxCachedItems = m_appSettings.MaxCachedItems;
        }
        static IObjectStore CreateObjectStore(StorageFolder container, string encryptionKey)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            IObjectStore store = new FolderObjectStore(container);
            if (!string.IsNullOrEmpty(encryptionKey))
            {
                store = new EncryptedObjectStore(store, new Cryptographer(), encryptionKey);
            }

            return store;
        }