source: TI12-security/trunk/perl/storable.py @ 3780

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/perl/storable.py@5065
Revision 3780, 790 bytes checked in by pjkersha, 12 years ago (diff)

Working version of NDG Security Perl client - acts as a client to Single
Sign On and Gatekeeper.

  • Property svn:executable set to *
Line 
1#!/usr/bin/env perl
2use strict;
3
4use Storable qw(freeze thaw);
5
6my @roles = ('coapec', 'badcuser');
7my %session = (
8        h => 'https://localhost/SessionManager',
9        sid => 'abcdef1234567890',
10        u => 'pjkersha',
11        org => 'BADC',
12        roles => \@roles,
13);
14
15my $serialisedSess = freeze(\%session);
16
17use Crypt::CBC;
18my $encryptionKey = 'abcdef0123456789';
19my $cipher = new Crypt::CBC(-key=>$encryptionKey, -cipher=>'Blowfish', -salt=>1);
20
21my $encrSerialisedSess = $cipher->encrypt_hex($serialisedSess);
22print "encrSerialisedSess = ".$encrSerialisedSess."\n";
23my $decrSerialisedSess = $cipher->decrypt_hex($encrSerialisedSess);
24my $deserialisedSess = thaw($decrSerialisedSess);
25foreach my $key (keys %{$deserialisedSess})
26{
27    print "$key=$deserialisedSess->{$key}\n";
28}
Note: See TracBrowser for help on using the repository browser.