Skip to content

.NET5 Browser Cryptography Support #40076

Closed

Description

@marek-safar

A list of types which would be useful to get working with browser-wasm before we land #40074

  • IncrementalHash
  • MD5
  • SHA1
  • SHA256
  • SHA384
  • SHA512

Activity

  1. added this to the 5.0.0 milestone on Jul 29, 2020
  2. added
    untriaged
    on Jul 29, 2020
  3. removed
    untriaged
    on Jul 29, 2020
  4. vcsjones commented on Jul 29, 2020

    @vcsjones
    Member

    IncrementalHash

    This might be interesting, since the webcrypto hashing functions are one shot, that is they do not support incremental hashing.

    I suppose IncrementalHash could be supported by allowing one call to AppendData, and throw PNSE if multiple calls are made, to at least support using IncrementalHash non-incrementally..

    If this "works" before webcrypto is used, it will not be able to move to webcrypto without accepting that limitation.

  5. akoeplinger commented on Jul 29, 2020

    @akoeplinger
    Member

    I suppose IncrementalHash could be supported by allowing one call to AppendData, and throw PNSE if multiple calls are made, to at least support using IncrementalHash non-incrementally..

    Alternatively we could buffer the data and only call into the browser when the hash value is retrieved.

  6. lewing commented on Jul 29, 2020

    @lewing
    Member

    I'm not sure that IncrementalHash actually helps us as is, the problem is still that all the browser apis return a Promise and there is (by design) no way to synchronously wait on that Promise.

  7. marek-safar commented on Jul 29, 2020

    @marek-safar
    ContributorAuthor

    I'm not sure that IncrementalHash actually helps us as is

    It's not about helping but supporting that API in browser. This API looks to be used by for example Roslyn.

  8. jeffhandley commented on Aug 26, 2020

    @jeffhandley
    Member

    @marek-safar Should this still be in the 5.0.0 milestone or can this move to 6.0.0 since #40074 is in 6.0.0?

  9. 15 remaining items

  10. akoeplinger commented on Sep 3, 2020

    @akoeplinger
    Member

    @marek-safar release/5.0-rc2 will be merged back into release/5.0 so this shouldn't be necessary (unless you want to have it for RC1 which as I understand is pretty much done).

  11. marek-safar commented on Sep 3, 2020

    @marek-safar
    ContributorAuthor

    I don't want to have this in RC1 but would like to have it in release/5.0 as soon as possible to increase the testing time

  12. secana commented on Sep 3, 2020

    @secana

    Will MD5 be included, too? Unfortunately it is heavily used in the industry branch I'm working in and as such needed.

  13. akoeplinger commented on Sep 3, 2020

    @akoeplinger
    Member

    @secana no unfortunately MD5 isn't and won't be included. You'd need to compile your own version of the MD5 algorithm into your app.

  14. secana commented on Sep 3, 2020

    @secana

    @akoeplinger thx for the fast reply. I guess that will work, too.

  15. added a commit that references this issue on Sep 3, 2020
  16. julienGrd commented on Sep 15, 2020

    @julienGrd

    Is SHA256 will be included ? im stuck since preview 6 with this exception (im currently in RC1)

    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.↵ ---> System.PlatformNotSupportedException: System.Security.Cryptography.Algorithms is not supported on this platform.↵   at System.Security.Cryptography.SHA256..ctor()↵   at System.Security.Cryptography.SHA256Managed..ctor()↵ 
    
    

    guys please tell me is not reported to .NET 6...

  17. marek-safar commented on Sep 15, 2020

    @marek-safar
    ContributorAuthor

    @julienGrd yes, it's supported but you wait for RC2

  18. andersson09 commented on Sep 15, 2020

    @andersson09

    @marek-safar Any idea if the zip libraries will be supported? Currently unzipping a password protected zip gives the following exception. Looks like Rfc2898DeriveBytes is the issue:

    Unhandled exception rendering component: System.Security.Cryptography is not supported on Browser.
    System.PlatformNotSupportedException: System.Security.Cryptography is not supported on Browser.
    at System.Security.Cryptography.DeriveBytes..ctor()
    at System.Security.Cryptography.Rfc2898DeriveBytes..ctor(String password, Byte[] salt, Int32 iterations)
    at Ionic.Zip.WinZipAesCrypto._GenerateCryptoBytes()
    at Ionic.Zip.WinZipAesCrypto.get_GeneratedPV()
    at Ionic.Zip.WinZipAesCrypto.ReadFromStream(String password, Int32 KeyStrengthInBits, Stream s)
    at Ionic.Zip.ZipEntry.SetupCryptoForExtract(String password)
    at Ionic.Zip.ZipEntry.EnsurePassword(String password)
    at Ionic.Zip.ZipEntry.InternalExtractToStream(Stream outStream, String password, ZipContainer zipContainer, ZipEntrySource zipEntrySource, String fileName)
    at Ionic.Zip.ZipEntry.Extract(Stream stream)

  19. andersson09 commented on Sep 15, 2020

    @andersson09

    @marek-safar Thanks. Is there a plan for a fix for this? Does this mean it will be released end of 2021 for .net6 release or earlier within a .net 6 preview?

  20. lewing commented on Sep 15, 2020

    @lewing
    Member

    @andersson09 it won't be fixed in net5.0 we are hoping to have a solution for net6.0

  21. volaru77 commented on Sep 15, 2020

    @volaru77

    Will there be any browser encryption support in .NET 5 at all (AES, RSA, etc)? Or at least a commitment to address crypto related regressions from .NET Core 3.1 to .NET 5 in .NET 6? Right now it's very difficult to decide what to do with browser projects that cannot be transitioned from .NET Core 3.1 to .NET 5 because of this situation; if they are a dead end that should be abandoned, or it is just a temporary setback.

  22. marek-safar commented on Sep 15, 2020

    @marek-safar
    ContributorAuthor

    @volaru77 no encryption support in .NET 5. For future version please follow up on #40074

  23. ghost locked as resolved and limited conversation to collaborators on Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-wasmarea-System.Security

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions