Forum Discussion

ukstin's avatar
ukstin
Icon for Nimbostratus rankNimbostratus
Jan 29, 2009

encrypt/decrypt URI

Hi,

I´m trying to do an Irule to encrypt and decrypt the URI with a cookie value as key. But it´s not working as expected, somebody as any opinion about these irule?

 
 when HTTP_REQUEST { 
    set uri [HTTP::uri] 
    set host [HTTP::host] 
    if { [HTTP::cookie exists "JSESSIONID"] } { 
       if {not ([catch { AES::decrypt [HTTP::cookie value "JSESSIONID"] [b64decode $uri] } decrypted])}{ 
          log local0. "session: $IDkey uri $uri decriptada: $decrypted" 
          HTTP::uri $decrypted 
          set uri $decrypted 
       } 
    } 
 } 
     
 when HTTP_RESPONSE { 
    if { [HTTP::cookie exists "JSESSIONID"] } { 
       set encrypted [b64encode [AES::encrypt [HTTP::cookie value "JSESSIONID"] $uri]] 
       log local0. "session: $IDkey uri: $uri encriptada: $encrypted" 
       HTTP::header replace Location "$encrypted" 
    } 
 }

11 Replies