-
-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not deserialize key data #700
Comments
I had the same error following the same steps. Not sure if you were able to solve it yet, but here is what worked for me: Either pass cert_path or the private_key (as string) - but not both (see office365 > runtime > auth > authentication_context.py). Starting with the pfx from the same powershell script I exported the certificate and the private key (in #PKCS8) in the same file. I guess #PKCS12 works too for the key, but I needed to convert for Azure key vault anyway: cert_and_key.pem can be used as path for cert_path or read and passed as private_key:
|
Thanks so much @pclasen-eb, I've managed to get a response thanks to you! The crucial change seemed to be the addition of our SharePoint URL to the I also thought it was really weird that I was sending the private key to the If any package authors are able to clarify the intended usage of this code block that would be really useful, but as long as it works I'm happy! |
I am trying to follow the certificate-based authorisation flow (if I understand correctly, this is the only one Microsoft will allow at this point).
I've created the .pem file with openssl, lodged it with the Azure AD app and then followed the instructions here: https://github.com/vgrem/Office365-REST-Python-Client/blob/master/examples/sharepoint/connect_with_client_certificate.py
But on executing the query, I get this error:
I can't find an issue about this, but another user seems to have mentioned it on a closed issue about another problem:
@denicomp Could you tell me how can you generate the PowershellPnP.pem file?
I tried to use the .cer file by: openssl x509 -in cert.cer -out cert.pem
The cer comes from .\Create-SelfSignedCertificate.ps1 in https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azuread
Then I got error "Could not deserialize key data. The data may be in an incorrect format or it may be encrypted with an unsupported algorithm".
Could you tell me if there is any difference between yours and mine?
Thank you very much!
Originally posted by @JusticeGitHub in #541 (comment)
The text was updated successfully, but these errors were encountered: