IEncryptionProvider ignored
I've been using a custom encryption provider for over a year but now it's ignored. I have analysed my code and I cannot see BlobCache.Secure being used before this call...
Locator.CurrentMutable.Register(() => providerInstance, typeof(IEncryptionProvider));
I've managed to get it working using this...
var cache = BlobCache.Secure;
cache.GetType().GetField("_encryption", BindingFlags.NonPublic | BindingFlags.Instance)
.SetValue(cache, providerInstance);
How is this happening? Given that Akavache doesn't set it back to the default (I've removed my call to Register), there must be a call to its static constructor somewhere prior. Could it be in Akavache's code?
Hey @FruitAndAShape :wave:,
Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our Open Collective and consider contributing financially.
https://opencollective.com/reactiveui
PS.: We offer
prioritysupport for all financial contributors. Don't forget to addprioritylabel once you start contributing :smile:
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms!
Not sure. If you provide a sample repo one of us will have a look in about a week for you.
I created a new blank forms app for iOS, then using Nuget I added Akavache 6.10.11 to both projects and this is my MainPage.xaml.cs file...
using System;
using Akavache;
using Akavache.Sqlite3;
using Splat;
using Xamarin.Forms;
namespace test
{
public static class LinkerPreserve
{
static LinkerPreserve()
{
var persistentName = typeof(SQLitePersistentBlobCache).FullName;
var encryptedName = typeof(SQLiteEncryptedBlobCache).FullName;
}
}
public class e : IEncryptionProvider
{
public IObservable<byte[]> DecryptBlock(byte[] block) => throw new NotImplementedException();
public IObservable<byte[]> EncryptBlock(byte[] block) => throw new NotImplementedException();
}
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
Locator.CurrentMutable.Register(() => new e(), typeof(IEncryptionProvider));
var cache = BlobCache.Secure;
}
}
}
cache uses the default IEncryptionProvider.
Thanks. Will have a look through the week