8000 Fix for encryption issue by erik-hooper · Pull Request #429 · reactiveui/Akavache · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 2 commits into from
Oct 16, 2018
Merged

Fix for encryption issue #429

merged 2 commits into from
Oct 16, 2018

Conversation

erik-hooper
Copy link
Contributor

This is a possible fix for #428
This should use the data protection API for .net and .net standard frameworks.

@dnfclas
Copy link
dnfclas commented Oct 10, 2018

CLA assistant check
All CLA requirements met.

Copy link
Collaborator
@PureWeen PureWeen left a 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
Copy link
Collaborator

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
Copy link
Collaborator

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));
        }
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is much cleaner.

Copy link
Contributor Author

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.

@PureWeen PureWeen merged commit bcd05b4 into reactiveui:master Oct 16, 2018
@erik-hooper
Copy link
Contributor Author

Thanks everyone!

@lock lock bot locked and limited conversation to collaborators Jun 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0