-
Notifications
You must be signed in to change notification settings - Fork 292
Expand file tree
/
Copy pathCertificateObject.cs
More file actions
64 lines (56 loc) · 2.16 KB
/
CertificateObject.cs
File metadata and controls
64 lines (56 loc) · 2.16 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
using Microsoft.CST.AttackSurfaceAnalyzer.Types;
using ProtoBuf;
namespace Microsoft.CST.AttackSurfaceAnalyzer.Objects
{
[ProtoContract]
public class CertificateObject : CollectObject
{
public CertificateObject(string StoreLocation, string StoreName, SerializableCertificate Certificate)
{
this.StoreLocation = StoreLocation;
this.StoreName = StoreName;
this.Certificate = Certificate;
}
public CertificateObject() { }
public override RESULT_TYPE ResultType => RESULT_TYPE.CERTIFICATE;
/// <summary>
/// A serializable representation of the Certificate.
/// </summary>
[ProtoMember(1)]
public SerializableCertificate Certificate { get; set; }
/// <summary>
/// See Certificate.CertHashString
/// </summary>
public string CertificateHashString { get { return Certificate.CertHashString; } }
/// <summary>
/// The identity of a CertificateObject is based on the StoreLocation, StoreName and
/// CertificateHashString of the CertificateObject
/// </summary>
public override string Identity
{
get
{
return $"{StoreLocation}{StoreName}{CertificateHashString}";
}
}
/// <summary>
/// The exported Pkcs7 of the certificate. Not guaranteed to be non-null.
/// </summary>
public string? Pkcs7 { get { return Certificate.Pkcs7; } }
/// <summary>
/// The Store Location or Location on Disk where the Certificate was found
/// </summary>
[ProtoMember(2)]
public string StoreLocation { get; set; }
/// <summary>
/// The Name of an X509 Store or another source (like the filesystem)
/// </summary>
[ProtoMember(3)]
public string StoreName { get; set; }
/// <summary>
/// See Certificate.Subject
/// </summary>
public string Subject { get { return Certificate.Subject; } }
}
}