redundant use of ASN1_Node
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.6k
- Forks
- 3.5k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 61
Description
This is really small, and not a bug - but I want to make sure that I'm not crazy and there is no good reason for doing this.
Here, electrum calls _parseASN1PrivateKey with ASN1_Node(bytes)
https://github.com/spesmilo/electrum/blob/30a7952cbb2e1c59c5eabaaee64d8a4e15a1b0cb/lib/pem.py#L168
And in _parseASN1PrivateKey, its creates s = ASN1_Node(s) from the input.
https://github.com/spesmilo/electrum/blob/30a7952cbb2e1c59c5eabaaee64d8a4e15a1b0cb/lib/pem.py#L175-L176
So ultimately, it's creating s = ASN1_Node(ASN1_Node(bytes)), which I don't see any reason for doing.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read lib/pem.py at _parseASN1PrivateKey and its caller around the linked lines. Confirm how ASN1_Node is constructed and remove only the redundant wrapping while preserving private-key parsing behavior. Done means the input is wrapped once and the relevant parsing checks still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- security
- Issue type
- Refactor
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100