Title: how to get pubkey of signature Post by: yoshimitsu777 on December 20, 2022, 06:47:43 PM it should be possible but i did not find a python lib that supports this kind of data extraction any clues?
Title: Re: how to get pubkey of signature Post by: BlackHatCoiner on December 20, 2022, 08:47:41 PM I'm not a cryptography expert, but I know that you can't do that with just the signature. You need at least the signature and the message that was signed (curve details asides).
If there's no library that does this operation (I highly doubt, but if), you'll have to implement the paragraph 4.1.6 from this paper: https://www.secg.org/sec1-v2.pdf. You're already starting to sweat, I can feel it. You better do some good search for already implemented code. :P How about this (https://github.com/tlsfuzzer/python-ecdsa/issues/101)? Title: Re: how to get pubkey of signature Post by: pooya87 on December 21, 2022, 04:16:22 AM Look inside any bitcoin library that has the "message verification" function implemented (which is almost all of them) then follow that code to find a method that performs public key recovery using the signature and the message (hash) before it verifies the signature against that public key. That is how you recover public keys from ECDSA signatures.
Title: Re: how to get pubkey of signature Post by: yoshimitsu777 on December 25, 2022, 08:37:38 AM i stumbled over bit which is very fast.can I use bit library for this task?
https://github.com/ofek/bit/search?q=signature I do not think it work with bit right?maybe python-ecdsa and keys.py (https://github.com/tlsfuzzer/python-ecdsa/blob/3a8bc4e6dcd2c2c209f0ade440a70fd6485eaec7/src/ecdsa/keys.py) but i have no clue how to run and use it.any example? Title: Re: how to get pubkey of signature Post by: riceberryrice on December 26, 2022, 05:23:53 AM use this
https://github.com/Sean-Bradley/ECDSA_secp256k1_JordonMatrix_nodejs https://asecuritysite.com/ecdsa/ecdsa_recpub Title: Re: how to get pubkey of signature Post by: citb0in on December 26, 2022, 08:11:08 AM use this https://asecuritysite.com/ecdsa/ecdsa_recpub My understanding is that the example demonstrated is not what OP is looking for. In the example shown, the private key is created first and everything that follows is based on it. But the OP does not know the private key, he wants to extract the pubkey from an existing signature without knowing the private key. @yoshimitsu777: have a look at https://pypi.org/project/secp256k1/, there is a function "recpub" which you can use comfortably and it does exactly what you are looking for. Example: Code: $ python -m secp256k1 recpub \ Quote Public key: 02477ce3b986ab14d123d6c4167b085f4d08c1569963a0201b2ffc7d9d6086d2f3 I do not understand what the switch -i 1 stands for, but the result seems to be correct. I tried to implement the whole thing in Python using the ecdsa library. Here is my approach: Code: #!/usr/bin/env python3 Unfortunately, the generated signature is not correct, I would have expected something else. Even if I write the correct signature into the variable, I still get "Invalid signature" as error message. Where do I have a (thinking) error ? Title: Re: how to get pubkey of signature Post by: yoshimitsu777 on January 02, 2023, 09:36:03 AM https://asecuritysite.com/ecdsa/ecdsa_recpub is this available for python?thanks citb0in but i get the same error as you. yes you are right.i do now know the private key only signature and message and the address. how can we fix this to have a python program that can make this conversion to pubkey without knowing the private key? Title: Re: how to get pubkey of signature Post by: brainless on January 02, 2023, 01:46:44 PM https://asecuritysite.com/ecdsa/ecdsa_recpub is this available for python?thanks citb0in but i get the same error as you. yes you are right.i do now know the private key only signature and message and the address. how can we fix this to have a python program that can make this conversion to pubkey without knowing the private key? you mean RSZ to pubkey ? Title: Re: how to get pubkey of signature Post by: yoshimitsu777 on January 02, 2023, 02:21:26 PM i dont know what RSZ is.
i have signature,message and bitcoin address. i want pubkey, if possible in small python script Title: Re: how to get pubkey of signature Post by: brainless on January 02, 2023, 02:32:17 PM i dont know what RSZ is. write herei have signature,message and bitcoin address. i want pubkey, if possible in small python script you have information , which you want convert to pubkey Title: Re: how to get pubkey of signature Post by: brainless on January 02, 2023, 02:32:41 PM i dont know what RSZ is. write herei have signature,message and bitcoin address. i want pubkey, if possible in small python script you have information , which you want convert to pubkey write signature,message and bitcoin address Title: Re: how to get pubkey of signature Post by: yoshimitsu777 on January 02, 2023, 02:49:05 PM Bitcoin address: "1NLbHuJebVwUZ1XqDjsAyfTRUPwDQbemfv"
Message: "Hello, world!" Signature: "HxhJdJzdl0W7TeL/GWJ2bCp5gGE+kLNhRfZYKfPhQdWWcuGXkWx3W60lvCM/3bfnwdYL58ZNCcx4sgohPkCrwH4=" Title: Re: how to get pubkey of signature Post by: brainless on January 02, 2023, 03:25:36 PM Bitcoin address: "1NLbHuJebVwUZ1XqDjsAyfTRUPwDQbemfv" Message: "Hello, world!" Signature: "HxhJdJzdl0W7TeL/GWJ2bCp5gGE+kLNhRfZYKfPhQdWWcuGXkWx3W60lvCM/3bfnwdYL58ZNCcx4sgohPkCrwH4=" long time ago i converted sign messages to transaction , RSZ generate, and then to pubkey, need to find python scripts inside my big bank, you may study this old topic here https://bitcointalk.org/index.php?topic=5192074.0 Title: Re: how to get pubkey of signature Post by: yoshimitsu777 on January 03, 2023, 08:31:39 AM did you find? still looking for helpful answers.
anybody knows if secp256k1 from iceland can be used for this task? Title: Re: how to get pubkey of signature Post by: yoshimitsu777 on January 05, 2023, 03:55:31 PM @yoshimitsu777: have a look at https://pypi.org/project/secp256k1/, there is a function "recpub" which you can use comfortably and it does exactly what you are looking for. Example: Code: $ python -m secp256k1 recpub \ Public key: 02477ce3b986ab14d123d6c4167b085f4d08c1569963a0201b2ffc7d9d6086d2f3 but how works?look my message and signature is Bitcoin address: "1NLbHuJebVwUZ1XqDjsAyfTRUPwDQbemfv" Message: "Hello, world!" Signature: "HxhJdJzdl0W7TeL/GWJ2bCp5gGE+kLNhRfZYKfPhQdWWcuGXkWx3W60lvCM/3bfnwdYL58ZNCcx4sgohPkCrwH4=" this is not accepted by tool i get error Code: python3 -m secp256k1 recpub -s HxhJdJzdl0W7TeL/GWJ2bCp5gGE+kLNhRfZYKfPhQdWWcuGXkWx3W60lvCM/3bfnwdYL58ZNCcx4sgohPkCrwH4= -i 1 -m "Hello, world!" please somebody explain what is correct way to use this tool correctly. do i need to convert signature to something else before input into command line? where do i enter bitcoin address? please show instruction |