@@ -172,17 +172,18 @@ type Certificate struct {
172
172
type HostkeyKind uint
173
173
174
174
const (
175
- HostkeyMD5 HostkeyKind = C .GIT_CERT_SSH_MD5
176
- HostkeySHA1 HostkeyKind = C .GIT_CERT_SSH_SHA1
175
+ HostkeyMD5 HostkeyKind = C .GIT_CERT_SSH_MD5
176
+ HostkeySHA1 HostkeyKind = C .GIT_CERT_SSH_SHA1
177
+ HostkeySHA256 HostkeyKind = C .GIT_CERT_SSH_SHA256
177
178
)
178
179
179
- // Server host key information. If Kind is HostkeyMD5 the MD5 field
180
- // will be filled. If Kind is HostkeySHA1, then HashSHA1 will be
181
- // filled.
180
+ // Server host key information. A bitmask containing the available fields.
181
+ // Check for combinations of: HostkeyMD5, HostkeySHA1, HostkeySHA256.
182
182
type HostkeyCertificate struct {
183
- Kind HostkeyKind
184
- HashMD5 [16 ]byte
185
- HashSHA1 [20 ]byte
183
+ Kind HostkeyKind
184
+ HashMD5 [16 ]byte
185
+ HashSHA1 [20 ]byte
186
+ HashSHA256 [32 ]byte
186
187
}
187
188
188
189
type PushOptions struct {
@@ -318,6 +319,7 @@ func certificateCheckCallback(_cert *C.git_cert, _valid C.int, _host *C.char, da
318
319
cert .Hostkey .Kind = HostkeyKind (ccert ._type )
319
320
C .memcpy (unsafe .Pointer (& cert .Hostkey .HashMD5 [0 ]), unsafe .Pointer (& ccert .hash_md5 [0 ]), C .size_t (len (cert .Hostkey .HashMD5 )))
320
321
C .memcpy (unsafe .Pointer (& cert .Hostkey .HashSHA1 [0 ]), unsafe .Pointer (& ccert .hash_sha1 [0 ]), C .size_t (len (cert .Hostkey .HashSHA1 )))
322
+ C .memcpy (unsafe .Pointer (& cert .Hostkey .HashSHA256 [0 ]), unsafe .Pointer (& ccert .hash_sha256 [0 ]), C .size_t (len (cert .Hostkey .HashSHA256 )))
321
323
} else {
322
324
cstr := C .CString ("Unsupported certificate type" )
323
325
C .giterr_set_str (C .GITERR_NET , cstr )
0 commit comments