There is ECKey.fromPublicOnly() and ECKey.fromPrivate(). Yes, you need to convert your hex to a byte array yourself, or by using Utils.HEX like you did.
On 08/10/2017 01:27 PM, vba...@gmail.com wrote: > Actually, to compliment my last answer, I would like to add the way to > recover they ECKey if it is a public only key: > > ECKey.fromPublicOnly(Utils.HEX.decode(hexPubKey) > > > On Thursday, August 10, 2017 at 12:52:00 PM UTC+2, vba...@gmail.com wrote: > > I think that I have answered my own question. I guess that it can be > done like this: > > ECKey ecKeyFromHex = > aWalletKitApp.wallet().findKeyFromPubKey(Utils.HEX.decode(hexPubKey)); > > However, I'm still wondering if the reason why there is not a method > to do this directly > (which to me, getting an ECKey from a public key hex seems something > very common to require) is > some conceptual mistake that I have. > > > > > > On Wednesday, August 9, 2017 at 4:21:58 PM UTC+2, vba...@gmail.com > wrote: > > Dear all, > > Is there a way that I can recover an ECKey from the hex? Kind of > an inverse of ECKey.getPublicKeyAsHex. > There is something similar with > DeterministicKey.deserializeB58(base58,params). However, just > base58 is accepted. > > Or may be there is an explanation why I should not be doing that? > > Regards. -- 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 bitcoinj+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.