Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(VB.NET UWP/WinRT) Load SSH Keys Produced by ssh-keygenDemonstrates how to load the public and private keys produced by ssh-keygen.
' This example assumes the Chilkat API to have been previously unlocked. ' See Global Unlock Sample for sample code. ' We first generate a key like this: ' ssh-keygen -f stg.chilkat.id ' Generating public/private rsa key pair. ' Enter passphrase (empty for no passphrase): ' Enter same passphrase again: ' Your identification has been saved in stg.chilkat.id. ' Your public key has been saved in stg.chilkat.id.pub. ' The key fingerprint is: ' SHA256:hkbgexkspxYTa8rYUxouRU8Gi7lbbsT6dSLX+JlStKk me@example02240 ' The key's randomart image is: ' +---[RSA 2048]----+ ' | o.= | ' | + * = | ' |o + X = | ' | O * O.+ | ' |+ @ +.=oS | ' | A o =+. | ' |o + =oo | ' | o +E+ o | ' | . .+ | ' +----[SHA256]-----+ ' ' The public key (generated to the file stg.chilkat.id.pub) contains this: ' ssh-rsa AAAAB3NzaC1yc2EAAAADAQABA.. FDt+dKJEkhw8I7LpEi17diB9 me@example02240 ' First let's load the public key: Dim pubkey As New Chilkat.SshKey Dim success As Boolean = pubkey.FromOpenSshPublicKey(pubkey.LoadText("qa_data/sshKeys/ssh-keygen/stg.chilkat.id.pub")) If (success = False) Then Debug.WriteLine(pubkey.LastErrorText) Exit Sub End If Debug.WriteLine(pubkey.LastErrorText) Debug.WriteLine("Successfully loaded the public key.") ' Now try the private key, which contains this: ' -----BEGIN OPENSSH PRIVATE KEY----- ' b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn ' NhA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J ' BnBpymoyB/r3LnefX4AgKA7nplCRUANLbvTACTazHtcBAAAAgQCihdCPzywEkrn0VhYIOV ' sK7oIUD/EBEzb7yL+7naZqACStbhKiLKGgSJj2+3hgmQk2tZ94zN5lkCcLLFy9Ai47HkN+ ' dSmZqac5pQeVyWrJ/67OSqWxMFfjkbF/0IxXJM2y+i//vGWBDo3NJmkYGwY+XnFP81qqh9 ' boeQA0K6wn0wAAAIEA2tX2lZrwAyhl/L5XY1xsQ3uuoaIUeZD0vUs+mAv1pz8fbTAD2n37 ' Rh57mxDNQIwiD8lV5wZ20NP03nAr8gUQaijsBRy3gDXHX7Qa/BaJ2bY0492HXwVYi9bsng ' GJQinYjmJQQeR/w4u5rNzuD8y1ysMwh/sE8IGu6LLG1IBDYr0AAACBAMord/G9vderFO+1 ' tNZHl09m9mFLJTHRVH41Da2uCl2KJnYir511M9GSG9Un6L+UGu4F9CrypehgJHZ6QbwpgS ' JrwlCfE09jPkuH0aktg9fnrrEJYS30wWNNSj1v/91v1F3fdrZePd+UnKcP6zZB3jICzPhW ' elU1OYdWf+qFrnDBAAAAGWRqYWNrc29uMDIyQGRqYWNrc29uMDIyNDAB ' -----END OPENSSH PRIVATE KEY----- Dim privkey As New Chilkat.SshKey success = privkey.FromOpenSshPrivateKey(pubkey.LoadText("qa_data/sshKeys/ssh-keygen/stg.chilkat.id")) If (success = False) Then Debug.WriteLine(privkey.LastErrorText) Exit Sub End If Debug.WriteLine(privkey.LastErrorText) Debug.WriteLine("Successfully loaded the private key.") |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.