Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decompressing public key #34

Closed
h0vhannes opened this issue Oct 1, 2015 · 5 comments
Closed

Decompressing public key #34

h0vhannes opened this issue Oct 1, 2015 · 5 comments
Assignees
Milestone

Comments

@h0vhannes
Copy link

Hi,

decompressPublickey doesn't work at this moment. Actually, it is equal to undefined. This is due to the following commit in https://github.com/bitcoin/secp256k1
bitcoin-core/secp256k1@23cfa91#diff-0d77700fa6e05639431c962ffaa5365aL285
Here secp256k1_ec_pubkey_decompress was removed from the code, so decompressPublickey references nothing.

After all, I just want to decompress a compressed public key in node to encrypt a message with ECIES encryption having just a compressed key.

What should I do in this situation?

Thanks in advance, Hovhannes.

@h0vhannes
Copy link
Author

This is the solution if someone is interested

var elliptic = require('elliptic');
var ec = new elliptic.ec('secp256k1');
var publicKeyUncompressed = ec.keyFromPublic(PublicKeyCompressed, 'hex').getPublic(false, 'hex');

@wanderer
Copy link
Member

wanderer commented Oct 7, 2015

@h0vhannes thanks for the solution. I'm going to leave this open till I get a chance to write a better API for the keys.

@h0vhannes
Copy link
Author

Thanks @wanderer, will wait for it !

@fanatid fanatid added this to the 2.0.0 milestone Nov 1, 2015
@fanatid fanatid self-assigned this Nov 1, 2015
@fanatid
Copy link
Member

fanatid commented Nov 5, 2015

@h0vhannes with v2.x you can use publicKeyConvert

@fanatid fanatid closed this as completed Nov 5, 2015
@h0vhannes
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants