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

Serialising a SignedData value with a large, embedded content takes seconds to complete #57

Open
gnarea opened this issue Mar 19, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@gnarea
Copy link
Member

gnarea commented Mar 19, 2020

Generating a DER-encoded SignedData value with a content of 8 MiB takes 6-9 seconds on my computer, which could make the public gateway susceptible to severe availability issues.

Nearly all that time is spent serialising the ContentInfo/SignedData object to a DER ByteArray (constructing those objects and calling SignedData.sign() takes 60ms and 5ms, respectively). Roughly 66% of the serialisation time is spent encoding the SignedData value and the remainder serialising the ContentInfo wrapper.

Verifying such large values takes just over 300ms on the same computer after some optimisations.

The culprit has to be the ASN1.js and/or PKI.js libraries, although having the plaintext embedded in the CMS SignedData certainly doesn't help. So broadly speaking, our options are:

@gnarea gnarea added the bug Something isn't working label Mar 19, 2020
@gnarea gnarea added this to the Production release milestone Mar 19, 2020
@gnarea gnarea changed the title Deserialising a message with a large payload can take seconds to complete Serialising a SignedData value with a large, embedded content takes seconds to complete Mar 22, 2020
@gnarea
Copy link
Member Author

gnarea commented Mar 22, 2020

This is actually an issue with the spec as the JVM library is also affected, so I'll track this bug in AwalaApp/specs#57

@gnarea gnarea closed this as completed Mar 22, 2020
@gnarea
Copy link
Member Author

gnarea commented May 13, 2022

I'm reopening this so that I can track it in the Maintenance board for Relaycorp.

@gnarea gnarea reopened this May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant