[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] PerlNET - ActiveState Perl in Microsoft .NET



Title: [rt.omnihotels.com #6423] [Comment] Micros : Phoenix : Help Matt debug cookies
Wow. Here's the first time I've seen PerlNET in the wild...
 
This is one of our vendors using CPAN's Crypt::Tea inside ASP.NET via PerlNET since they can't find a compatible TEA (Tiny Encryption Algorithm) implementation in Widowsland. (Until now. -grin-)
 
j
 
 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title></title>
        <style>
        body { font-family:verdana; font-size:11px; line-height:1.5em; }
        </style>
</head>

<body>



<%@ Page Language="perl" debug="true"%>
<script runat="server">
use namespace "System";
use namespace "System.Collections";
use namespace "System.ComponentModel";
use namespace "System.Data";
use namespace "System.Drawing";
use namespace "System.Web";
use namespace "System.Web.SessionState";
use namespace "System.Web.UI";
use namespace "System.Web.UI.WebControls";
use namespace "System.Web.UI.HtmlControls";
use PerlNET qw(enum AUTOCALL);
 use Crypt::Tea;

=for interface
    protected override void OnLoad(System.EventArgs e);
     str DecryptCookie(str myCookieVal);
=cut

sub DecryptCookie
{
        my ($myCookieVal) = @_;
        my $key = "*hjkqhwuihqdiuhqidqhdqkN ^)-";
        my $decrypted_cookieval = decrypt ($myCookieVal, $key);
        return $decrypted_cookieval;
}



    sub OnLoad {
                my($this, $e) = @_;            
                my $myCookie =  $this->{Request}->Cookies;
                my $cookieCount = $myCookie->{Count};          
               
                for ($start=0; $start<$cookieCount; $start++)
                {                              
                        my $myCookieName           = $myCookie->Get(int($start))->{Name};                                              
                        my $myCookieVal        = "";
                       
                        if($myCookieName eq 'common')
                        {
                                $myCookieVal = $myCookie->Get($myCookieName)->{Value};                                                                 
                        }
                        elsif ($myCookieName eq 'login_fg')
                        {
                                $myCookieVal = $myCookie->Get($myCookieName)->{Value}; 
                                $decrypt_cookieval = DecryptCookie($myCookieVal);      
                                $this->{Response}->Write("<br/><br/><strong>Encrypted login_fg
cookie:</strong> ");
                                $this->{Response}->Write($myCookieVal);
                                $this->{Response}->Write("<br/><br/><strong>Decrypted login_fg
cookie:</strong> ");
                                $this->{Response}->Write($decrypt_cookieval);  
                        }
                        elsif ($myCookieName eq 'Phoenix_state')
                        {                                              
                                $myCookieVal       = $myCookie->Get($myCookieName)->{Value};
                                $decrypt_cookieval = DecryptCookie($myCookieVal);      
                                $this->{Response}->Write("<br/><br/><strong>Encrypted " .
$myCookieName . " cookie:</strong> ");
                                $this->{Response}->Write($myCookieVal);
                                $this->{Response}->Write("<br/><br/><strong>Decrypted " .
$myCookieName . " cookie:</strong> ");
                                $this->{Response}->Write($decrypt_cookieval);                                          
                        }
                        elsif (index($myCookieName,'Phoenix_state_room') == 0)
                        {
                                $myCookieVal               = $myCookie->Get($myCookieName)->{Value};   
                                $decrypt_cookieval = DecryptCookie($myCookieVal);      
                                $this->{Response}->Write("<br/><br/><strong><strong>Encrypted " .
$myCookieName . " cookie:</strong> ");
                                $this->{Response}->Write($myCookieVal);
                                $this->{Response}->Write("<br/><br/><strong><strong>Decrypted " .
$myCookieName . " cookie:</strong> ");
                                $this->{Response}->Write($decrypt_cookieval);                                                                                  
                        }
                               
                               
                }
                               
                       
                                  
       
    }


    # This is an autohookup method

=for interface
    void Page_PreRender();
=cut

    sub Page_PreRender {
        my $this = shift;
         
    }

</script>
</body>

</html>