-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathProgram.cs
More file actions
37 lines (30 loc) · 1.02 KB
/
Copy pathProgram.cs
File metadata and controls
37 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Certstream;
using Certstream.Models;
using Microsoft.Extensions.Logging;
using System;
using System.Threading.Tasks;
namespace Example
{
public class Example
{
public static async Task Main()
{
using ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
{
builder.SetMinimumLevel(LogLevel.Debug);
builder.AddConsole();
});
ILogger<CertstreamClient> logger = loggerFactory.CreateLogger<CertstreamClient>();
CertstreamClient client = new(ConnectionType.Full, logger: logger);
await client.StartAsync();
client.CertificateIssued += (sender, cert) =>
{
foreach (string domain in cert.AllDomains)
Console.WriteLine($"{cert.Issuer.O ?? cert.Issuer.CN} issued a SSL certificate for {domain}");
};
Console.ReadKey(true);
await client.StopAsync();
Console.ReadKey(true);
}
}
}