|
|
|
|
|
|
| |
Sac#16510 |
| Tipo Tip |
Fecha ingreso 27/07/2004 | |
|
|
Como encriptar los parámetros sin que lo haga GeneXus
|
|
|
|
| Abstract: |
Puede ser necesario, en algún caso excepcional, encriptar los parámetros de una URL en forma manual.
|
| Descripción Detallada |
En caso de que sea necesario encriptar los parámetros de una URL en forma manual, porque la URL no la arma GeneXus, sino por programación, hacer lo siguiente: El ejemplo aplica a .Net y Encrypt URL parameters = Site Key CSHARP [!&tempkey!] = Crypto.GetSiteKey( ); &toEnc = '1,Hola' CSHARP [!&chkSum!] = Crypto.CheckSum( [!&toEnc!], 6); &p = encrypt64(&toEnc+&chkSum,&tempkey) &url = 'http://localhost/services/hwbp01.aspx' textblock3.Link = &url+"?"+&p Para el caso de session key, seria: CSHARP [!&gxcookieaux!] = context.SetCookie( "GX_SESSION_ID", Crypto.Encrypt64( Crypto.GetEncryptionKey( ), Crypto.GetServerKey( )), "", (DateTime)(DateTime.MinValue), "", 0) ; CSHARP [!&tempkey!] = Crypto.Decrypt64( context.GetCookie( "GX_SESSION_ID"), Crypto.GetServerKey( )) ; De esa forma se arma la URL con los parámetros encriptados. Los parámetros encriptados que reciben los webpanels se arman concatenando el literal y el checksum de este (6 es el largo del checksum). En el objeto invocado, no es necesario programar nada, ya que tiene configurada la preference Encrypt URL parameters. *************** Cómo hacerlo en Java: Server Key: JAVA [!&tempkey!] = context.getSiteKey( ); JAVA [!&chkSum!] = com.genexus.util.Encryption.checksum( [!&toEnc!], 6); &p = com.genexus.util.Encryption.encrypt64(&toEnc+&chkSum,&tempkey); Session Key: JAVA [!&gxcookieaux!] = httpContext.setCookie( "GX_SESSION_ID", com.genexus.util.Encryption.encrypt64( com.genexus.util.Encryption.getNewKey( ), context.getServerKey( )), "", GXutil.nullDate(), "", (short)(0)) ; JAVA [!&tempkey!] = com.genexus.util.Encryption.decrypt64( httpContext.getCookie( "GX_SESSION_ID"), context.getServerKey( )) ;
|
| |
| | |
|
| Producto |
Reportado en Versión |
Estimada Corr. en Ver. |
Corregido en Versión | |
|
|
| | |