Beispiel #1
0
        public void EncryptWithPrivateKeyTest()
        {
            int data = 1112;

            (string, string)keyTuple = RsaHelper.GetKey();
            string publicKey          = keyTuple.Item1;
            string privateKey         = keyTuple.Item2;
            string encryptWithPublic  = RsaHelper.EncryptWithPrivateKey(data, privateKey);
            int    decryptWithPrivate = RsaHelper.DecryptWithPublicKeyAndDeserialize <int>(encryptWithPublic, publicKey);

            Debug.WriteLine(decryptWithPrivate);
            Assert.IsTrue(decryptWithPrivate == data);
        }