forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCertificateX509.cs
More file actions
33 lines (29 loc) · 873 Bytes
/
CertificateX509.cs
File metadata and controls
33 lines (29 loc) · 873 Bytes
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
using System;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using LibGit2Sharp.Core;
namespace LibGit2Sharp
{
/// <summary>
/// Conains a X509 certificate
/// </summary>
public class CertificateX509 : Certificate
{
/// <summary>
/// For mocking purposes
/// </summary>
protected CertificateX509()
{ }
/// <summary>
/// The certificate.
/// </summary>
public virtual X509Certificate Certificate { get; private set; }
internal unsafe CertificateX509(git_certificate_x509* cert)
{
int len = checked((int) cert->len.ToUInt32());
byte[] data = new byte[len];
Marshal.Copy(new IntPtr(cert->data), data, 0, len);
Certificate = new X509Certificate(data);
}
}
}