'  
'   Rebex Sample Code License
' 
'   Copyright 2025, REBEX CR s.r.o.
'   All rights reserved.
'   https://www.rebex.net/
' 
'   Permission to use, copy, modify, and/or distribute this software for any
'   purpose with or without fee is hereby granted.
' 
'   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
'   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
'   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
'   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
'   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
'   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
'   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
'   OTHER DEALINGS IN THE SOFTWARE.
' 

Imports System.Text
Imports Rebex.Net

''' <summary>
''' Helper class for getting an SSH private key.
''' The PrivateKey is set to a Base64-encoded pregenerated private key.
''' Make sure to generate your own key if you intend to use this code in production.
''' See http://www.rebex.net/sftp.net/features/private-keys.aspx for more information about SSH keys.
''' </summary>
NotInheritable Class ServerKey
    Private Sub New()
    End Sub

    Private Shared PrivateKey As String = _
        "-----BEGIN ENCRYPTED PRIVATE KEY-----" & vbCr & vbLf & _
        "MIICxjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQI6QvWOL1VjagCAggA" & vbCr & vbLf & _
        "MBQGCCqGSIb3DQMHBAgaDeSPigCYFgSCAoAmvA6U8qUJJ+r2T7uwzlLVSLPt0hLn" & vbCr & vbLf & _
        "OgvO4bnHV8m26rM9Rb+zi1cWnaEuojyCmtC+ITJUsUgNDqUYSUBsoJw4I1BlvxSf" & vbCr & vbLf & _
        "Gdp16el9Vj+LYimeOpbfA6cGx9bB4HBb3/KzKXbrX1KbdbymIH7Ugd68W/kubj89" & vbCr & vbLf & _
        "kFgyDrcBwCm/fp6u8Q2wTGugyI8xYHN9MH4HnyKoa9BCzR0PQTEuy5ZPPYaMOOtt" & vbCr & vbLf & _
        "5a3SeIY8XCNhczsWAQaqt7xSnpe9s0Cw4k2XXTVSNfF8yEfgThQwGjqLrRU8lDAz" & vbCr & vbLf & _
        "mSyzbsAFNBXTDHBBDj91tZCOFzAM0IrR5GohmxNZ9Trttv/G/PoXin36ojmgmOWc" & vbCr & vbLf & _
        "o+RZ3rqoA1zIn5vtbRAqmzIiCFEZQS0IaysvvxvzPiShs23ZrsJY3y+CaGr2hK/g" & vbCr & vbLf & _
        "w2UuIO7/C2UBXvzcFtCSrYhBK3AAmzbiSqz2mKa0SI+jpa1TRvBa4rs+GkJa5eJ4" & vbCr & vbLf & _
        "ATe2fPSRzVfO0Vj/FWmsEWEOXtQhFJinWJJqRGS3/FdorPSvp6/41h/K6erVZ+ee" & vbCr & vbLf & _
        "j2022lnND9PSUnGzj0uzOYmUo31M0qvphHYPvE0QdgNOvbRnHaQC0ulo2DCzZBEx" & vbCr & vbLf & _
        "ofcurN5z2O1wbbZWJs8gdBGpIdqibHwTvxSXr4BWIOBeTNWQTYHlHGs5MVToO7FO" & vbCr & vbLf & _
        "IH341LR0K+BWt0DY8M5zeck31BwN9tpl0UW776+QpLsmvPidqXiFtz2ewHDWMbJx" & vbCr & vbLf & _
        "q1R3tK0d0UqBhIpA5hrc2xuoJn68RjjADElgkln3/KtaxZUV2mlZmCCtE2DBXjV2" & vbCr & vbLf & _
        "/iEjowbqDnoOyhDLiNAS7EpnlmVmmTLL1iLcDDjS6lg74fDPq3nC9FgT" & vbCr & vbLf & _
        "-----END ENCRYPTED PRIVATE KEY-----" & vbCr & vbLf

    ''' <summary>
    ''' Loads and returns the pregenerated private key.
    ''' </summary>
    ''' <returns>An instance of <see cref="SshPrivateKey"/> class.</returns>
    Public Shared Function GetServerPrivateKey() As SshPrivateKey
        Dim data As Byte() = Encoding.ASCII.GetBytes(PrivateKey)
        Return New SshPrivateKey(data, String.Empty)
    End Function
End Class
