Example #1
0
        public static TRIPLEDESKeys TRIPLEDESGenerateKeys()
        {
            var objDES = new TripleDESCryptoServiceProvider();
            var Keys   = new TRIPLEDESKeys();

            Keys.iv  = objDES.IV;
            Keys.key = objDES.Key;

            return(Keys);
        }
Example #2
0
        public static void TRIPLEDESKeySerialize(TRIPLEDESKeys nObjectConfig, string nPath)
        {
            var FileXmlSerializer = new XmlSerializer(typeof(TRIPLEDESKeys));
            var FileStreamWriter  = new StreamWriter(nPath);

            try
            {
                FileXmlSerializer.Serialize(FileStreamWriter, nObjectConfig);
            }
            catch (Exception ex)
            {
                throw new Exception("No se pudo ecribir el archivo de configuración, " + ex.Message, ex);
            }
            finally
            {
                FileStreamWriter.Close();
            }
        }
Example #3
0
        public static byte[] TRIPLEDESKeySerialize(TRIPLEDESKeys nObjectConfig)
        {
            var FileXmlSerializer = new XmlSerializer(typeof(TRIPLEDESKeys));
            var FileMemoryStream  = new MemoryStream();

            try
            {
                FileXmlSerializer.Serialize(FileMemoryStream, nObjectConfig);
                return(FileMemoryStream.ToArray());
            }
            catch (Exception ex)
            {
                throw new Exception("No se pudo ecribir el archivo de configuración, " + ex.Message, ex);
            }
            finally
            {
                FileMemoryStream.Close();
            }
        }
Example #4
0
        public static byte[] TRIPLEDESKeySerialize(TRIPLEDESKeys nObjectConfig)
        {
            var FileXmlSerializer = new XmlSerializer(typeof(TRIPLEDESKeys));
            var FileMemoryStream = new MemoryStream();

            try
            {
                FileXmlSerializer.Serialize(FileMemoryStream, nObjectConfig);
                return FileMemoryStream.ToArray();
            }
            catch (Exception ex)
            {
                throw new Exception("No se pudo ecribir el archivo de configuración, " + ex.Message, ex);
            }
            finally
            {
                FileMemoryStream.Close();
            }
        }
Example #5
0
        public static void TRIPLEDESKeySerialize(TRIPLEDESKeys nObjectConfig, string nPath)
        {
            var FileXmlSerializer = new XmlSerializer(typeof(TRIPLEDESKeys));
            var FileStreamWriter = new StreamWriter(nPath);

            try
            {
                FileXmlSerializer.Serialize(FileStreamWriter, nObjectConfig);
            }
            catch (Exception ex)
            {
                throw new Exception("No se pudo ecribir el archivo de configuración, " + ex.Message, ex);
            }
            finally
            {
                FileStreamWriter.Close();
            }
        }
Example #6
0
        public static TRIPLEDESKeys TRIPLEDESGenerateKeys()
        {
            var objDES = new TripleDESCryptoServiceProvider();
            var Keys = new TRIPLEDESKeys();

            Keys.iv = objDES.IV;
            Keys.key = objDES.Key;

            return Keys;
        }
Example #7
0
 public static byte[] TRIPLEDESEncrypt(string Data, string Password, TRIPLEDESKeys Keys)
 {
     return TRIPLEDESEncrypt(Data, Password, Keys.key, Keys.iv);
 }
Example #8
0
 public static string TRIPLEDESDecrypt(byte[] Data, string Password, TRIPLEDESKeys Keys)
 {
     return TRIPLEDESDecrypt(Data, Password, Keys.key, Keys.iv);
 }
Example #9
0
 public static string TRIPLEDESDecrypt(byte[] Data, string Password, TRIPLEDESKeys Keys)
 {
     return(TRIPLEDESDecrypt(Data, Password, Keys.key, Keys.iv));
 }
Example #10
0
 public static byte[] TRIPLEDESEncrypt(string Data, string Password, TRIPLEDESKeys Keys)
 {
     return(TRIPLEDESEncrypt(Data, Password, Keys.key, Keys.iv));
 }