Open joelwright-dev opened 2 years ago
Please provide code for reproducing.
try this test
const publicKey = this.keyPair.getPublic().encode('hex');
const privateKey = this.keyPair.getPrivate('hex');
this.logger.error('keyPair::publicKey::', publicKey);
this.logger.error('keyPair::privateKey::', privateKey);
this.logger.warn("testKeys::recoveringValues");
const recKeyPar = ec.keyFromPrivate(privateKey,'hex');
const recPublicKey = recKeyPar.getPublic().encode('hex');
const recPrivateKey = recKeyPar.getPrivate('hex');
this.logger.error('rec::publicKey::', recPublicKey);
this.logger.error('rec::privateKey::', recPrivateKey);
Hello all,
I'm writing a basic program to get the public key from a private key using this code:
return ec.keyFromPrivate(privateKey).getPublic('hex')
Where the privateKey is: 88575082256327777067088293295661531980671099272597078688043162004071352566123
To my knowledge, inputting this to the keyFromPrivate and getting the public key from it should give me the same value as the public key given to me in the genKeyPair() function which is: 040c395a32ce951496ff2610e57d50319d388744b84d02a0b407f3634691903252307ec63939cbd2b391545411e90c79feedece1b621150665480ea10416aa2e4f
However, this code returns a different key: 0459a50ae3c8c4015aa867d5a667b1cd7767100b66378a700df15de01e44ca509be402e8e2b8280538349844f94fc1c5f34d61b70717380cfd797d83975a5f957d
If anyone could help that would be greatly appreciated.