internal IntPtr ToPointer() { GitCertificateSshType sshCertType = 0; if (HasMD5) { sshCertType |= GitCertificateSshType.MD5; } if (HasSHA1) { sshCertType |= GitCertificateSshType.SHA1; } var gitCert = new GitCertificateSsh { cert_type = GitCertificateType.Hostkey, type = sshCertType, }; HashMD5.CopyTo(gitCert.HashMD5, 0); HashSHA1.CopyTo(gitCert.HashSHA1, 0); var ptr = Marshal.AllocHGlobal(Marshal.SizeOf(gitCert)); Marshal.StructureToPtr(gitCert, ptr, false); return(ptr); }
/// <summary> /// True if we have the SHA1 hostkey hash from the server /// </summary>public readonly bool HasSHA1; internal CertificateSsh(GitCertificateSsh cert) { HasMD5 = cert.type.HasFlag(GitCertificateSshType.MD5); HasSHA1 = cert.type.HasFlag(GitCertificateSshType.SHA1); HashMD5 = new byte[16]; cert.HashMD5.CopyTo(HashMD5, 0); HashSHA1 = new byte[20]; cert.HashSHA1.CopyTo(HashSHA1, 0); }