簡體   English   中英

gRPC 的 NewClientTLSFromCert 如何從公鑰生成 TLS 憑證?

[英]How gRPC's NewClientTLSFromCert generates TLS credentials from public key?

google.golang.org/grpc/credentials庫有以下方法。

// NewClientTLSFromCert constructs TLS credentials from the provided root
// certificate authority certificate(s) to validate server connections. If
// certificates to establish the identity of the client need to be included in
// the credentials (eg: for mTLS), use NewTLS instead, where a complete
// tls.Config can be specified.
// serverNameOverride is for testing only. If set to a non empty string,
// it will override the virtual host name of authority (e.g. :authority header
// field) in requests.
func NewClientTLSFromCert(cp *x509.CertPool, serverNameOverride string) TransportCredentials {
    return NewTLS(&tls.Config{ServerName: serverNameOverride, RootCAs: cp})
}

我對它如何從公鑰(這里的證書)生成 TLS 憑證感到困惑。

這將如何運作? 如果我從公共證書生成憑據,為什么它會在其 TLS 證書已使用 TLS CA 的私鑰簽名的服務器端被接受?

這里到底發生了什么,這里的連接是如何保護的?

gRPC 中的傳輸“憑證”完全負責與客戶端/服務器的握手。 這意味着它們包括配置,而不僅僅是像私鑰和其他秘密這樣的“憑證”。 對於此處的 TLS,它包括在驗證服務器證書時要使用的根信任證書。 您可以將其視為“TLS 配置”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM