tjfoc / gmtls Goto Github PK
View Code? Open in Web Editor NEWGM TLS/SSL Based on Golang (基于国密算法的TLS/SSL代码库)
Home Page: http://www.wutongchain.com
License: Apache License 2.0
GM TLS/SSL Based on Golang (基于国密算法的TLS/SSL代码库)
Home Page: http://www.wutongchain.com
License: Apache License 2.0
哪里有java版本的gmtls?
你好 国密tls不是需要双证书的吗 我们以前给银行系统做的tls都是双证书 tassl里面也是双证书。 希望可以一起交流一下
Greetings!
Sorry, but which version of TLS is this? 1.1, 1.2?
if *tcpip == "listen" {
cert, err := gmtls.X509KeyPair(certpem, pripem)
if err != nil {
log.Fatal(err)
}
config := gmtls.Config{Certificates: []gmtls.Certificate{cert}, ClientAuth: gmtls.RequireAnyClientCert}
config.Rand = rand.Reader
port := "8081"
if *public != "" {
port = *public
}
ln, err := gmtls.Listen("tcp", ":"+port, &config)
if err != nil {
log.Fatal(err)
}
fmt.Fprintln(os.Stderr, "Server(TLS) up and listening on port "+port)
conn, err := ln.Accept()
if err != nil {
log.Println(err)
}
defer ln.Close()
fmt.Println("Connection accepted")
for {
message, err := bufio.NewReader(conn).ReadString('\n')
if err != nil {
fmt.Println(err)
os.Exit(3)
}
fmt.Print("Received: ", string(message))
newmessage := strings.ToUpper(message)
conn.Write([]byte(newmessage + "\n"))
}
}
if *tcpip == "dial" {
cert, err := gmtls.X509KeyPair(certpem, pripem)
if err != nil {
log.Fatal(err)
}
ipport := "127.0.0.1:8081"
if *public != "" {
ipport = *public
}
config := gmtls.Config{Certificates: []gmtls.Certificate{cert}, InsecureSkipVerify: true}
conn, err := gmtls.Dial("tcp", ipport, &config)
if err != nil {
log.Fatal(err)
}
certs := conn.ConnectionState().PeerCertificates
for _, cert := range certs {
fmt.Printf("Issuer Name: %s\n", cert.Issuer)
fmt.Printf("Expiry: %s \n", cert.NotAfter.Format("Monday, 02-Jan-06 15:04:05 MST"))
fmt.Printf("Common Name: %s \n", cert.Issuer.CommonName)
fmt.Printf("IP Address: %s \n", cert.IPAddresses)
}
if err != nil {
log.Fatal(err)
}
defer conn.Close()
for {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Text to be sent: ")
text, err := reader.ReadString('\n')
if err != nil {
fmt.Println(err)
os.Exit(3)
}
fmt.Fprintf(conn, text+"\n")
message, err := bufio.NewReader(conn).ReadString('\n')
if err != nil {
fmt.Println(err)
os.Exit(3)
}
fmt.Print("Server response: " + message)
}
}
Thanks in advance!
2023/08/0117:38:35http:panicserving171.91.3.32:9055:runtimeerror:invalidmemoryaddressornilpointerdereference
goroutine207732[running]:
net/http.(*conn).serve.func1()
/usr/go/src/net/http/server.go:1802+0xb9
panic({0xf8f440,0x1b17d90})
/usr/go/src/runtime/panic.go:1047+0x266
github.com/tjfoc/gmsm/gmtls.finishedHash.clientSum({{0x127a458,0xc003b61500},{0x127a458,0xc003b61570},{0x127a418,0xc00b498d20},{0x127a418,0xc00b498d80},{0x0,0x0,...},...},...)
/root/go/pkg/mod/github.com/tjfoc/[email protected]/gmtls/prf.go:328+0x100
github.com/tjfoc/gmsm/gmtls.(*serverHandshakeState).readFinished(0xc00351b4a0,{0xc0023580e9,0xc,0xc0003e2240})
/root/go/pkg/mod/github.com/tjfoc/[email protected]/gmtls/handshake_server.go:615+0x1df
github.com/tjfoc/gmsm/gmtls.(*Conn).serverHandshake(0xc002358000)
/root/go/pkg/mod/github.com/tjfoc/[email protected]/gmtls/handshake_server.go:103+0x232
github.com/tjfoc/gmsm/gmtls.(*Conn).Handshake(0xc002358000)
/root/go/pkg/mod/github.com/tjfoc/[email protected]/gmtls/conn.go:1289+0x1ca
github.com/tjfoc/gmsm/gmtls.(*Conn).Read(0xc002358000,{0xc004389000,0x1000,0xc009c42788})
/root/go/pkg/mod/github.com/tjfoc/[email protected]/gmtls/conn.go:1141+0x55
git.woa.com/bmax/go-nginx/chttp.(*SecConn).Read(0xc009c42780,{0xc004389000,0x10538a0,0xc00c0e8601})
/root/go/pkg/mod/git.woa.com/bmax/[email protected]/chttp/chttp_conn.go:24+0x26
net/http.(*connReader).Read(0xc009c42780,{0xc004389000,0x1000,0x1000})
Hi, we are a research group to help developers build secure applications. We designed a cryptographic misuse detector (i.e., CryptoGo) on Go language. We found your great public repository from Github, and several security issues detected by CryptoGo are shown in the following.
Note that the cryptographic algorithms are categorized with two aspects: security strength and security vulnerability based on NIST Special Publication 800-57 and other public publications. Moreover, CryptoGo defined certain rules derived from the APIs of Go cryptographic library and other popular cryptographic misuse detectors. The specific security issues we found are as follows:
(1) Location: key_agreement.go:115
Broken rule: MD5 is an insecure algorithm;
(2) Location: prf.go:219
Broken rule: MD5 is an insecure algorithm;
(3) Location: prf.go:352
Broken rule: MD5 is an insecure algorithm;
(4) Location: prf.go:95
Broken rule: MD5 is an insecure algorithm;
(5) Location: cipher_suites.go:120
Broken rule: RC4 is an insecure algorithm;
(6) Location: cipher_suites.go:144
Broken rule: SHA-1 is an insecure algorithm;
(7) Location: key_agreement.go:104
Broken rule: SHA-1 is an insecure algorithm;
(8) Location: prf.go:219
Broken rule: SHA-1 is an insecure algorithm;
(9) Location: prf.go:354
Broken rule: SHA-1 is an insecure algorithm;
(10) Location: prf.go:94
Broken rule: SHA-1 is an insecure algorithm;
(11) Location: cipher_suites.go:125
Broken rule: 3TDEA is acceptable but not recommended;
(12) Location: prf.go:38
Broken rule: HMAC-MD5 is acceptable but not recommended;
(13) Location: cipher_suites.go:133
Broken rule: Constant key in AES;
(14) Location: ticket.go:206
Broken rule: Not unique IV in CTR;
(15) Location: key_agreement.go:90
Broken rule: RSAES-PKCS1-v1_5 is deprecated;
(16) Location: key_agreement.go:329
Broken rule: The ScalarMult method of Package curve25519 is deprecated;
(17) Location: key_agreement.go:477
Broken rule: The ScalarMult method of Package curve25519 is deprecated;
We wish the above security issues could truly help you to build a secure application. If you have any concern or suggestion, please feel free to contact us, we are looking forward to your reply. Thanks.
请问gmtls有没有支持tls 1.3的计划
看了下 似乎证书部分使用了sm2算法,其它部分没有,是否有计划继续?
如题,谢谢!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.