POD fixes, spelling
Karel Miko
6 years ago
31 | 31 | spec_rounds=>0, spec_key=>'XXX-DETERMINED-BY-KEYSIZE' }, # 12 (<=80bits), 16 (>80bits) |
32 | 32 | DES => { info=>'Symmetric cipher DES, key size: 64[56] bits (Crypt::CBC compliant)', urls=>['https://en.wikipedia.org/wiki/Data_Encryption_Standard'], |
33 | 33 | spec_rounds=>0, spec_key=>'XXX-ROUNDS-FIXED' }, |
34 | DES_EDE => { info=>'Symmetric cipher DES_EDE (aka Tripple-DES, 3DES), key size: 192[168] bits (Crypt::CBC compliant)', urls=>['https://en.wikipedia.org/wiki/Triple_DES'], | |
34 | DES_EDE => { info=>'Symmetric cipher DES_EDE (aka Triple-DES, 3DES), key size: 192[168] bits (Crypt::CBC compliant)', urls=>['https://en.wikipedia.org/wiki/Triple_DES'], | |
35 | 35 | spec_rounds=>0, spec_key=>'XXX-ROUNDS-FIXED' }, |
36 | 36 | KASUMI => { info=>'Symmetric cipher KASUMI, key size: 128 bits (Crypt::CBC compliant)', urls=>['https://en.wikipedia.org/wiki/KASUMI_(block_cipher)'], |
37 | 37 | spec_rounds=>0, spec_key=>'XXX-ROUNDS-FIXED' }, |
95 | 95 | |
96 | 96 | =head1 DESCRIPTION |
97 | 97 | |
98 | CCM is a encrypt+authenticate mode that is centered around using AES (or any 16-byte cipher) as aprimitive. | |
98 | CCM is a encrypt+authenticate mode that is centered around using AES (or any 16-byte cipher) as a primitive. | |
99 | 99 | Unlike EAX and OCB mode, it is only meant for packet mode where the length of the input is known in advance. |
100 | 100 | |
101 | 101 | =head1 EXPORT |
173 | 173 | =item * L<https://en.wikipedia.org/wiki/CCM_mode|https://en.wikipedia.org/wiki/CCM_mode> |
174 | 174 | |
175 | 175 | =back |
176 | ||
177 | =cut |
182 | 182 | =item * L<https://en.wikipedia.org/wiki/EAX_mode|https://en.wikipedia.org/wiki/EAX_mode> |
183 | 183 | |
184 | 184 | =back |
185 | ||
186 | =cut |
183 | 183 | =item * L<https://en.wikipedia.org/wiki/Galois/Counter_Mode> |
184 | 184 | |
185 | 185 | =back |
186 | ||
187 | =cut |
184 | 184 | |
185 | 185 | =item * L<https://tools.ietf.org/html/rfc7253> |
186 | 186 | |
187 | =back⏎ | |
187 | =back | |
188 | ||
189 | =cut |
7 | 7 | |
8 | 8 | 1; |
9 | 9 | |
10 | __END__ | |
10 | =pod | |
11 | 11 | |
12 | 12 | =head1 NAME |
13 | 13 | |
14 | 14 | Crypt::AuthEnc - [internal only] |
15 | 15 | |
16 | =cut⏎ | |
16 | =cut |
105 | 105 | |
106 | 106 | =head2 adler32_data_int |
107 | 107 | |
108 | Returns checksum as unsingned 32bit integer. | |
108 | Returns checksum as unsigned 32bit integer. | |
109 | 109 | |
110 | 110 | $checksum_hex = adler32_data_int('data string'); |
111 | 111 | #or |
129 | 129 | |
130 | 130 | =head2 adler32_file_int |
131 | 131 | |
132 | Returns checksum as unsingned 32bit integer. | |
132 | Returns checksum as unsigned 32bit integer. | |
133 | 133 | |
134 | $checksum_hex = adler32_file_int('data string'); | |
134 | $checksum_hex = adler32_file_int('filename.dat'); | |
135 | 135 | #or |
136 | $checksum_hex = adler32_file_int('any data', 'more data', 'even more data'); | |
136 | $checksum_hex = adler32_file_int(*FILEHANDLE); | |
137 | 137 | |
138 | 138 | =head2 crc32_data |
139 | 139 | |
153 | 153 | |
154 | 154 | =head2 crc32_data_int |
155 | 155 | |
156 | Returns checksum as unsingned 32bit integer. | |
156 | Returns checksum as unsigned 32bit integer. | |
157 | 157 | |
158 | 158 | $checksum_hex = crc32_data_int('data string'); |
159 | 159 | #or |
177 | 177 | |
178 | 178 | =head2 crc32_file_int |
179 | 179 | |
180 | Returns checksum as unsingned 32bit integer. | |
180 | Returns checksum as unsigned 32bit integer. | |
181 | 181 | |
182 | $checksum_hex = crc32_file_int('data string'); | |
182 | $checksum_hex = crc32_file_int('filename.dat'); | |
183 | 183 | #or |
184 | $checksum_hex = crc32_file_int('any data', 'more data', 'even more data'); | |
184 | $checksum_hex = crc32_file_int(*FILEHANDLE); | |
185 | 185 | |
186 | 186 | =head1 SEE ALSO |
187 | 187 | |
195 | 195 | |
196 | 196 | =back |
197 | 197 | |
198 | =cut⏎ | |
198 | =cut |
20 | 20 | |
21 | 21 | =head1 NAME |
22 | 22 | |
23 | Crypt::Cipher::DES_EDE - Symmetric cipher DES_EDE (aka Tripple-DES, 3DES), key size: 192[168] bits (Crypt::CBC compliant) | |
23 | Crypt::Cipher::DES_EDE - Symmetric cipher DES_EDE (aka Triple-DES, 3DES), key size: 192[168] bits (Crypt::CBC compliant) | |
24 | 24 | |
25 | 25 | =head1 SYNOPSIS |
26 | 26 | |
116 | 116 | =back |
117 | 117 | |
118 | 118 | =cut |
119 | ||
120 | __END__ |
69 | 69 | |
70 | 70 | =head1 NAME |
71 | 71 | |
72 | Crypt::KeyDerivation - PBKDF1, PBKFD2 and HKDF key derivation functions | |
72 | Crypt::KeyDerivation - PBKDF1, PBKDF2 and HKDF key derivation functions | |
73 | 73 | |
74 | 74 | =head1 SYNOPSIS |
75 | 75 | |
88 | 88 | |
89 | 89 | =over |
90 | 90 | |
91 | =item * PBKFD1 and PBKDF according to PKCS#5 v2.0 L<https://tools.ietf.org/html/rfc2898|https://tools.ietf.org/html/rfc2898> | |
91 | =item * PBKDF1 and PBKDF according to PKCS#5 v2.0 L<https://tools.ietf.org/html/rfc2898|https://tools.ietf.org/html/rfc2898> | |
92 | 92 | |
93 | 93 | =item * HKDF (+ related) according to L<https://tools.ietf.org/html/rfc5869|https://tools.ietf.org/html/rfc5869> |
94 | 94 | |
171 | 171 | # $hash_name .. optional, DEFAULT: 'SHA256' |
172 | 172 | # $len ........ optional, derived key len, DEFAULT: 32 |
173 | 173 | # $info ....... optional context and application specific information, DEFAULT: '' |
174 | ||
175 | =cut |
49 | 49 | |
50 | 50 | 1; |
51 | 51 | |
52 | __END__ | |
52 | =pod | |
53 | 53 | |
54 | 54 | =head1 NAME |
55 | 55 | |
56 | 56 | Crypt::Mac - [internal only] |
57 | 57 | |
58 | =cut⏎ | |
58 | =cut |
114 | 114 | =item * L<https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher-block_chaining_.28CBC.29> |
115 | 115 | |
116 | 116 | =back |
117 | ||
118 | =cut |
91 | 91 | =item * L<https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_feedback_.28CFB.29> |
92 | 92 | |
93 | 93 | =back |
94 | ||
95 | =cut |
98 | 98 | =item * L<https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Counter_.28CTR.29> |
99 | 99 | |
100 | 100 | =back |
101 | ||
102 | =cut |
115 | 115 | =item * L<https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_codebook_.28ECB.29> |
116 | 116 | |
117 | 117 | =back |
118 | ||
119 | =cut |
91 | 91 | =item * L<https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Output_feedback_.28OFB.29> |
92 | 92 | |
93 | 93 | =back |
94 | ||
95 | =cut |
62 | 62 | |
63 | 63 | 1; |
64 | 64 | |
65 | __END__ | |
65 | =pod | |
66 | 66 | |
67 | 67 | =head1 NAME |
68 | 68 | |
69 | 69 | Crypt::Mode - [internal only] |
70 | 70 | |
71 | =cut⏎ | |
71 | =cut |
327 | 327 | random data taken from C</dev/random> (UNIX) or C<CryptGenRandom> (Win32). |
328 | 328 | |
329 | 329 | $pk->generate_key($groupsize); |
330 | ### $groupsize (in bytes) corresponds to DH params (p, g) predefined by libtomcrypt | |
330 | ### $groupsize (in bytes) corresponds to DH parameters (p, g) predefined by libtomcrypt | |
331 | 331 | # 96 => DH-768 |
332 | 332 | # 128 => DH-1024 |
333 | 333 | # 192 => DH-1536 |
355 | 355 | # where $g is the generator (base) in a hex string and $p is the prime in a hex string |
356 | 356 | |
357 | 357 | $pk->generate_key(\$dh_param) |
358 | # $dh_param is the content of DER or PEM file with DH params | |
358 | # $dh_param is the content of DER or PEM file with DH parameters | |
359 | 359 | # e.g. openssl dhparam 2048 |
360 | 360 | |
361 | 361 | =head2 import_key |
378 | 378 | |
379 | 379 | =head2 export_key |
380 | 380 | |
381 | B<BEWARE:> DH key format change - since v0.049 it is compatible with libtocrypt 1.18. | |
381 | B<BEWARE:> DH key format change - since v0.049 it is compatible with libtomcrypt 1.18. | |
382 | 382 | |
383 | 383 | my $private = $pk->export_key('private'); |
384 | 384 | #or |
479 | 479 | =item * L<https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange|https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange> |
480 | 480 | |
481 | 481 | =back |
482 | ||
483 | =cut |
642 | 642 | =item * L<https://en.wikipedia.org/wiki/Digital_Signature_Algorithm|https://en.wikipedia.org/wiki/Digital_Signature_Algorithm> |
643 | 643 | |
644 | 644 | =back |
645 | ||
646 | =cut |
773 | 773 | #or |
774 | 774 | $pk->generate_key($hashref_with_curve_params); |
775 | 775 | |
776 | The following pre-defined C<$curve_name> values are supported: | |
776 | The following predefined C<$curve_name> values are supported: | |
777 | 777 | |
778 | 778 | # curves from http://www.ecc-brainpool.org/download/Domain-parameters.pdf |
779 | 779 | 'brainpoolp160r1' |
1394 | 1394 | =item * L<https://en.wikipedia.org/wiki/ECDSA|https://en.wikipedia.org/wiki/ECDSA> |
1395 | 1395 | |
1396 | 1396 | =back |
1397 | ||
1398 | =cut |
960 | 960 | =item * L<https://en.wikipedia.org/wiki/RSA_%28algorithm%29|https://en.wikipedia.org/wiki/RSA_%28algorithm%29> |
961 | 961 | |
962 | 962 | =back |
963 | ||
964 | =cut |
23 | 23 | |
24 | 24 | 1; |
25 | 25 | |
26 | __END__ | |
26 | =pod | |
27 | 27 | |
28 | 28 | =head1 NAME |
29 | 29 | |
30 | 30 | Crypt::PK - [internal only] |
31 | 31 | |
32 | =cut⏎ | |
32 | =cut |
157 | 157 | =item * L<https://en.wikipedia.org/wiki/Fortuna_%28PRNG%29|https://en.wikipedia.org/wiki/Fortuna_%28PRNG%29> |
158 | 158 | |
159 | 159 | =back |
160 | ||
161 | =cut |
156 | 156 | =item * L<https://en.wikipedia.org/wiki/RC4_cipher|https://en.wikipedia.org/wiki/RC4_cipher> |
157 | 157 | |
158 | 158 | =back |
159 | ||
160 | =cut |
156 | 156 | =item * L<https://en.wikipedia.org/wiki/SOBER-128|https://en.wikipedia.org/wiki/SOBER-128> |
157 | 157 | |
158 | 158 | =back |
159 | ||
160 | =cut |
155 | 155 | =item * L<https://en.wikipedia.org/wiki/Yarrow_algorithm|https://en.wikipedia.org/wiki/Yarrow_algorithm> |
156 | 156 | |
157 | 157 | =back |
158 | ||
159 | =cut |
192 | 192 | #or |
193 | 193 | $n = rand($limit); |
194 | 194 | |
195 | Returns a random floating point number from range C<[0,1)> (if called without param) or C<[0,$limit)>. | |
195 | Returns a random floating point number from range C<[0,1)> (if called without parameter) or C<[0,$limit)>. | |
196 | 196 | |
197 | 197 | =head2 irand |
198 | 198 | |
199 | 199 | $i = irand; |
200 | 200 | |
201 | Returns a random unsigned 32bit integer - range 0 .. 0xFFFFFFFF. | |
201 | Returns a random unsigned 32bit integer - range C<0 .. 0xFFFFFFFF>. | |
202 | 202 | |
203 | 203 | =head1 METHODS |
204 | 204 | |
279 | 279 | |
280 | 280 | =head1 SEE ALSO |
281 | 281 | |
282 | L<Crypt::PRNG::Fortuna>, L<Crypt::PRNG::RC4>, L<Crypt::PRNG::Sober128>, L<Crypt::PRNG::Yarrow>⏎ | |
282 | L<Crypt::PRNG::Fortuna>, L<Crypt::PRNG::RC4>, L<Crypt::PRNG::Sober128>, L<Crypt::PRNG::Yarrow> | |
283 | ||
284 | =cut |
55 | 55 | } |
56 | 56 | |
57 | 57 | 1; |
58 | __END__ | |
58 | ||
59 | =pod | |
59 | 60 | |
60 | 61 | =head1 NAME |
61 | 62 | |
114 | 115 | |
115 | 116 | L<Crypt::PRNG>, L<Crypt::PRNG::Fortuna>, L<Crypt::PRNG::Yarrow>, L<Crypt::PRNG::RC4>, L<Crypt::PRNG::Sober128>, L<Crypt::PRNG::ChaCha20> |
116 | 117 | |
117 | =item * Key derivation functions - PBKDF1, PBKFD2 and HKDF | |
118 | =item * Key derivation functions - PBKDF1, PBKDF2 and HKDF | |
118 | 119 | |
119 | 120 | L<Crypt::KeyDerivation> |
120 | 121 | |
130 | 131 | |
131 | 132 | =head1 COPYRIGHT |
132 | 133 | |
133 | Copyright (c) 2013+ DCIT, a.s. L<http://www.dcit.cz> / Karel Miko⏎ | |
134 | Copyright (c) 2013+ DCIT, a.s. L<http://www.dcit.cz> / Karel Miko | |
135 | ||
136 | =cut |
5 | 5 | plan skip_all => "File::Find not installed" unless eval { require File::Find }; |
6 | 6 | plan tests => 1; |
7 | 7 | |
8 | ||
9 | sub _read { | |
10 | open my $fh, "<", shift; | |
11 | binmode $fh; | |
12 | return do { local $/; <$fh> }; | |
13 | } | |
14 | ||
8 | 15 | my @files; |
9 | 16 | File::Find::find({ wanted=>sub { push @files, $_ if /\.pm$/ }, no_chdir=>1 }, 'lib'); |
10 | 17 | |
18 | my @err; | |
11 | 19 | for my $m (sort @files) { |
20 | my $content = _read($m); | |
21 | push @err, "ERROR: no newline at the end '$m'" unless $content =~ /\n$/s; | |
22 | push @err, "ERROR: avoid __END__ '$m'" if $content =~ /__END__/s; | |
23 | push @err, "ERROR: =pod ... =cut '$m'" unless $content =~ /=pod\n.*?=cut\n$/s; | |
24 | push @err, "ERROR: trailing whitespace '$m'" if $content =~ / \n/s; | |
25 | push @err, "ERROR: avoid tabs '$m'" if $content =~ /\t/s; | |
26 | push @err, "ERROR: avoid CRLF '$m'" if $content =~ /\r/s; | |
12 | 27 | $m =~ s|[\\/]|::|g; |
13 | 28 | $m =~ s|^lib::||; |
14 | 29 | $m =~ s|\.pm$||; |
15 | eval "use $m; 1;" or die "ERROR: 'use $m' failed"; | |
30 | eval "use $m; 1;" or push @err, "ERROR: 'use $m' failed"; | |
16 | 31 | } |
17 | 32 | |
33 | warn "$_\n" for (@err); | |
34 | die if @err; | |
35 | ||
18 | 36 | ok 1, 'all done'; |
0 | use strict; | |
1 | use warnings; | |
2 | ||
3 | use Test::More; | |
4 | ||
5 | plan skip_all => "File::Find not installed" unless eval { require File::Find }; | |
6 | plan skip_all => "Test::Pod::Spelling or Text::Aspell not installed" unless eval { require Test::Pod::Spelling; require Text::Aspell; }; | |
7 | ||
8 | Test::Pod::Spelling->import( | |
9 | spelling => { | |
10 | allow_words => [qw( | |
11 | AES BLAKEb BLAKEs CPAN CRC ChaCha CryptX DCIT DER Diffie EAX ECCDH ECDH ECDSA Flickr HKDF JSON JWA JWK | |
12 | Karel Miko OCB OCBv OID OMAC OO OpenSSL PBKDF PEM PKCS RIPEMD Rijndael SHA UUID RFC | |
13 | decrypt decrypts interoperability cryptographically cryptographic octects | |
14 | libtomcrypt libtommath | |
15 | params paramshash irand perl endian zbase bumac bmac budigest bdigest md de | |
16 | blakes_ blakeb_ | |
17 | XOR'ing XOR'ed | |
18 | )] | |
19 | }, | |
20 | ); | |
21 | ||
22 | plan tests => 102; | |
23 | ||
24 | my @files; | |
25 | File::Find::find({ wanted=>sub { push @files, $_ if /\.pm$/ }, no_chdir=>1 }, 'lib'); | |
26 | ||
27 | for my $m (sort @files) { | |
28 | Test::Pod::Spelling::pod_file_spelling_ok( $m, "Spelling in '$m'" ); | |
29 | } |