Did you find any solution for this?
Cannot decrypt dataKey from resource data
Hey, good evening.
I'm having a problem when trying to decrypt the resource data provided by the Microsoft Graph subscription webhook.
We're using the tray.io platform, although I discard this is a platform-specific issue (I'm testing everything with all the tools available).
This is the documentation I'm referring to: https://learn.microsoft.com/en-us/graph/webhooks-with-resource-data#decrypting-resource-data-from-change-notifications
Here are the steps I followed:
- Generate a new key pair with the following command
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
- Base64 encode the certificate:
openssl base64 -a -e -in certificate.pem -out base64cer.pem
- Create a /teams/getAllMessages subscription, providing the certificate, receiving a successful response
- Send a message in Microsoft Teams and receiving the corresponding webhook.
- Try to decrypt the dataKey using the private key with a module the platform provides (receiving
rsa_ossl_private_decrypt:data greater than mod
error) - Create a file copying the content of the dataKey called "encDataKey.pem"
- Try to decrypt the dataKey with
openssl rsautl -decrypt -inkey key.pem -in encDataKey.pem -out dataKey.pem
(receivingrsa_ossl_private_decrypt:data greater than mod
error)
Viewing the length of the dataKey it makes sense to receive this error, but I don't know why I'm receiving a dataKey THAT long.
Any help would be much appreciated.
Thank you in advance.