Beispiel #1
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));
                }
            }
        }