-
Notifications
You must be signed in to change notification settings - Fork 492
/
Copy pathSecurityProviderX509.cs
35 lines (31 loc) · 1.34 KB
/
SecurityProviderX509.cs
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
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Security.Cryptography.X509Certificates;
namespace Microsoft.Azure.Devices.Shared
{
/// <summary>
/// The device security provider interface for X.509-based hardware security modules.
/// </summary>
public abstract class SecurityProviderX509 : SecurityProvider
{
/// <summary>
/// Returns the registration Id.
/// </summary>
/// <returns>The registration Id.</returns>
public override string GetRegistrationID()
{
X509Certificate2 cert = GetAuthenticationCertificate();
return cert.GetNameInfo(X509NameType.DnsName, false);
}
/// <summary>
/// Gets the certificate trust chain that will end in the Trusted Root installed on the server side.
/// </summary>
/// <returns>The certificate chain.</returns>
public abstract X509Certificate2Collection GetAuthenticationCertificateChain();
/// <summary>
/// Gets the certificate used for TLS device authentication.
/// </summary>
/// <returns>The client certificate used during TLS communications.</returns>
public abstract X509Certificate2 GetAuthenticationCertificate();
}
}