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

Signing large RAMF payloads takes too long and requires too much memory #57

Open
gnarea opened this issue Mar 22, 2020 · 2 comments
Open
Labels
bug Something isn't working spec-ramf RAMF

Comments

@gnarea
Copy link
Member

gnarea commented Mar 22, 2020

Serialising payloads of up to 8 MiB takes too long in the JS library and results in heap space issues on the JVM.

Those issues go away when the content is detached, so we should detach it. This regression was introduced in #52.

This is just a tactical change for the signature of large payloads. Encrypting such payloads remains an issue and it's tracked on #14.

@gnarea gnarea added bug Something isn't working spec-ramf RAMF labels Mar 22, 2020
@gnarea gnarea added this to the Production-ready milestone Mar 22, 2020
@gnarea gnarea changed the title Processing large RAMF payloads takes too long and requires too much memory Signing large RAMF payloads takes too long and requires too much memory Mar 22, 2020
@gnarea
Copy link
Member Author

gnarea commented Apr 30, 2020

This is no longer an issue on the JS implementation since changing the PKI.js backend to a pure Node.js one: relaycorp/relaynet-core-js@d2d2934

@gnarea
Copy link
Member Author

gnarea commented May 13, 2022

This issue is back in the JS implementation, although I think it's for a different reason: The original problem was that we were using a slow WebCrypto implementation (for RSA-PSS+SHA-256 at least), but now the problem seems to be the ASN.1 DER serialisation... So we must absolutely detach the plaintext. (Something must've changed in asn1js or PKI.js)

This is how long it's taking to process an 8 MiB RAMF message with the JS implementation on my computer (which is quite powerful):

  • Generation: 13319 ms, of which 13252 ms correspond to SignedData.sign().
  • Consumption: 3064 ms, of which 3018 ms correspond to SignedData.verify().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working spec-ramf RAMF
Projects
None yet
Development

No branches or pull requests

1 participant