示例#1
0
        public void Generate_Key_Pair()
        {
            var keyPair = CryptUtils.CreatePublicAndPrivateKeyPair();

            "Public Key: {0}\n".Print(keyPair.PublicKey);
            "Private Key: {0}\n".Print(keyPair.PrivateKey);
        }
示例#2
0
        public void CanEncryptWithStringExtension()
        {
            CryptUtils.Length  = RsaKeyLengths.Bit1024;
            CryptUtils.KeyPair = CryptUtils.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);
        }