Quantcast
Channel: SSH.NET Library
Viewing all articles
Browse latest Browse all 2955

New Post: PrivateKeyAuthentication from Stream

$
0
0
Update, tried it, it errors out with the following:

at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, AccessControlActions control, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.IO.File.Open(String path, FileMode mode)
at Renci.SshNet.PrivateKeyFile..ctor(String fileName)
at RCERTPCDC.RencieTest.button1_Click(Object sender, EventArgs e) in C:\Users\Jonathon.Wright\Documents\Visual Studio 2010\Projects\MyTestProject\TP\View\RencieTest.cs:line 33

This is line 33:
PrivateKeyFile privatekey = new PrivateKeyFile(pathToKey);
Guess it doesn't work that way. I tried the url in the browser, the text of the key comes right up, so its the type of Object I'm passing which is causing the error. This is probably true since the first error is from the Rencie.SshNet namespace :
"Renci.SshNet.PrivateKeyFile..ctor(String fileName)" indicating it does want a String filename, not a Stream.

Am I passing the incorrect object type to my PrivateKey class, causing Renci.SshNet.PrivateKeyFile to error, or is Renci.SshNet.PrivateKeyFile not able to handle anything other than a file?

Let me know your thoughts. Thanks again!

SK

Viewing all articles
Browse latest Browse all 2955

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>