Hi folks,

I am currently playing around with bitcoinj to see if it fits my 
requirements. During that I stumbled over the problem on how to properly 
destroy a wallet (more precisely I am more concerned about the privKey of 
its ECKey). 
Looking at the code, I have the impression that this is not considered 
properly so far: 

   - ECKey has a privKey, which is a BigDecimal. 
   - BigDecimals are immutable 
   <https://bugs.openjdk.java.net/browse/JDK-5061398> and thus cannot be 
   destroyed, only garbage collected.
   - There is also no "setPrivKey" method at ECKey, such that you may take 
   control over the instance at least (but that would also be of little help 
   either).
   - getPrivKeyBytes() of ECKey may return you a byte-array-based 
   representation, but that's just another copy of the BigDecimal.

Moreover, I see that getPrivKeyBytes() of ECKey is being used several 
times, but the byte-array copies are also not destructed properly. 


Though I don't directly see an exploitable attack vector for this, it still 
leaves me an unpleasant feeling in my stomach.

What are the current plans in this direction and how should a consumer 
properly destroy a wallet in memory (Background: my application intends to 
allow the usage of multiple wallets in sequence)?

How do you solve this issue?


Thanks for your thoughts on this!


Kind regards,

Nico


-- 
You received this message because you are subscribed to the Google Groups 
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to