/// <summary>
        /// sblocco della licenza Chilkat http://www.chilkatsoft.com/
        /// metodo da chiamare prima di utilizzare gli altri metodo che necessitano di licenza
        /// una volta chiamato non necessita di essere richiamato
        /// </summary>
        /// <param name="unlock">codice di sblocco licenza</param>
        /// <param name="lastError">ultimo errore nella funzionalità</param>
        /// <returns>true sblocco della licenza con successo</returns>
        public static bool UnlockLicense(string unlock, ref string lastError)
        {
            bool success = false;

            try
            {
                Utilities.glob = new Chilkat.Global();
                success        = Utilities.glob.UnlockBundle(unlock);

                if (!success)
                {
                    lastError = Utilities.glob.LastErrorText;
                    return(success);
                }

                int status = Utilities.glob.UnlockStatus;

                if (status != 0)
                {
                    success = true;
                }

                lastError = Utilities.glob.LastErrorText;
            }
            catch
            {
                throw;
            }

            return(success);
        }
        public void unlock()
        {
            // Start Global Chilkat Unlock
            Chilkat.Global glob = new Chilkat.Global();

            bool success = glob.UnlockBundle("nahaan.CBX1125_FUiiNrsmOG2G");

            if (success != true)
            {
                //encoder.listBox1.Items.Add(glob.LastErrorText);
                MessageBox.Show(glob.LastErrorText);
            }

            int status = glob.UnlockStatus;

            if (status == 2)
            {
                //listBox1.Items.Add("Unlocked using purchased unlock code.");
                //MessageBox.Show("Unlocked using purchased unlock code.");
            }
            else
            {
                //listBox1.Items.Add("Unlocked in trial mode.");
                MessageBox.Show("Unlocked in trial mode.");
            }

            // End Global Chilkat Unlock
        }
예제 #3
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Chilkat.Global glob = new Chilkat.Global();
     if (!glob.UnlockBundle("Anything for 30-day trial"))
     {
         MessageBox.Show("Failed to unlock Chilkat.");
         textBox1.Text = glob.LastErrorText;
     }
 }
예제 #4
0
        static void Main(string[] args)
        {
            Chilkat.Global glob    = new Chilkat.Global();
            bool           success = glob.UnlockBundle("Anything for 30-day trial");

            if (success != true)
            {
                Debug.WriteLine(glob.LastErrorText);
                return;
            }

            int status = glob.UnlockStatus;

            if (status == 2)
            {
                Debug.WriteLine("Unlocked using purchased unlock code.");
            }
            else
            {
                Debug.WriteLine("Unlocked in trial mode.");
            }

            // The LastErrorText can be examined in the success case to see if it was unlocked in
            // trial more, or with a purchased unlock code.
            Debug.WriteLine(glob.LastErrorText);

            var certPath = $@"{AppDomain.CurrentDomain.BaseDirectory}server_20110101.pfx";

            var server          = "83.220.246.39";
            var port            = 9000;
            var maxWaitMillisec = 10000;

            //var certPass = "******";

            using (var socket = new Chilkat.Socket
            {
                SocksHostname = server,
                SocksPort = port,
                SocksUsername = "******",
                SocksPassword = "******",
                SocksVersion = 5,
                MaxReadIdleMs = maxWaitMillisec,
                MaxSendIdleMs = maxWaitMillisec
            })
            {
                var cert = new Chilkat.Cert();
                cert.LoadFromFile(certPath);

                socket.SetSslClientCert(cert);

                socket.Connect(server, port, true, maxWaitMillisec);

                var receivedString = socket.ReceiveString();

                Console.WriteLine(receivedString ?? "none");
            }
        }
예제 #5
0
        public MainPage()
        {
            this.InitializeComponent();
            m_dispatcher = Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher;

            Chilkat.Global glob = new Chilkat.Global();
            m_unlocked = glob.UnlockBundle("Anything for 30-day trial");
            if (!m_unlocked)
            {
                m_unlockError = glob.LastErrorText;
            }
        }
예제 #6
0
        private Chilkat.Crypt2 m_encoder = null;        // We'll use this for encoding/decoding

        public Form1()
        {
            InitializeComponent();

            Chilkat.Global glob = new Chilkat.Global();
            if (!glob.UnlockBundle("Anything for 30-day trial"))
            {
                MessageBox.Show("Failed to unlock Chilkat.");
            }

            m_prng    = new Chilkat.Prng();
            m_encoder = new Chilkat.Crypt2();
        }
예제 #7
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Unlock the Chilkat functionality.
            // This is an automatic 30-day trial, but requires a purchased license to use indefinitely.
            Chilkat.Global global  = new Chilkat.Global();
            bool           success = global.UnlockBundle(ChilkatUnlockCode);

            if (!success)
            {
                textBox1.Text = "Failed to unlock Chilkat.";
                return;
            }
        }
예제 #8
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Unlock all of Chilkat, and discard the Chilkat.Global object.
            // Once unlocked, all subsequent Chilkat objects are created already unlocked.
            Chilkat.Global glob    = new Chilkat.Global();
            bool           success = glob.UnlockBundle("Anything for 30-day trial");

            if (!success)
            {
                MessageBox.Show("30-day trial has ended.");
            }

            m_clientSock.OnTaskCompleted += m_clientSock_OnTaskCompleted;
        }
예제 #9
0
        static void Main(string[] args)
        {
            GenerarArchivo();
            Console.WriteLine("archivo generado con exito");
            Console.ReadKey();

            Chilkat.Global glob          = new Chilkat.Global();
            bool           successUnlock = glob.UnlockBundle("Anything for 30-day trial");

            if (successUnlock != true)
            {
                Console.WriteLine(glob.LastErrorText);
                return;
            }

            int status = glob.UnlockStatus;

            if (status == 2)
            {
                Console.WriteLine("Unlocked using purchased unlock code.");
            }
            else
            {
                Chilkat.Ftp2 ftp = new Chilkat.Ftp2();

                ftp.Hostname = "localhost";
                ftp.Username = "******";
                ftp.Password = "******";

                // Connect and login to the FTP server.
                bool success = ftp.Connect();
                if (success != true)
                {
                    Console.WriteLine(ftp.LastErrorText);
                    Console.WriteLine("Press any key to exit...");
                    Console.ReadKey();
                    return;
                }

                // Change to the remote directory where the file will be uploaded.
                success = ftp.ChangeRemoteDir("doc");
                if (success != true)
                {
                    Console.WriteLine(ftp.LastErrorText);
                    return;
                }

                // Upload a file.
                string localPath      = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName) + @"\prueba.txt";
                string remoteFilename = "prueba.txt";

                success = ftp.PutFile(localPath, remoteFilename);
                if (success != true)
                {
                    Console.WriteLine(ftp.LastErrorText);
                    Console.WriteLine("Press any key to exit...");
                    Console.ReadKey();
                    return;
                }

                success = ftp.Disconnect();

                Console.WriteLine("File Uploaded!");
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
            }
        }
예제 #10
0
 private void RegisterChilKat()
 {
     var glob    = new Chilkat.Global();
     var success = glob.UnlockBundle("Anything for 30-day trial");
 }
예제 #11
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseCors(builder => builder
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .AllowCredentials()
                        ); //for CORS

            app.Use(async(context, next) => {
                //var token = context.Request.Headers["Authorization"];
                // var token = context.Request.Cookies["UserLoginAPItoken"];

                //switch(context.Request.Path.ToString())
                Console.WriteLine(context.Request.Path.ToString());
                //switch(context.Request.Path.ToString())
                if (context.Request.Path.Value.StartsWith("/auth") || context.Request.Path.Value.StartsWith("/gameplay") || context.Request.Path.Value.StartsWith("/favicon") ||
                    context.Request.Path.Value.StartsWith("/questiongenerator") || context.Request.Path.Value.StartsWith("/quizmaster"))
                {
                    Console.WriteLine("Calling next middleware");
                    await next();
                }
                else
                {
                    Microsoft.AspNetCore.Http.IRequestCookieCollection cookies = context.Request.Cookies;
                    var token           = cookies["UserLoginAPItoken"];
                    Chilkat.Global glob = new Chilkat.Global();
                    glob.UnlockBundle("Anything for 30-day trial");

                    using (var client = new ConsulClient())
                    {
                        Console.WriteLine("---------entered consul----------------");
                        client.Config.Address = new Uri("http://consul:8500");
                        var getpair2          = client.KV.Get("secretkey");
                        Console.WriteLine(getpair2);
                        Console.WriteLine("------got the getpair2------");
                        Console.WriteLine("-------key-----" + getpair2.Result.Response.Key);
                        Console.WriteLine("------Value-----" + getpair2.Result.Response.Value);
                        //var getresult = getpair2.Result.Response.Value
                        // if(getpair2.Result.Response.Value != null)
                        // {
                        Console.WriteLine("---------Entered the function");
                        string secret = System.Text.Encoding.UTF8.GetString(getpair2.Result.Response.Value);
                        Console.WriteLine("------------Secret Key------------" + secret);
                        Chilkat.Rsa rsaExportedPublicKey = new Chilkat.Rsa();
                        rsaExportedPublicKey.ImportPublicKey(secret);
                        var publickey = rsaExportedPublicKey.ExportPublicKeyObj();
                        Console.WriteLine("--------publickey--------" + publickey);
                        Console.WriteLine("-----token-----" + token);
                        var jwt = new Chilkat.Jwt();
                        if (jwt.VerifyJwtPk(token, publickey))
                        {
                            Console.WriteLine("--inside verify");
                            await next();
                        }
                        else
                        {
                            context.Response.StatusCode = 403;
                            await context.Response.WriteAsync("UnAuthorized");
                        }
                    }
                }
            });

            app.UseWebSockets();
            app.UseOcelot().Wait();
        }
예제 #12
0
 private void Form1_Load(object sender, EventArgs e)
 {
     // Unlock the Chilkat functionality.
     // This is an automatic 30-day trial, but requires a purchased license to use indefinitely.
     Chilkat.Global global = new Chilkat.Global();
     bool success = global.UnlockBundle(ChilkatUnlockCode);
     if (!success)
     {
     textBox1.Text = "Failed to unlock Chilkat.";
     return;
     }
 }