mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 04:52:10 -07:00
... and more ...
This commit is contained in:
parent
60e8f83b2b
commit
e383e4d9b1
1 changed files with 0 additions and 19 deletions
19
tls/sign.go
19
tls/sign.go
|
@ -3,36 +3,17 @@ package tls
|
|||
import (
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"crypto/sha1"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"crypto/x509/pkix"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"net"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/bettercap/bettercap/log"
|
||||
)
|
||||
|
||||
func hashSorted(lst []string) []byte {
|
||||
c := make([]string, len(lst))
|
||||
copy(c, lst)
|
||||
sort.Strings(c)
|
||||
h := sha1.New()
|
||||
for _, s := range c {
|
||||
h.Write([]byte(s + ","))
|
||||
}
|
||||
return h.Sum(nil)
|
||||
}
|
||||
|
||||
func hashSortedBigInt(lst []string) *big.Int {
|
||||
rv := new(big.Int)
|
||||
rv.SetBytes(hashSorted(lst))
|
||||
return rv
|
||||
}
|
||||
|
||||
func getServerCertificate(host string, port int) *x509.Certificate {
|
||||
log.Debug("Fetching TLS certificate from %s:%d ...", host, port)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue