Interactive TLS certificate prompt in session.open()
Using
The following is the log content:
session.open()
in C# does not display related messages during execution. It can be found in the log that there is a request for consent during execution. If SessionOptions.GiveUpSecurityAndAcceptAnyTlsHostCertificate = true;
or SessionOptions.TlsHostCertificateFingerprint;
The reason is that the certificate is not approved or the certificate is not specified, but I need the user to agree to the certificate. What should I do to get the message when the session.open();
is executed.
The following is the log content:
[2021-12-10 12:49:09.675] [0001] Read node 3: Element session [2021-12-10 12:49:09.675] [0001] Log contents has not changed [2021-12-10 12:49:09.675] [0001] SessionLogReader.Read leaving [2021-12-10 12:49:09.676] [0001] SessionLogReader.Read entering [2021-12-10 12:49:09.677] [0001] Waiting for log update and dispatching events for 50 [2021-12-10 12:49:09.677] [0001] Output: [SHA-256: 29:d7:a9:10:f9:40:fc:23:74:8d:d1:68:86:a6:c5:d7:a6:d4:04:9d:8b:3f:4c:3f:6b:a5:d9:4e:bc:e8:ee:30] [2021-12-10 12:49:09.677] [0001] Output: [SHA-1: 07:20:c0:c9:b3:6d:8a:3c:12:b8:d8:0a:71:e0:d7:85:bd:99:67:a2] [2021-12-10 12:49:09.677] [0001] Output: [winscp> option batch on] [2021-12-10 12:49:09.677] [0001] Output: [batch on ] [2021-12-10 12:49:09.677] [0001] Output: [reconnecttime 120 ] [2021-12-10 12:49:09.677] [0001] Output: [winscp> option confirm off] [2021-12-10 12:49:09.677] [0001] Output: [confirm off ] [2021-12-10 12:49:09.677] [0001] Output: [winscp> option reconnecttime 120] [2021-12-10 12:49:09.677] [0001] Output: [reconnecttime 120 ] [2021-12-10 12:49:09.677] [0001] Output: [winscp> open "ftp://anonymous:***@xxx.xxx.xxx.xxx:21" -explicit -passive=0 -timeout=60] [2021-12-10 12:49:09.677] [0001] Output: [Connecting to xxx.xxx.xxx.xxx ...] [2021-12-10 12:49:09.677] [0001] Output: [The server's certificate is not known. You have no guarantee that the server is the computer you think it is.] [2021-12-10 12:49:09.677] [0001] Output: [Server's certificate details follow:] [2021-12-10 12:49:09.677] [0001] Output: [Issuer:] [2021-12-10 12:49:09.677] [0001] Output: [- Organization: asd, asd, *.nuu.edu.tw, asd] [2021-12-10 12:49:09.677] [0001] Output: [- Location: TW, asd, asd] [2021-12-10 12:49:09.677] [0001] Output: [Subject:] [2021-12-10 12:49:09.677] [0001] Output: [- Organization: asd, asd, *.nuu.edu.tw, asd] [2021-12-10 12:49:09.677] [0001] Output: [- Location: TW, asd, asd] [2021-12-10 12:49:09.677] [0001] Output: [Valid: 2021/12/9 上午 02:00:24 - 2022/12/9 上午 02:00:24] [2021-12-10 12:49:09.677] [0001] Output: [Fingerprints:] [2021-12-10 12:49:09.677] [0001] Output: [- SHA-256: 29:d7:a9:10:f9:40:fc:23:74:8d:d1:68:86:a6:c5:d7:a6:d4:04:9d:8b:3f:4c:3f:6b:a5:d9:4e:bc:e8:ee:30] [2021-12-10 12:49:09.677] [0001] Output: [- SHA-1: 07:20:c0:c9:b3:6d:8a:3c:12:b8:d8:0a:71:e0:d7:85:bd:99:67:a2] [2021-12-10 12:49:09.677] [0001] Output: [Summary: Self-signed certificate. The error occurred at a depth of 1 in the certificate chain.] [2021-12-10 12:49:09.677] [0001] Output: [When connecting using an IP address, it is not possible to verify if the certificate was issued for the server. Use a hostname instead of the IP address.] [2021-12-10 12:49:09.677] [0001] [color=red]Output: [If you trust this certificate, press Yes. To connect without storing certificate, press No. To abandon the connection press Cancel.][/color] [2021-12-10 12:49:09.677] [0001] Output: [Continue connecting and store the certificate?] [2021-12-10 12:49:09.741] [0001] Waiting for log update and dispatching events for 100 [2021-12-10 12:49:09.853] [0001] Waiting for log update and dispatching events for 200 [2021-12-10 12:49:10.066] [0001] Waiting for log update and dispatching events for 400 [2021-12-10 12:49:10.480] [0001] Waiting for log update and dispatching events for 800 [2021-12-10 12:49:11.283] [0001] Waiting for log update and dispatching events for 800 [2021-12-10 12:49:12.087] [0001] Waiting for log update and dispatching events for 800 [2021-12-10 12:49:12.888] [0001] Waiting for log update and dispatching events for 800 [2021-12-10 12:49:13.698] [0001] Waiting for log update and dispatching events for 800 [2021-12-10 12:49:14.501] [0001] Waiting for log update and dispatching events for 800 [2021-12-10 12:49:15.305] [0001] Waiting for log update and dispatching events for 800 [2021-12-10 12:49:16.106] [0001] Waiting for log update and dispatching events for 800 [2021-12-10 12:49:16.915] [0001] Waiting for log update and dispatching events for 800 [2021-12-10 12:49:17.722] [0001] Waiting for log update and dispatching events for 800 [2021-12-10 12:49:18.527] [0001] Waiting for log update and dispatching events for 800 [2021-12-10 12:49:19.332] [0001] Waiting for log update and dispatching events for 800 [2021-12-10 12:49:19.659] [0004] Options Result: [-2] [2021-12-10 12:49:19.659] [0004] ExeSessionProcess.ProcessChoiceEvent leaving [2021-12-10 12:49:19.659] [0004] Releasing communication structure [2021-12-10 12:49:19.659] [0004] Released communication structure [2021-12-10 12:49:19.659] [0004] Response event set [2021-12-10 12:49:19.659] [0004] ExeSessionProcess.ProcessEvent leaving [2021-12-10 12:49:19.659] [0004] 2nd generation collection count: 4 [2021-12-10 12:49:19.659] [0004] Total memory allocated: 5604544 [2021-12-10 12:49:19.659] [0004] Waiting for request event [2021-12-10 12:49:19.659] [0004] Got request event [2021-12-10 12:49:19.659] [0004] ExeSessionProcess.ProcessEvent entering [2021-12-10 12:49:19.659] [0004] Acquiring communication structure [2021-12-10 12:49:19.659] [0004] Acquired communication structure [2021-12-10 12:49:19.659] [0004] Print: Cancel [2021-12-10 12:49:19.659] [0004] [color=red]Scheduling output: [(Y)es, (N)o, C(a)ncel (10 s), (C)opy Key: Cancel][/color] [2021-12-10 12:49:19.659] [0004] Releasing communication structure [2021-12-10 12:49:19.659] [0004] Released communication structure [2021-12-10 12:49:19.659] [0004] Response event set [2021-12-10 12:49:19.659] [0004] ExeSessionProcess.ProcessEvent leaving [2021-12-10 12:49:19.659] [0004] 2nd generation collection count: 4 [2021-12-10 12:49:19.659] [0004] Total memory allocated: 5620928 [2021-12-10 12:49:19.660] [0001] Output: [(Y)es, (N)o, C(a)ncel (10 s), (C)opy Key: Cancel] [2021-12-10 12:49:19.660] [0004] Waiting for request event [2021-12-10 12:49:19.660] [0004] Got request event [2021-12-10 12:49:19.660] [0004] ExeSessionProcess.ProcessEvent entering [2021-12-10 12:49:19.660] [0004] Acquiring communication structure [2021-12-10 12:49:19.660] [0004] Acquired communication structure [2021-12-10 12:49:19.660] [0004] Print: Connection failed. Peer certificate rejected Disconnected from server Connection failed.