-
Notifications
You must be signed in to change notification settings - Fork 11
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
Conversation
@@ -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") |
There was a problem hiding this comment.
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": |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newNTLSServer()为啥会有多个非NTLS version?
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
No description provided.