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

Reading ['encrypted_content'] is very slow while parsing a CMS envelope. #227

Open
abhinav-mishra-db opened this issue May 5, 2022 · 2 comments

Comments

@abhinav-mishra-db
Copy link

I am parsing envelope encrypted audio files. I can quickly extract all parameters from the envelope object such as 'Key Encryption Key' and details of algorithms. But when extracting the symmetrically encrypted content ('encrypted_content']); the library takes unacceptable amount of time. e.g. for a 48 MB file this step takes approx. 2 minutes. Please suggest if I am doing anything wrong.

from asn1crypto import cms
# the slow step
# file_content is the bytes read.
cms.ContentInfo.load(file_content))['content']['encrypted_content_info']['encrypted_content'].native

@abhinavdrs
Copy link

help please :))

@wbond
Copy link
Owner

wbond commented Oct 18, 2022

This is likely a result of overhead related to specific encoding decisions in the ASN.1 modules, combined with Python runtime performance characteristics.

The first step would be to profile and see where the time is being spent. Then we can determine if there is a bug to fix. If generally it is just the overhead of parsing binary data with Python, then the solution would potentially being some sort of optional, C-based parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants