mirror of
https://github.com/bettercap/bettercap
synced 2025-07-07 05:22:04 -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 (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
"crypto/sha1"
|
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"crypto/x509/pkix"
|
"crypto/x509/pkix"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
"net"
|
"net"
|
||||||
"sort"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/bettercap/bettercap/log"
|
"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 {
|
func getServerCertificate(host string, port int) *x509.Certificate {
|
||||||
log.Debug("Fetching TLS certificate from %s:%d ...", host, port)
|
log.Debug("Fetching TLS certificate from %s:%d ...", host, port)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue