Can you please provide some assistance using this product via PowerShell. I have a script that is running using the sFTP libraries, but now have a need to use FTP/SSL.

The main issue I am having is storing and accessing the .pfx keys provided by the company we are connecting to. Has anyone done this?

Any and all help would be great.

asked 16 Aug '11, 16:38

Scott's gravatar image

Scott
15
accept rate: 0%


We have a blogpost describing the basics: Using FTP or SFTP in PowerShell

Getting the .pfx keys to work requires few additional lines of code. If these are client certificates that are intended for client authentication, the following code should do the trick:

[Reflection.Assembly]::LoadFrom("C:\Program Files\Rebex\FTP for .NET 2.0\bin\release\Rebex.Net.Ftp.dll")
[Reflection.Assembly]::LoadFrom("C:\Program Files\Rebex\FTP for .NET 2.0\bin\release\Rebex.Net.SecureSocket.dll")

$certificate = [Rebex.Security.Certificates.CertificateChain]::LoadPfx("c:\...\ClientCerts.pfx", "password")

$params = New-Object Rebex.Net.TlsParameters
$params.CertificateRequestHandler = [Rebex.Net.CertificateRequestHandler]::CreateRequestHandler($certificate)

$ftp = New-Object Rebex.Net.Ftp
$ftp.Connect("ftp.example.com", 21, $params, [Rebex.Net.FtpSecurity]::Explicit)

Please refer to our FTP/SSL tutorial for more information about these classes and methods.

link

answered 16 Aug '11, 18:19

Lukas%20Pokorny's gravatar image

Lukas Pokorny ♦♦
2.4k28
accept rate: 31%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×14

Asked: 16 Aug '11, 16:38

Seen: 412 times

Last updated: 16 Aug '11, 18:19