Skip to content

Accept an encrypted key as client credential #232

@chlowell

Description

@chlowell

Documentation indicates keys should be provided to ConfidentialClientApplication as strings, PEM encoded. The documentation doesn't mention how to provide an encrypted key, and there's nothing obvious like a password parameter, so on the face of it ConfidentialClientApplication doesn't accept encrypted keys.

The implementation allows something of a workaround. It so happens that the given private key gets passed along to PyJWT, which will accept a private key as deserialized by cryptography. So this works today:

from cryptography.hazmat.primitives import serialization
private_key = serialization.load_pem_private_key(pem_bytes, password=password, backend=default_backend())
ConfidentialClientApplication(client_credentials={"private_key": private_key, ...})

But that relies on today's implementation and isn't a substitute for formal support.

Metadata

Metadata

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions