Add ID function to LogInfo to return log ID

This commit is contained in:
Andrew Ayer 2016-11-26 17:48:15 -08:00
parent ff6d1f21fd
commit 4868243259
1 changed files with 6 additions and 0 deletions

View File

@ -11,6 +11,7 @@ package certspotter
import (
"crypto"
"crypto/sha256"
"crypto/x509"
"encoding/base64"
)
@ -37,6 +38,11 @@ func (info *LogInfo) ParsedPublicKey() (crypto.PublicKey, error) {
}
}
func (info *LogInfo) ID() []byte {
sum := sha256.Sum256(info.Key)
return sum[:]
}
var DefaultLogs = []LogInfo{
{
// a4b90990b418581487bb13a2cc67700a3c359804f91bdfb8e377cd0ec80ddc10