line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::RSA::Yandex; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
25815
|
use 5.008000; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
34
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'Exporter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
237
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw(ya_encrypt); |
9
|
|
|
|
|
|
|
our @EXPORT = ( ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
require XSLoader; |
14
|
|
|
|
|
|
|
XSLoader::load(__PACKAGE__, $VERSION); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub ya_encrypt { |
17
|
4
|
|
|
4
|
1
|
965
|
my ($pub_key,$text) = @_; |
18
|
4
|
|
|
|
|
57
|
my $cc = __PACKAGE__->new; |
19
|
4
|
|
|
|
|
1239
|
$cc->import_public_key($pub_key); |
20
|
1
|
|
|
|
|
9487
|
return $cc->encrypt($text); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Crypt::RSA::Yandex - Perl binding to modified RSA library (yamrsa) for encrypting Yandex auth token |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use Crypt::RSA::Yandex; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $crypter = Crypt::RSA::Yandex->new; |
34
|
|
|
|
|
|
|
$crypter->import_public_key($pubkey); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $encrypted = $crypter->encrypt($text); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# or |
39
|
|
|
|
|
|
|
use Crypt::RSA::Yandex 'ya_encrypt'; |
40
|
|
|
|
|
|
|
my $encrypted = ya_encrypt($pubkey,$text); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 DESCRIPTION |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 FUNCTIONAL INTERFACE |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
None by default. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=over 4 |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item $encrypted_text = ya_encrypt($key, $text) |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=back |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 OOP INTERFACE |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=over 4 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item $crypter = Crypt::RSA::Yandex->new() |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item $self->import_public_key($key) |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item $encrypted_text = $self->encrypt($text) |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=back |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 SEE ALSO |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
http://api.yandex.ru/fotki/doc/overview/authorization-token.xml |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 AUTHOR |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Vladimir Timofeev, Evovkasm@gmail.comE |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Mons Anderson, Emons@cpan.orgE |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Copyright (c) 2010 by Rambler |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |