Exemple #1
0
        public static byte[] StringToKey(string key)
        {
            string trimmed = key.Trim();
            string padded  = trimmed.Length < 16 ? AESEncryptorParams.Pad(trimmed) : trimmed;

            return(System.Text.Encoding.UTF8.GetBytes(padded));
        }
Exemple #2
0
        public static RijndaelManaged GetRijndaelManaged(string json)
        {
            AESEncryptorParams parameters = AESEncryptorParams.createFromJSON(json);

            return(GetRijndaelManaged(parameters.Key, parameters.InitVector));
        }