From d9f4e83e87acb5f099e612e3693a37aceead6315 Mon Sep 17 00:00:00 2001
From: Niall Sheridan <nsheridan@gmail.com>
Date: Wed, 28 Dec 2016 21:45:33 +0000
Subject: [PATCH] Log SHA256 fingerprints

---
 server/signer/signer.go | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/server/signer/signer.go b/server/signer/signer.go
index 5ee170ae..a4cf919c 100644
--- a/server/signer/signer.go
+++ b/server/signer/signer.go
@@ -1,11 +1,9 @@
 package signer
 
 import (
-	"crypto/md5"
 	"crypto/rand"
 	"fmt"
 	"log"
-	"strings"
 	"time"
 
 	"go4.org/wkfs"
@@ -49,7 +47,7 @@ func (s *KeySigner) SignUserKey(req *lib.SignRequest, username string) (*ssh.Cer
 	if err := cert.SignCert(rand.Reader, s.ca); err != nil {
 		return nil, err
 	}
-	log.Printf("Issued cert id: %s principals: %s fp: %s valid until: %s\n", cert.KeyId, cert.ValidPrincipals, fingerprint(pubkey), time.Unix(int64(cert.ValidBefore), 0).UTC())
+	log.Printf("Issued cert id: %s principals: %s fp: %s valid until: %s\n", cert.KeyId, cert.ValidPrincipals, ssh.FingerprintSHA256(pubkey), time.Unix(int64(cert.ValidBefore), 0).UTC())
 	return cert, nil
 }
 
@@ -107,10 +105,3 @@ func New(conf *config.SSH) (*KeySigner, error) {
 		permissions: makeperms(conf.Permissions),
 	}, nil
 }
-
-func fingerprint(pubkey ssh.PublicKey) string {
-	md5String := md5.New()
-	md5String.Write(pubkey.Marshal())
-	fp := fmt.Sprintf("% x", md5String.Sum(nil))
-	return strings.Replace(fp, " ", ":", -1)
-}
-- 
GitLab