cyberdot49 has asked for the wisdom of the Perl Monks concerning the following question:
As being inexperienced Perl and SSL, I'm attempting to write code for the following scenario: As a 'remote site' I need to connect to "secure port" 2601 on the 'XEP'. The XEP will negotiate a secure SSL/TLS connection the remote connecting site. The remote site will need to accept the XEP's certificate. Then the XEP will prompt for a username and password If the remote site responds with the correct username and password, the connection is allowed. The non ssl works, Any hints appreciated
code segments: use 5.008006; use strict; use warnings; use Carp; use IO::Socket::INET; use IO::Socket::SSL; use Data::Dumper; use POSIX qw(ceil floor); use HTTP::Headers::ActionPack::Authorization::Basic; sub connect { my $self = shift; my $sock; if ( $self->{use_ssl} ) { warn "creating SSL socket to $$self{host}:$$self{port}" if ( $self->{debug} ); # use HTTP::Headers::ActionPack::Authorization::Basic; # create from parameters $sock = HTTP::Headers::ActionPack::Authorization::Basic->new( 'Basic' => { username => 'myuser, password => 'mypassword' } ) } else { $sock = new IO::Socket::INET( PeerAddr => $self->{host}, PeerPort => $self->{port}, Proto => 'tcp' ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Connecting to SSL socket with user/password
by wrog (Friar) on Jun 27, 2013 at 18:24 UTC |