コード例 #1
0
        /// <summary>
        /// Busca un criptographer determinado por medio de su nombre de archivo de encriptacion y tipo de algoritmo simetrico
        /// </summary>
        /// <typeparam name="T">Tipo de algoritmo simetrico</typeparam>
        /// <param name="keyFileName">nombre de archivo de encriptacion </param>
        /// <returns>Argoritmo <see cref="SymetriCypher"/></returns>
        public static SymetriCypher <T> Get <T>(string keyFileName) where T : SymmetricAlgorithm
        {
            if (string.IsNullOrEmpty(keyFileName))
            {
                TechnicalException te = new TechnicalException("La clave de encriptacion no puede ser nula");
                ExceptionHelper.SetTechnicalException <SymetriCypher <T> >(te);
                te.ErrorId = "4401";
                throw te;
            }

            SymetriCypher <T> symetriCypher = null;

            if (list.ContainsKey(string.Concat(keyFileName, typeof(T).FullName)))
            {
                symetriCypher = (SymetriCypher <T>)list[string.Concat(keyFileName, typeof(T).FullName)];
            }
            else
            {
                symetriCypher             = new SymetriCypher <T>();
                symetriCypher.KeyFileName = keyFileName;
                list.Add(string.Concat(keyFileName, typeof(T).FullName), symetriCypher);
            }

            return(symetriCypher);
        }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 static SymetricCrypter_Rijndael()
 {
     cryptopher = new SymetriCypher <RijndaelManaged>();
 }