Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support tls1.3 and ShangMi cipher suit #33

Closed
wants to merge 2 commits into from
Closed

Support tls1.3 and ShangMi cipher suit #33

wants to merge 2 commits into from

Conversation

ZBCccc
Copy link
Contributor

@ZBCccc ZBCccc commented Sep 30, 2024

No description provided.

@@ -38,12 +38,27 @@ func main() {
flag.StringVar(&caFile, "CAfile", "test/certs/sm2/chain-ca.crt", "CA certificate file")
flag.StringVar(&serverName, "servername", "", "server name")
flag.Var((*stringSlice)(&alpnProtocols), "alpn", "ALPN protocols")

flag.StringVar(&tlsVersion, "tls_version", "NTLS", "TLS version")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接叫version就行

version = ts.TLSv1_1
case "TLSv1":
version = ts.TLSv1
case "NTLS":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default是NTLS,跟flag.StringVar(&tlsVersion,保持一致吧

ctx, err := ts.NewCtxWithVersion(ts.NTLS)
func newNTLSServer(acceptAddr string, certKeyPairs map[string]crypto.GMDoubleCertKey, cafile string, alpnProtocols []string, tlsVersion string) (net.Listener, error) {
var version ts.SSLVersion
switch tlsVersion {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newNTLSServer()为啥会有多个非NTLS version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原意为想要让Server可以支持多个TLS versions,因此加了多个非NTLS version,但是与函数的命名有所冲突,现将函数名称由newNTLSServer改为newTLSServer

@@ -294,7 +315,7 @@ func main() {
flag.StringVar(&encKeyFile, "enc_key", "test/certs/sm2/server_enc.key", "encrypt private key file")
flag.StringVar(&caFile, "CAfile", "test/certs/sm2/chain-ca.crt", "CA certificate file")
flag.Var((*stringSlice)(&alpnProtocols), "alpn", "ALPN protocols")

flag.StringVar(&tlsVersion, "tls_version", "NTLS", "TLS version")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

return
}

certPEM, err := os.ReadFile("test/certs/sm2/client_enc.crt")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

客户端配置证书干啥?

return nil, err
}

encCertPEM, err := os.ReadFile(filepath.Join(testDir, "server_enc.crt"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用服务端单证书,而不是加密证书

return nil, err
}

KeyPEM, err := os.ReadFile(filepath.Join(testDir, "server_enc.key"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@ZBCccc ZBCccc closed this by deleting the head repository Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants