-
-
Notifications
You must be signed in to change notification settings - Fork 287
Fix for encryption issue #429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great bug find on this one. Just a few small changes and can can you sign the CLA agreement?
|
||
namespace Akavache.Tests | ||
{ | ||
public class BasicEncryptionTests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix spelling on file name
@@ -9,6 +9,20 @@ | |||
|
|||
namespace Akavache | |||
{ | |||
#if PORTABLE ||NET_461 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Portable target doesn't get applied to this class as nothing in shared will get applied to netstandard. I realize netstandard 2.0 include the api for this but we probably still don't want to use it. We don't really gain anything from doing that.
What if we simplify the changes in this class down to
using System;
using System.Reactive.Linq;
#if NET_461
using RxCrypt = System.Security.Cryptography;
#else
using RxCrypt = Akavache;
#endif
namespace Akavache
{
public class EncryptionProvider : IEncryptionProvider
{
public IObservable<byte[]> EncryptBlock(byte[] block)
{
return Observable.Return(RxCrypt.ProtectedData.Protect(block, null, RxCrypt.DataProtectionScope.CurrentUser));
}
public IObservable<byte[]> DecryptBlock(byte[] block)
{
return Observable.Return(RxCrypt.ProtectedData.Unprotect(block, null, RxCrypt.DataProtectionScope.CurrentUser));
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is much cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've signed the CLA. Please let me know if there is anything else I need to do.
Changes from pull request.
Thanks everyone! |
This is a possible fix for #428
This should use the data protection API for .net and .net standard frameworks.