Skip to content

Commit e4d70bf

Browse files
committed
fixup! Allow the caller to inspect the host's certificate
1 parent 03e6875 commit e4d70bf

9 files changed

+22
-50
lines changed

LibGit2Sharp/Certificate.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
using System;
2-
3-
namespace LibGit2Sharp
1+
namespace LibGit2Sharp
42
{
53
/// <summary>
64
/// Top-level certificate type. The usable certificates inherit from this class.
75
/// </summary>
86
public abstract class Certificate
97
{
10-
/// <summary>
11-
/// For mocking
12-
/// </summary>
13-
protected Certificate()
14-
{ }
158
}
169
}
17-

LibGit2Sharp/CertificateSsh.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
2-
using System.Diagnostics;
3-
using LibGit2Sharp.Core;
1+
using LibGit2Sharp.Core;
42

53
namespace LibGit2Sharp
64
{
@@ -9,6 +7,12 @@ namespace LibGit2Sharp
97
/// </summary>
108
public class CertificateSsh : Certificate
119
{
10+
/// <summary>
11+
/// For mocking purposes
12+
/// </summary>
13+
protected CertificateSsh()
14+
{ }
15+
1216
/// <summary>
1317
/// The MD5 hash of the host. Meaningful if <see cref="HasMD5"/> is true
1418
/// </summary>
@@ -29,6 +33,10 @@ public class CertificateSsh : Certificate
2933
/// </summary>
3034
public readonly bool HasSHA1;
3135

36+
/// <summary>
37+
/// True if we have the SHA1 hostkey hash from the server
38+
/// </summary>public readonly bool HasSHA1;
39+
3240
internal CertificateSsh(GitCertificateSsh cert)
3341
{
3442

@@ -41,12 +49,5 @@ internal CertificateSsh(GitCertificateSsh cert)
4149
HashSHA1 = new byte[20];
4250
cert.HashSHA1.CopyTo(HashSHA1, 0);
4351
}
44-
45-
/// <summary>
46-
/// For mocking purposes
47-
/// </summary>
48-
protected CertificateSsh()
49-
{ }
5052
}
5153
}
52-

LibGit2Sharp/CertificateX509.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ namespace LibGit2Sharp
99
/// </summary>
1010
public class CertificateX509 : Certificate
1111
{
12+
13+
/// <summary>
14+
/// For mocking purposes
15+
/// </summary>
16+
protected CertificateX509()
17+
{ }
18+
1219
/// <summary>
1320
/// The certificate.
1421
/// </summary>
@@ -21,12 +28,5 @@ internal CertificateX509(GitCertificateX509 cert)
2128
Marshal.Copy(cert.data, data, 0, len);
2229
Certificate = new X509Certificate(data);
2330
}
24-
25-
/// <summary>
26-
/// For mocking purposes
27-
/// </summary>
28-
protected CertificateX509()
29-
{ }
3031
}
3132
}
32-

LibGit2Sharp/Core/CertificateNone.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

LibGit2Sharp/Core/GitCertificate.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Runtime.InteropServices;
1+
using System.Runtime.InteropServices;
32

43
namespace LibGit2Sharp.Core
54
{
@@ -9,4 +8,3 @@ internal struct GitCertificate
98
public GitCertificateType type;
109
}
1110
}
12-

LibGit2Sharp/Core/GitCertificateSsh.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Runtime.InteropServices;
1+
using System.Runtime.InteropServices;
32

43
namespace LibGit2Sharp.Core
54
{
@@ -22,4 +21,3 @@ internal struct GitCertificateSsh
2221
public byte[] HashSHA1;
2322
}
2423
}
25-

LibGit2Sharp/Core/GitCertificateSshType.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ internal enum GitCertificateSshType
99
SHA1 = (1 << 1),
1010
}
1111
}
12-

LibGit2Sharp/Core/GitCertificateType.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
2-
3-
namespace LibGit2Sharp.Core
1+
namespace LibGit2Sharp.Core
42
{
53
/// <summary>
64
/// Git certificate types to present to the user
@@ -17,4 +15,3 @@ internal enum GitCertificateType
1715
Hostkey = 1,
1816
}
1917
}
20-

LibGit2Sharp/Core/GitCertificateX509.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ internal struct GitCertificateX509
2020
public UIntPtr len;
2121
}
2222
}
23-

0 commit comments

Comments
 (0)