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

Add logging through to Azure services #808

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Wrapped the Stream object in a using statement to ensure it is proper…
…ly disposed of after use.
  • Loading branch information
clairernovotny committed Dec 12, 2024
commit a59fe63710681f42107e575bce34807eae4d3271
clairernovotny marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,21 @@ public async Task<X509Certificate2> GetCertificateAsync(CancellationToken cancel

Response<Stream> response = await _client.GetSignCertificateChainAsync(_accountName, _certificateProfileName, cancellationToken: cancellationToken);

byte[] rawData = new byte[response.Value.Length];
response.Value.Read(rawData, 0, rawData.Length);
using (response.Value)
{
byte[] rawData = new byte[response.Value.Length];
response.Value.Read(rawData, 0, rawData.Length);

X509Certificate2Collection collection = [];
collection.Import(rawData);
X509Certificate2Collection collection = [];
collection.Import(rawData);

// This should contain the certificate chain in root->leaf order.
_certificate = collection[collection.Count - 1];
// This should contain the certificate chain in root->leaf order.
_certificate = collection[collection.Count - 1];

_logger.LogTrace(Resources.FetchedCertificate, stopwatch.Elapsed.TotalMilliseconds);
//print the certificate info
_logger.LogTrace(Resources.CertificateDetails, _certificate.ToString(verbose: true));

response.Value.Dispose();
_logger.LogTrace(Resources.FetchedCertificate, stopwatch.Elapsed.TotalMilliseconds);
//print the certificate info
_logger.LogTrace(Resources.CertificateDetails, _certificate.ToString(verbose: true));
}
}
}
finally
Expand Down