SSL Certificate from the command line

Advertisement

briandent
Joined:
Posts:
2

SSL Certificate from the command line

I'm on 5.21.6.
I had to update my SSL certificate but now I can't get my batch file to save it.
The command line is shown below and when I run it interactively from the command prompt I get message
the certificate is unknown. I've answered y but it doesn't save the cert. In the past I was able to
use the app and save the certificate there. Then I wasn't prompted again. I've tried the
-certificate and -host flags but those haven't worked. What am I missing?
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="%~dp0%~n0_winscp.log" /ini=nul ^
  /command ^
    "open ftpes://offsite:xxxxxxxx@ash.compudent.us/ -rawsettings ProxyPort=1 MinTlsVersion=11" ^
    "lcd %BACKUPDATA5TB%\BERYL\DATA" ^
    "cd /OFFSITE" ^
    "put -filemask=""*.txt>2D;*.log>2D;*.7z>2D;*.zip>2D;*.zipx>2D"" -neweronly -rawtransfersettings[2] PreserveTimeDirs=1 ExcludeEmptyDirectories=1 *" ^
    "exit" >> %~dp0%~n0.log
The server's certificate is not known. You have no guarantee that the server is the computer you think it is.
Server's certificate details follow:
Issuer:
- Organization: DigiCert Inc, www.digicert.com, RapidSSL TLS RSA CA G1
- Location: US
Subject:
- Organization: *.compudent.us
Valid: 1/9/2024 12:00:00 AM - 1/12/2025 11:59:59 PM
Fingerprints:
- SHA-256: 22:cf:ab:6c:9d:37:9d:07:3e:4d:c9:7a:70:e4:24:04:67:86:cd:3f:23:9c:1a:de:df:22:6c:38:da:ff:34:ba
- SHA-1: 1d:86:3e:ed:ec:79:df:08:f4:06:47:7c:86:1f:cb:fd:5f:65:cf:53
Summary: Self-signed certificate in certificate chain. The error occurred at a depth of 3 in the certificate chain.
If you trust this certificate, press Yes. To connect without storing certificate, press No. To abandon the connection press Cancel.
Continue connecting and store the certificate?
(Y)es, (N)o, C(a)ncel (8 s), (C)opy Key:

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,262
Location:
Prague, Czechia

Re: SSL Certificate from the command line

Using the -certificate switch is the correct approach.
But you didn't tell us how exactly did you use it.
It should be like:
    "open ftpes://offsite:xxxxxxxx@ash.compudent.us/ -certificate=""22:cf:ab:6c:9d:37:9d:07:3e:4d:c9:7a:70:e4:24:04:67:86:cd:3f:23:9c:1a:de:df:22:6c:38:da:ff:34:ba"" -rawsettings ProxyPort=1 MinTlsVersion=11" ^

Reply with quote

briandent

SSL Certificate from the command line - permanent

Thank you for your help. I was missing the double "'s.
Is there a way to save this certificate so the -certificate flag is not necessary?
Thank you again.

Reply with quote

Advertisement

You can post new topics in this forum