Skip to content
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

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

Closed
choichai opened this issue Dec 30, 2023 · 9 comments
Closed

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

choichai opened this issue Dec 30, 2023 · 9 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@choichai
Copy link

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 codemonkey85 self-assigned this Dec 30, 2023
@codemonkey85 codemonkey85 added the bug Something isn't working label Dec 30, 2023
@codemonkey85
Copy link
Owner

codemonkey85 commented Dec 30, 2023

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

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

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.

@codemonkey85 codemonkey85 changed the title Doesn't work on Pokemon Moon Can't export BDSP, SM, or USUM Mar 17, 2024
@choichai
Copy link
Author

@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
Copy link
Owner

@choichai Unfortunately yes, BDSP is included in this.

@ciurlaro
Copy link

ciurlaro commented Apr 9, 2024

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

@codemonkey85
Copy link
Owner

codemonkey85 commented Apr 10, 2024

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 codemonkey85 added the question Further information is requested label May 1, 2024
@codemonkey85
Copy link
Owner

@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
Copy link
Author

choichai commented May 19, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants