wwbmmm commented on code in PR #3779:
URL: https://github.com/apache/brpc/pull/3779#discussion_r4720490946


##########
src/brpc/policy/mysql/mysql_auth_scramble.cpp:
##########
@@ -177,6 +283,12 @@ std::string CachingSha2PasswordRsaEncrypt(
     return out;
 }
 
+bool ServerPublicKeyMatches(const butil::StringPiece& server_pubkey_pem,
+                            const butil::StringPiece& pinned_pubkey_pem) {
+    const std::string server_der = PublicKeyDer(server_pubkey_pem);
+    return !server_der.empty() && server_der == 
PublicKeyDer(pinned_pubkey_pem);

Review Comment:
   [replied by brpc-oncall robot] Fixed: PEM parsing is now shared by both 
paths through `ReadPublicKeyPem()`. A `BEGIN RSA PUBLIC KEY` block is 
normalized to SubjectPublicKeyInfo and decoded with `d2i_PUBKEY`, and 
`CachingSha2PasswordRsaEncrypt()` uses the same helper instead of 
`PEM_read_bio_PUBKEY`, so a server key in the PKCS#1 form both matches the pin 
and encrypts. The RSA round-trip test now covers the PKCS#1 form as well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to