public void Generate_Key_Pair()
        {
            var keyPair = RsaUtils.CreatePublicAndPrivateKeyPair();

            "Public Key: {0}\n".Print(keyPair.PublicKey);
            "Private Key: {0}\n".Print(keyPair.PrivateKey);
        }
Example #2
0
        public void CanEncryptWithStringExtension()
        {
            RsaUtils.KeyLength      = RsaKeyLengths.Bit1024;
            RsaUtils.DefaultKeyPair = RsaUtils.CreatePublicAndPrivateKeyPair();

            string TestStart = "Mr. Watson--come here--I want to see you.";
            string Encrypted;
            string Decrypted;

            Encrypted = TestStart.Encrypt();
            Assert.AreNotEqual(Encrypted, TestStart);

            Decrypted = Encrypted.Decrypt();
            Assert.AreEqual(Decrypted, TestStart);
        }