Nov-20-2018, 06:34 PM
If you need to read the public key from string, you have to remove line 13.
And at line 14 put the string.
And at line 14 put the string.
Signature verification
|
Nov-20-2018, 06:34 PM
If you need to read the public key from string, you have to remove line 13.
And at line 14 put the string.
Nov-21-2018, 06:33 AM
(Nov-20-2018, 06:25 PM)saisankalpj Wrote:(Nov-20-2018, 06:03 PM)gontajones Wrote: Hummm...my bad about saying that you were mentioning a private key, sorry. This is also not working .After adding -----BEGIN RSA PUBLIC KEY----- ... -----END RSA PUBLIC KEY----- also i am getting False
Nov-21-2018, 07:42 AM
1 - Are you passing the params of
verify_sign() as string?2 - If so, did you change lines 13 and 14? 3 - Another thing is the base64 encoding, have you encoded the signature and data ?Please, answer every question for us to keep helping you.
Nov-21-2018, 09:35 AM
(Nov-21-2018, 07:42 AM)gontajones Wrote: 1 - Are you passing the params of 1-yes i am passing it as string 2-pub_key = "-----BEGIN RSA PUBLIC KEY-----\n" + public_key_loc + "\n-----END RSA PUBLIC KEY-----".i have changed the lines like these 3-i was doing base64decode.i have checked even with base64 encode all seem to return false
Nov-21-2018, 10:03 AM
(This post was last modified: Nov-21-2018, 03:59 PM by gontajones.)
Here is working well.
Try these parameters: - pub_key: string - signature: string - data: string def verify_sign(public_key_string, signature, data): from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1_v1_5 from Crypto.Hash import SHA256 rsakey = RSA.importKey(public_key_string) signer = PKCS1_v1_5.new(rsakey) digest = SHA256.new() digest.update(data) if signer.verify(digest, signature): return True return Falseand obviously your key must be generated using RSA.
Nov-21-2018, 03:52 PM
(Nov-21-2018, 10:03 AM)gontajones Wrote: Here is working well.Can i use SHA512.new() instead of SHA256.new()
Nov-21-2018, 06:13 PM
I really don't know that. =/
Did you try it? It keeps returning False ?
Nov-22-2018, 05:45 AM
Nov-22-2018, 10:32 AM
So I think your best shot will be sharing all these info (pub, sign, data).
Then we'll be able to test and see what's really going on. If they are not "private", off course.
Nov-22-2018, 01:55 PM
|
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
How can I get Python Bulk Email Verification Script With API? | zainalee | 1 | 3,059 |
Jun-06-2021, 09:19 AM Last Post: snippsat |
|
![]() |
Python Bulk Email Verification Script With API | Aj1128 | 0 | 3,122 |
Nov-28-2020, 11:38 AM Last Post: Aj1128 |
List items verification for Integer type | vintysaw | 4 | 3,822 |
Jan-17-2020, 01:56 PM Last Post: perfringo |
|
Remove Email Signature | NewBeie | 4 | 11,146 |
Jan-01-2020, 06:44 PM Last Post: PythonPaul2016 |
|
[cryptography.io] How to convert DER signature to ECDSA | fstefanov | 1 | 3,938 |
Jul-04-2019, 08:59 AM Last Post: fstefanov |
|
Signature verification | saisankalpj | 8 | 6,738 |
Nov-20-2018, 09:32 AM Last Post: saisankalpj |
|
With Python I cannot calculate an AWS signature for Rest APIs | Johno | 4 | 7,797 |
Oct-06-2016, 11:05 AM Last Post: Johno |