service: show SHA-512 fingerprint

Closes: https://todo.sr.ht/~emersion/soju/130

git-svn-id: file:///srv/svn/repo/suika/trunk@575 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
yyp 2021-07-06 14:34:15 +00:00
parent 3ec1c5d92e
commit d249ea82a1

View File

@ -9,6 +9,7 @@ import (
"crypto/rsa"
"crypto/sha1"
"crypto/sha256"
"crypto/sha512"
"crypto/x509"
"crypto/x509/pkix"
"encoding/hex"
@ -662,6 +663,8 @@ func handleServiceCertfpGenerate(dc *downstreamConn, params []string) error {
sendServicePRIVMSG(dc, "SHA-1 fingerprint: "+hex.EncodeToString(sha1Sum[:]))
sha256Sum := sha256.Sum256(derBytes)
sendServicePRIVMSG(dc, "SHA-256 fingerprint: "+hex.EncodeToString(sha256Sum[:]))
sha512Sum := sha512.Sum512(derBytes)
sendServicePRIVMSG(dc, "SHA-512 fingerprint: "+hex.EncodeToString(sha512Sum[:]))
return nil
}
@ -680,6 +683,8 @@ func handleServiceCertfpFingerprints(dc *downstreamConn, params []string) error
sendServicePRIVMSG(dc, "SHA-1 fingerprint: "+hex.EncodeToString(sha1Sum[:]))
sha256Sum := sha256.Sum256(net.SASL.External.CertBlob)
sendServicePRIVMSG(dc, "SHA-256 fingerprint: "+hex.EncodeToString(sha256Sum[:]))
sha512Sum := sha512.Sum512(net.SASL.External.CertBlob)
sendServicePRIVMSG(dc, "SHA-512 fingerprint: "+hex.EncodeToString(sha512Sum[:]))
return nil
}