@@ -639,7 +639,7 @@ private bool ValidateFingerprint(byte[]? validationHash, ReadOnlySpan<byte> chal
639
639
Span < byte > combined = stackalloc byte [ 32 + challenge . Length + passwordHashResult . Length ] ;
640
640
passwordHashResult . CopyTo ( combined ) ;
641
641
challenge . CopyTo ( combined [ passwordHashResult . Length ..] ) ;
642
- m_sha2Thumbprint ! . CopyTo ( combined [ ( passwordHashResult . Length + challenge . Length ) ..] ) ;
642
+ m_remoteCertificateSha2Thumbprint ! . CopyTo ( combined [ ( passwordHashResult . Length + challenge . Length ) ..] ) ;
643
643
644
644
Span < byte > hashBytes = stackalloc byte [ 32 ] ;
645
645
#if NET5_0_OR_GREATER
@@ -1593,13 +1593,13 @@ caCertificateChain is not null &&
1593
1593
if ( rcbCertificate is X509Certificate2 cert2 )
1594
1594
{
1595
1595
// saving sha256 thumbprint and SSL errors until thumbprint validation
1596
- #if ! NET5_0_OR_GREATER
1597
- using ( var sha256 = SHA256 . Create ( ) )
1598
- {
1599
- m_sha2Thumbprint = sha256 . ComputeHash ( cert2 . RawData ) ;
1600
- }
1596
+ #if NET7_0_OR_GREATER
1597
+ m_remoteCertificateSha2Thumbprint = SHA256 . HashData ( cert2 . RawDataMemory . Span ) ;
1598
+ #elif NET5_0_OR_GREATER
1599
+ m_remoteCertificateSha2Thumbprint = SHA256 . HashData ( cert2 . RawData ) ;
1601
1600
#else
1602
- m_sha2Thumbprint = SHA256 . HashData ( cert2 . RawData ) ;
1601
+ using var sha256 = SHA256 . Create ( ) ;
1602
+ m_remoteCertificateSha2Thumbprint = sha256 . ComputeHash ( cert2 . RawData ) ;
1603
1603
#endif
1604
1604
m_rcbPolicyErrors = rcbPolicyErrors ;
1605
1605
return true ;
@@ -2127,6 +2127,6 @@ protected override void OnStatementBegin(int index)
2127
2127
private byte [ ] ? m_pipelinedResetConnectionBytes ;
2128
2128
private Dictionary < string , PreparedStatements > ? m_preparedStatements ;
2129
2129
private string m_pluginName = "mysql_native_password" ;
2130
- private byte [ ] ? m_sha2Thumbprint ;
2130
+ private byte [ ] ? m_remoteCertificateSha2Thumbprint ;
2131
2131
private SslPolicyErrors m_rcbPolicyErrors ;
2132
2132
}
0 commit comments