Private key shouldn't be string
See original GitHub issueI don’t know why do we have this?. I’m expecting these key to be a Uint8Array
.
https://github.com/ethers-io/ethers.js/blob/master/packages/hdnode/src.ts/index.ts#L76
Since the string won’t be wipe off from the memory easy and I don’t thing people willing leave their unencrypted private key floating in the memory.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Why Private Keys Should Not be Shared - DigiCert.com
Shared private keys open up the possibility for stolen keys, and stolen keys can mean signed software with vulnerabilities or malware being ...
Read more >How to store a private key in string literal in C? - Stack Overflow
It has been said already, but I'd like to reiterate that something like that shouldn't be done with any keys and data that...
Read more >How great is the risk in publicly sharing part of a private key?
Private keys do not provide security by having a large keyspace, they provide security through the difficulty of factoring huge semiprimes.
Read more >Receiving a private key from server admin: ok or not?
Giving the private key to you is lazy -- yes, but nothing can stop you from replacing it yourself. In essence, after s/he...
Read more >SecureString Class (System.Security) - Microsoft Learn
Security; public class Example { public static void Main() { // Instantiate ... SecureString securePwd = new SecureString(); ConsoleKeyInfo key; Console.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve added a short note here, but I think that is all that really makes about sense. The JavaScript world is one with a lot of environments and while I think security is very important, there is only so much detail I can go into.
Feel free to suggest expansions to the security section though. 😃
Yes, everything make sense. Just remind that with
Uint8Array
we are able to zeroed memory area what was allocated. You are right about encrypt/decrypt private key is annoying according to user experience but the person who’s using this package not only using it in front-end of dApp, some of us try to bring into the back-end (helping our customer to deal with blockchain easier without knowledge of blockchain stuffs), at this point I hope we would have some thing sort of feature that alternative to mist wallet..unlock(address, duration);
and.lock(address)
, I think this approach make sense too, unencrypted private key only appear for a short duration instead of living in the memory like a zombie.Just check and garbage collector won’t fill the memory with zero that’s even worser than the thing we talk here. In my experiment I need debug permit to read node’s memory.