line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ZMQ::Raw::Curve; |
2
|
|
|
|
|
|
|
$ZMQ::Raw::Curve::VERSION = '0.38'; |
3
|
14
|
|
|
14
|
|
100
|
use strict; |
|
14
|
|
|
|
|
26
|
|
|
14
|
|
|
|
|
390
|
|
4
|
14
|
|
|
14
|
|
77
|
use warnings; |
|
14
|
|
|
|
|
40
|
|
|
14
|
|
|
|
|
306
|
|
5
|
14
|
|
|
14
|
|
64
|
use ZMQ::Raw; |
|
14
|
|
|
|
|
23
|
|
|
14
|
|
|
|
|
498
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
ZMQ::Raw::Curve - ZeroMQ CURVE methods |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
version 0.38 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
ZeroMQ CURVE methods. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use ZMQ::Raw; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# client |
24
|
|
|
|
|
|
|
my ($private, $public) = ZMQ::Raw::Curve->keypair(); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $req = ZMQ::Raw::Socket->new ($ctx, ZMQ::Raw->ZMQ_REQ); |
27
|
|
|
|
|
|
|
$req->setsockopt (ZMQ::Raw::Socket->ZMQ_CURVE_SECRETKEY, $private); |
28
|
|
|
|
|
|
|
$req->setsockopt (ZMQ::Raw::Socket->ZMQ_CURVE_PUBLICKEY, $public); |
29
|
|
|
|
|
|
|
$req->setsockopt (ZMQ::Raw::Socket->ZMQ_CURVE_SERVERKEY, $server_public); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# server |
32
|
|
|
|
|
|
|
my $private = ZMQ::Raw::Curve->keypair(); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $rep = ZMQ::Raw::Socket->new ($ctx, ZMQ::Raw->ZMQ_REP); |
35
|
|
|
|
|
|
|
$rep->setsockopt (ZMQ::Raw::Socket->ZMQ_CURVE_SECRETKEY, $private); |
36
|
|
|
|
|
|
|
$rep->setsockopt (ZMQ::Raw::Socket->ZMQ_CURVE_SERVER, 1); |
37
|
|
|
|
|
|
|
$rep->bind ('tcp://*:5555'); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 METHODS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 keypair( ) |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Create a new, generated random keypair consisting of a private and public key. |
44
|
|
|
|
|
|
|
Returns the private and public key in list context and only the private key |
45
|
|
|
|
|
|
|
in scalar context. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 public( $private ) |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Derive the public key from a private key. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 AUTHOR |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Jacques Germishuys |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Copyright 2017 Jacques Germishuys. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
60
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
61
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; # End of ZMQ::Raw::Curve |