Skip to content

Commit

Permalink
SSL client certificate test script
Browse files Browse the repository at this point in the history
  • Loading branch information
savs committed Feb 11, 2012
1 parent 2368e41 commit f45d2a2
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Scripts/ssl_test.pl
@@ -0,0 +1,29 @@
#!/usr/bin/perl -w
#
# Check to see if a resource is programmatically available when a client-side SSL certificate is required.
use LWP::UserAgent;
use Data::Dumper qw(Dumper);

my $user = 'YOUR_USER_EMAIL';
my $pass = 'YOUR_USER_PASS';
my $url = 'https://YOUR_RESOURCE/';

$ENV{HTTPS_PKCS12_FILE} = '/path/to/YOUR_CERTIFICATE.p12';
$ENV{HTTPS_PKCS12_PASSWORD} = 'YOUR_CERTIFICATE_PASS';

my $ua = LWP::UserAgent->new;
#$ua->credentials("YOUR_RESOURCE:443",$user, $pass);
#my $res = $ua->get('https://YOUR_RESOURCE/');
my $req = HTTP::Request->new(GET => $url);
$req->authorization_basic($user,$pass);
my $res = $ua->request($req);

if ($res->is_success) {
print $res->decoded_content;
} else {
die $res->status_line;
}
#print $res->content, "\n";
#print Dumper($res);

__END__

0 comments on commit f45d2a2

Please sign in to comment.