//  
//   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.
// 

using System;
using System.Text;
using Rebex.Net;

namespace Rebex.Samples
{
    /// <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>
    static class ServerKey
    {
        private static string PrivateKey =
@"-----BEGIN ENCRYPTED PRIVATE KEY-----
MIICxjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQI6QvWOL1VjagCAggA
MBQGCCqGSIb3DQMHBAgaDeSPigCYFgSCAoAmvA6U8qUJJ+r2T7uwzlLVSLPt0hLn
OgvO4bnHV8m26rM9Rb+zi1cWnaEuojyCmtC+ITJUsUgNDqUYSUBsoJw4I1BlvxSf
Gdp16el9Vj+LYimeOpbfA6cGx9bB4HBb3/KzKXbrX1KbdbymIH7Ugd68W/kubj89
kFgyDrcBwCm/fp6u8Q2wTGugyI8xYHN9MH4HnyKoa9BCzR0PQTEuy5ZPPYaMOOtt
5a3SeIY8XCNhczsWAQaqt7xSnpe9s0Cw4k2XXTVSNfF8yEfgThQwGjqLrRU8lDAz
mSyzbsAFNBXTDHBBDj91tZCOFzAM0IrR5GohmxNZ9Trttv/G/PoXin36ojmgmOWc
o+RZ3rqoA1zIn5vtbRAqmzIiCFEZQS0IaysvvxvzPiShs23ZrsJY3y+CaGr2hK/g
w2UuIO7/C2UBXvzcFtCSrYhBK3AAmzbiSqz2mKa0SI+jpa1TRvBa4rs+GkJa5eJ4
ATe2fPSRzVfO0Vj/FWmsEWEOXtQhFJinWJJqRGS3/FdorPSvp6/41h/K6erVZ+ee
j2022lnND9PSUnGzj0uzOYmUo31M0qvphHYPvE0QdgNOvbRnHaQC0ulo2DCzZBEx
ofcurN5z2O1wbbZWJs8gdBGpIdqibHwTvxSXr4BWIOBeTNWQTYHlHGs5MVToO7FO
IH341LR0K+BWt0DY8M5zeck31BwN9tpl0UW776+QpLsmvPidqXiFtz2ewHDWMbJx
q1R3tK0d0UqBhIpA5hrc2xuoJn68RjjADElgkln3/KtaxZUV2mlZmCCtE2DBXjV2
/iEjowbqDnoOyhDLiNAS7EpnlmVmmTLL1iLcDDjS6lg74fDPq3nC9FgT
-----END ENCRYPTED PRIVATE KEY-----
";

        /// <summary>
        /// Loads and returns the pregenerated private key.
        /// </summary>
        /// <returns>An instance of <see cref="SshPrivateKey"/> class.</returns>
        public static SshPrivateKey GetServerPrivateKey()
        {
            byte[] data = Encoding.ASCII.GetBytes(PrivateKey);
            return new SshPrivateKey(data, string.Empty);
        }
    }
}
