Cannot decrypt dataKey from resource data

MCNOC-Dev 1 Reputation point
2021-02-03T21:39:20.323+00:00

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:

  1. Generate a new key pair with the following command openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
  2. Base64 encode the certificate: openssl base64 -a -e -in certificate.pem -out base64cer.pem
  3. Create a /teams/getAllMessages subscription, providing the certificate, receiving a successful response
  4. Send a message in Microsoft Teams and receiving the corresponding webhook.
  5. 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)
  6. Create a file copying the content of the dataKey called "encDataKey.pem"
  7. Try to decrypt the dataKey with openssl rsautl -decrypt -inkey key.pem -in encDataKey.pem -out dataKey.pem (receiving rsa_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.

Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Chinmay Prabhu 11 Reputation points
    2022-01-12T13:48:52.783+00:00

    Did you find any solution for this?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.