codemonkey85 / PKMDS-Blazor

PKMDS: Pokémon Save Editor for Web
https://pkmds.app/
The Unlicense
58 stars 10 forks source link

Can't export BDSP, SM, or USUM #12

Closed choichai closed 6 months ago

choichai commented 11 months ago

I tried to add some Pokemon in the box but when I tried to export the save file, there's always an "unhanded error" at the bottom.

codemonkey85 commented 11 months ago
I'm guessing this is the issue you ran into: ``` crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Cryptography_AlgorithmNotSupported, Aes System.PlatformNotSupportedException: Cryptography_AlgorithmNotSupported, Aes at System.Security.Cryptography.AesImplementation.CreateLiteCipher(CipherMode , ReadOnlySpan`1 , ReadOnlySpan`1 , Int32 , Int32 , Int32 , Boolean ) at System.Security.Cryptography.AesImplementation.TryEncryptEcbCore(ReadOnlySpan`1 , Span`1 , PaddingMode , Int32& ) at System.Security.Cryptography.SymmetricAlgorithm.EncryptEcb(ReadOnlySpan`1 , Span`1 , PaddingMode ) at PKHeX.Core.MemeKey.AesEncrypt(Span`1 data, Span`1 sig) at PKHeX.Core.MemeKey.AesEncrypt(Span`1 data) at PKHeX.Core.MemeCrypto.SignMemeDataInPlace(Span`1 data, MemeKeyIndex keyIndex) at PKHeX.Core.MemeCrypto.SignInPlace(Span`1 sigSpan, ReadOnlySpan`1 chkBlockSpan) at PKHeX.Core.MemeCrypto.SignInPlace(Span`1 span) at PKHeX.Core.SAV7.GetFinalData() at PKHeX.Core.SaveFile.Write(BinaryExportSetting setting) at Pkmds.Web.Layout.MainLayout.ExportSaveFileAsync() at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at MudBlazor.MudBaseButton.OnClickHandler(MouseEventArgs ev) at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task , ComponentState ) ``` image

Unfortunately until I can find decent, cheap hosting for a server-backed app, or until I can figure out how to get crypto to work in a WebAssembly context, I can't get export of save files that rely on crypto to work.

choichai commented 11 months ago

I'm guessing this is the issue you ran into: Unfortunately until I can find decent, cheap hosting for a server-backed app, or until I can figure out how to get crypto to work in a WebAssembly context, I can't get export of save files that rely on crypto to work.

I see, that's why. Because it work perfectly on my other save files like Pokemon X and Y etc. Thank you.

codemonkey85 commented 11 months ago

No problem. For what it's worth, I am working on a solution to hopefully support these save files as well, but in the meantime I'm working on better handling of this error.

choichai commented 8 months ago

@codemonkey85 does BDSP also uses crypto? Well, I was using it on BDSP to mess a bit with but ended up with the pop up message upon exporting.

codemonkey85 commented 8 months ago

@choichai Unfortunately yes, BDSP is included in this.

ciurlaro commented 7 months ago

Hello, any more indication on how to research on this? Not very clear what's the issue and how can somebody help

codemonkey85 commented 7 months ago

Essentially Blazor WebAssembly cannot use the crypto libraries needed for these save files.

Here's some info from Microsoft: https://learn.microsoft.com/en-us/dotnet/core/compatibility/cryptography/5.0/cryptography-apis-not-supported-on-blazor-webassembly

And the PKHeX source is available here (I use PKHeX.Core to power my app): https://github.com/kwsch/PKHeX

codemonkey85 commented 6 months ago

@choichai @ciurlaro FYI, this issue is now resolved. I moved the app's hosting from WASM to server-side. You may have to clear cache / site data for it to work.

choichai commented 6 months ago

@codemonkey85 Really? Many thanks mate. I really appreciate it. You're the best 😄