how to get cert from ftps server?(powershell)

Netanel Stern 1 Reputation point
2022-12-01T13:11:32.557+00:00

I glad for ay help

thanks a lot
Nate

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,580 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Limitless Technology 44,496 Reputation points
    2022-12-02T12:17:20.243+00:00

    Hello there,

    Found this script online that demonstrates how to connect to an FTP server, examine the server's SSL/TLS certificate, and then, if it meets the application's security requirements, proceed to authenticate.

    Add-Type -Path "xyz".

    $ftp = New-Object xyz.Ftp2

    $ftp.Hostname = "www.authtls-ftps-server.com"
    $ftp.Username = "FTP_LOGIN"
    $ftp.Password = "FTP_PASSWORD"
    $ftp.AuthTls = $true
    $ftp.Port = 21

    Connect to the FTP server using explicit TLS (AUTH TLS).

    $success = $ftp.ConnectOnly()
    if ($success -ne $true) {
    $($ftp.LastErrorText)
    exit
    }

    Get the FTP server's certificate.

    $serverCert = $ftp.GetSslServerCert()
    if ($ftp.LastMethodSuccess -ne $true) {
    $($ftp.LastErrorText)
    exit
    }

    Assuming the certificate is OK, proceed to authenticate with the FTP server.

    $success = $ftp.LoginAfterConnectOnly()
    if ($success -ne $true) {
    $($ftp.LastErrorText)
    exit
    }

    Proceed with uploading/download files, etc...

    $ftp.Disconnect()
    $("Success.")

    ---------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments

  2. Netanel Stern 1 Reputation point
    2022-12-03T17:14:55.357+00:00

    in which ttype I need to use?

    0 comments No comments

  3. MotoX80 34,766 Reputation points
    2022-12-04T19:42:01.3+00:00

    I have not been able to find anything related to "xyz" as provided by Limitless in their example. That doesn't mean that it doesn't exist, I just don't know where it comes from.

    In any event, I doubt that that code example is going to do much for you since it won't include the private key needed to decrypt anything that is encrypted by the certs public key.

    What exactly are you trying to accomplish? What do you intend to do with the certificate once you get it?

    Do you wish to move a certificate from one server to another?

    https://www.bing.com/search?q=iis+export+certificate

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.