Skip to content
This repository has been archived by the owner on Aug 27, 2021. It is now read-only.

Webhook verification signature failed with python helper functions. #6558

Closed
sudheer-ygag opened this issue May 27, 2021 · 0 comments
Closed

Comments

@sudheer-ygag
Copy link

sudheer-ygag commented May 27, 2021

Hi,
I have been trying to verify webhook data with verification signature. I tried with python sendgrid helper function. But every time verification is showing false. Please help me with this issue. I have seen people are facing the same issues in other programming language.

from sendgrid.helpers.eventwebhook import EventWebhook, EventWebhookHeader
public_key = "PUBLIC_KEY"

event_webhook = EventWebhook()
ec_public_key = event_webhook.convert_public_key_to_ecdsa(public_key)

is_verified =  event_webhook.verify_signature(
    json.dumps(request.data),
    request.headers[EventWebhookHeader.SIGNATURE],
    request.headers[EventWebhookHeader.TIMESTAMP],
    ec_public_key
)

Webhook data:

[{'email': 'sudheersudhi.kn@gmail.com', 'event': 'delivered', 'ip': '167.89.17.111', 'response': '250 2.0.0 OK 1622096056 au19si1316645ejc.562 - gsmtp', 'sg_event_id': 'ZGVsaXZlcmVkLTAtMTk2OTU3NDAtS0xZTmdsb3RSMWFkcVdGVzRCY0ZaUS0w', 'sg_message_id': 'KLYNglotR1adqWFW4BcFZQ.filterdrecv-6b4886b6-s5lwv-1-60AF38B4-40.0', 'smtp-id': '<KLYNglotR1adqWFW4BcFZQ@geopod-ismtpd-canary-0>', 'timestamp': 1622096056, 'tls': 1}]

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

No branches or pull requests

2 participants