Skip to content
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

ClientCertificateCredential doesn't support more than one cert in a file #5978

Open
ahsonkhan opened this issue Sep 12, 2024 · 0 comments
Open
Assignees
Labels
Azure.Identity bug This issue requires a change to an existing behavior in the product in order to be resolved.
Milestone

Comments

@ahsonkhan
Copy link
Member

There is a couple of assumptions within the ClientCertificateCredential implementation being made:

  • Assuming there is only one cert in the file (and that is the signing cert).
  • Assuming the private key in the file is for the first cert.

In practice, these assumptions won't always hold. The parsing logic should be resilient to these, and these assumptions should be documented otherwise.

std::tuple<CertificateThumbprint, UniquePrivateKey> ReadPemCertificate(std::string const& path)
{
auto pemContent{FileBodyStream(path).ReadToEnd()};
std::string pem{pemContent.begin(), pemContent.end()};
pemContent = {};
auto certContext = ImportPemCertificate(pem);
return std::make_tuple(GetThumbprint(certContext.get()), ImportPemPrivateKey(pem));
}

@ahsonkhan ahsonkhan added bug This issue requires a change to an existing behavior in the product in order to be resolved. Azure.Identity labels Sep 12, 2024
@ahsonkhan ahsonkhan self-assigned this Sep 12, 2024
@ahsonkhan ahsonkhan added this to the 2024-10 milestone Sep 12, 2024
@ahsonkhan ahsonkhan modified the milestones: 2024-10, 2024-11 Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Identity bug This issue requires a change to an existing behavior in the product in order to be resolved.
Projects
Status: Not Started
Development

No branches or pull requests

1 participant