Exemplo n.º 1
0
        static void GenerateTrialLicenseKey(double days)
        {
            string         seed = DateTime.Today.Add(TimeSpan.FromDays(days)).ToLongDateString();
            LicenseService Bob  = new LicenseService();

            using (LicenseGenerator Alice = new LicenseGenerator()) {
                string text64 = Bob.EncryptSessionKeyByRSA(seed, Alice.Public_KeyUsed);
                byte[] buff   = Convert.FromBase64String(text64);
                Report("Trial License until {1}:\n{0}", text64, Alice.DecryptSessionKeyByRSA(text64));
            }
        }
Exemplo n.º 2
0
        static void QuodEratDemonstrandum()
        {
            bool           AliceToBob = true;
            LicenseService Bob        = new LicenseService();

            if (AliceToBob)
            {
                using (LicenseGenerator Alice = new LicenseGenerator()) {
                    string text64 = Bob.EncryptSessionKeyByRSA("How can it be", Alice.Public_KeyUsed);
                    byte[] buff   = Convert.FromBase64String(text64);
                    Report("Local Result = [{0}]", Alice.DecryptSessionKeyByRSA(text64));
                }
            }
            else
            {
                using (LicenseGenerator Alice = new LicenseGenerator()) {
                    string text64 = Alice.EncryptSessionKeyByRSA("How can it be", Bob.GetPublicKey());
                    Report("Result = [{0}]", Bob.DecryptSessionKeyByRSA(text64));
                }
            }
        }