File: cb-testi.pl

package info (click to toggle)
libnet-ssleay-perl 1.94-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,236 kB
  • sloc: ansic: 6,661; perl: 3,924; makefile: 3
file content (24 lines) | stat: -rw-r--r-- 548 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

require Net::SSLeay;

sub provide_password {
#    ($buf,$siz,$rwflag,$pwd)=@_;
    $_[0]="1234";
    return 4;
}

Net::SSLeay::load_error_strings();
Net::SSLeay::SSLeay_add_ssl_algorithms();
Net::SSLeay::randomize();

$ctx=Net::SSLeay::CTX_new();
Net::SSLeay::CTX_set_options($ctx,&Net::SSLeay::OP_ALL);

Net::SSLeay::CTX_set_default_passwd_cb($ctx,\&provide_password);
$r=Net::SSLeay::CTX_use_PrivateKey_file($ctx,"server_key.pem",&Net::SSLeay::FILETYPE_PEM());
if($r==0) {
    print "vr avain\n";
} else {
    print "OK\n";
}