Esempio n. 1
0
        public static string EncryptMySecret()
        {
            //this is your 64-bit key string
            string myKeyString = AESEncryptor.CreateNewKey();

            using (var manager = new EncryptionManager(myKeyString))
            {
                //This is your initializor, or public key
                string iv = AESEncryptor.CreateInitializor();

                //This is how you encrypt with your specified key and iv
                encryptedSecretInfo = manager.Encrypt(secretInfo, iv);
            }


            //you can also encrypt with private keys of int a, b and c
            using (var manager = new EncryptionManager(100, 50, 10))
            {
                //This is your initializor, or public key
                string iv = manager.CreateInitializor();

                //This is your second public key, used with a, b, and c to compute the private key
                long ticks = DateTime.Now.Ticks;

                //This is how you encrypt with your specified key and iv
                encryptedSecretInfo = manager.Encrypt(secretInfo, iv, ticks);
            }

            return(encryptedSecretInfo);
        }