line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Convert::SSH2::Format::Base; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1648
|
use Moo; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Convert::SSH2::Format::Base - Base class for SSH2 formatters |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 PURPOSE |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Subclass this module to implement your own RSA SSH2 key reformatters. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=over |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=item e |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
The public exponent component of an RSA public key. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=back |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has 'e' => ( |
28
|
|
|
|
|
|
|
is => 'ro', |
29
|
|
|
|
|
|
|
required => 1, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=over |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=item n |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
The modulus component of an RSA public key. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=back |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has 'n' => ( |
43
|
|
|
|
|
|
|
is => 'ro', |
44
|
|
|
|
|
|
|
required => 1, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=over |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item line_width |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
How many characters should make a line. Defaults to 64. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=back |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has 'line_width' => ( |
58
|
|
|
|
|
|
|
is => 'ro', |
59
|
|
|
|
|
|
|
default => sub { 64 }, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 METHOD |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=over |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item generate() |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Using C and C, generate a representation in a specific format. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=back |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub generate { |
75
|
0
|
|
|
0
|
1
|
0
|
die "Subclass me."; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=over |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item format_lines() |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Given a string, insert newlines every C characters. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Returns formatted string. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=back |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub format_lines { |
91
|
4
|
|
|
4
|
1
|
11
|
my $self = shift; |
92
|
4
|
|
|
|
|
9
|
my $string = shift; |
93
|
|
|
|
|
|
|
|
94
|
4
|
|
|
|
|
8
|
my $out; |
95
|
4
|
|
|
|
|
9
|
my $len = length($string); |
96
|
4
|
|
|
|
|
22
|
for ( my $pos = 0 ; $pos < $len ; $pos += $self->line_width ) { |
97
|
36
|
|
|
|
|
153
|
$out .= substr($string, $pos, $self->line_width) . "\n"; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
4
|
|
|
|
|
23
|
return $out; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 SEE ALSO |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |