예제 #1
0
 public EncryptionBE encryptDesEncrypt(int Tipo, string Valor, Int64 App)
 {
     try
     {
         EncryptDecryptSecVB CrypDecrypt  = new EncryptDecryptSecVB();
         EncryptionBE        Encriptacion = new EncryptionBE();
         if (Tipo == 1) ////Encrypta
         {
             Encriptacion.VALORIN  = Valor;
             Encriptacion.VALOROUT = CrypDecrypt.EncryptString(Valor, "");
         }
         else ///Desencrypta
         {
             Encriptacion.VALORIN  = Valor;
             Encriptacion.VALOROUT = CrypDecrypt.DecryptString(Valor, "");
         }
         return(Encriptacion);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
예제 #2
0
        public void checkPermisoMethServ(Int64 App, string sPasswordApp, string sMethodName, string sServiceName)
        {
            try
            {
                SecurityDA          SeguridadDA = new SecurityDA();
                AplicacionBE        PermisosApp = new AplicacionBE();
                EncryptDecryptSecVB CrypDecrypt = new EncryptDecryptSecVB();

                bool Permiso = false;
                PermisosApp = SeguridadDA.checkPermisoXAplicacion(App, sPasswordApp);
                if (CrypDecrypt.DecryptString(PermisosApp.PASSWORD, "") == CrypDecrypt.DecryptString(sPasswordApp, ""))
                {
                    Permiso = true;
                }
                ////Si sale negativo mandamos una excepcion controlada
                if (!Permiso)
                {
                    throw new SeguridadException("La aplicación no tiene acceso al servicio: " + sServiceName);
                }

                Permiso = false;
                List <WCFMetodosBE> MetodosXApp = new List <WCFMetodosBE>();
                MetodosXApp = SeguridadDA.checkMetodoXApp(App, sServiceName, sMethodName);
                if (MetodosXApp.Count == 0)
                {
                    throw new SeguridadException("La aplicación no tiene acceso al método: " + sMethodName);
                }
            }
            catch (SeguridadException exCu)
            {
                throw new SeguridadException(exCu.Message);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }