microsoft / msquic

Cross-platform, C implementation of the IETF QUIC protocol, exposed to C, C++, C# and Rust.
MIT License
4.05k stars 530 forks source link

Shut down by transport, 0x8041012a #3190

Closed 0xhellord closed 1 year ago

0xhellord commented 2 years ago

I compiled msquic sample(/src/tools/sample/sample.c) with latest release msquic_windows_x64_Release_openssl.zip. But got error message: Shut down by transport, 0x8041012a if compile with msquic_windows_x64_release_schannel.zip, I got "Shut down by transport, 0x80410130".

Step:

1.create a VS project, import sample.c and headers, then link with lib file from latest msquic_windows_x64_Release_openssl.zip.

  1. PS > New-SelfSignedCertificate -DnsName $env:computername,localhost -FriendlyName MsQuic-Test -KeyUsageProperty Sign -KeyUsage DigitalSignature -CertStoreLocation cert:\CurrentUser\My -HashAlgorithm SHA256 -Provider "Microsoft Software Key Storage Provider" -KeyExportPolicy Exportable

    PSParentPath:Microsoft.PowerShell.Security\Certificate::CurrentUser\My

Thumbprint Subject BFAB735F6561DE0F6C94BC08374705014B6AF8D0 CN=DESKTOP-979GBCG

  1. run quicsample.exe -server -cert_hash:BFAB735F6561DE0F6C94BC08374705014B6AF8D0

  2. run quicsample.exe -client --unsecure -target:127.0.0.1 [conn][00000205B6E12090] Connecting... [conn][00000205B6E12090] Shut down by transport, 0x8041012a [conn][00000205B6E12090] All done

I tried use openssl to generate cert and key file, the result is same. If use channel version , the error code will be 0x80410130.

Os version is 10.0.22621.754(win11 x64).

nibanks commented 2 years ago

It seems you're getting a TLS alert.

#define QUIC_TLS_ALERT_HRESULT_PREFIX   _HRESULT_TYPEDEF_(0x80410100L)
#define QUIC_STATUS_TLS_ALERT(Alert)        (QUIC_TLS_ALERT_HRESULT_PREFIX | (0xff & Alert))

For 0x8041012a that indicates alert 2a which is bad_certificate. For 0x80410130 that indicates alert 0x30 which seems to be unknown_ca. (looked up from here).

So, something is up with the server certificate.

0xhellord commented 2 years ago

It seems you're getting a TLS alert.

#define QUIC_TLS_ALERT_HRESULT_PREFIX   _HRESULT_TYPEDEF_(0x80410100L)
#define QUIC_STATUS_TLS_ALERT(Alert)        (QUIC_TLS_ALERT_HRESULT_PREFIX | (0xff & Alert))

For 0x8041012a that indicates alert 2a which is bad_certificate. For 0x80410130 that indicates alert 0x30 which seems to be unknown_ca. (looked up from here).

So, something is up with the server certificate.

yeah, I'm tring to compile the code and debug it.

And what intresting is: If run server and client in powershell , then everything works well! But if run in cmd, always got 0x8041012a or 0x80410130.

nibanks commented 2 years ago

Are you running in an "admin" PowerShell perhaps?

0xhellord commented 2 years ago

Are you running in an "admin" PowerShell perhaps?

No, both cmd and PowerShell not in admin mode.

nibanks commented 2 years ago

@0xhellord did you ever figure out what the problem was here?

0xhellord commented 1 year ago

@0xhellord did you ever figure out what the problem was here?

@nibanks Seems only reproduceable on my home pc. And these days I almost put all of my time on work, I'll begin to dig it this weekend.

0xhellord commented 1 year ago

After reboot, can't reproduce it anymore.

Sy0307 commented 5 months ago

I encountered the same problem on macos, but quicsample ran normally after using powershell. I am not sure why this problem occurred.