Codebase list libcryptx-perl / a1573ee
Import upstream version 0.072 Debian Janitor 2 years ago
126 changed file(s) with 270 addition(s) and 171 deletion(s). Raw diff Collapse all Expand all
00 Changes for CryptX
1
2 0.072 2021-04-29
3 - fix #69 Identifier Octet's Leniency in RSA PKCS#1 Signature Verification
4 - bundled libtomcrypt update branch:develop (commit:165c795b 2021-04-14)
5
6 0.071 2021-03-30
7 - fix #67 (better handling of PEM decoding failures)
18
29 0.070 2021-02-12
310 - fix #66 remove -flto=auto (Makefile.PL)
33 "Karel Miko"
44 ],
55 "dynamic_config" : 1,
6 "generated_by" : "ExtUtils::MakeMaker version 7.58, CPAN::Meta::Converter version 2.150010",
6 "generated_by" : "ExtUtils::MakeMaker version 7.60, CPAN::Meta::Converter version 2.150010",
77 "license" : [
88 "perl_5"
99 ],
4949 "url" : "https://github.com/DCIT/perl-CryptX"
5050 }
5151 },
52 "version" : "0.070",
53 "x_serialization_backend" : "JSON::PP version 4.05"
52 "version" : "0.072",
53 "x_serialization_backend" : "JSON::PP version 4.06"
5454 }
77 configure_requires:
88 ExtUtils::MakeMaker: '0'
99 dynamic_config: 1
10 generated_by: 'ExtUtils::MakeMaker version 7.58, CPAN::Meta::Converter version 2.150010'
10 generated_by: 'ExtUtils::MakeMaker version 7.60, CPAN::Meta::Converter version 2.150010'
1111 license: perl
1212 meta-spec:
1313 url: http://module-build.sourceforge.net/META-spec-v1.4.html
2222 resources:
2323 bugtracker: https://github.com/DCIT/perl-CryptX/issues
2424 repository: https://github.com/DCIT/perl-CryptX
25 version: '0.070'
25 version: '0.072'
2626 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
7373 PREREQ_PM => { },
7474 TEST_REQUIRES => { 'Test::More' => 0 },
7575 META_MERGE => { resources => { repository => 'https://github.com/DCIT/perl-CryptX', bugtracker => 'https://github.com/DCIT/perl-CryptX/issues' } },
76 dist => { PREOP => 'perldoc -u lib/CryptX.pm | pod2markdown > README.md', TAR => 'ptar', TARFLAGS => '-c -C -f' },
76 dist => { PREOP => 'perldoc -u lib/CryptX.pm | pod2markdown > README.md', TARFLAGS => '--owner=0 --group=0 -cvf' },
7777 @EUMM_INC_LIB
7878 );
7979
6767
6868 # COPYRIGHT
6969
70 Copyright (c) 2013-2020 DCIT, a.s. [https://www.dcit.cz](https://www.dcit.cz) / Karel Miko
70 Copyright (c) 2013-2021 DCIT, a.s. [https://www.dcit.cz](https://www.dcit.cz) / Karel Miko
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw( ccm_encrypt_authenticate ccm_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw( chacha20poly1305_encrypt_authenticate chacha20poly1305_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw( eax_encrypt_authenticate eax_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw( gcm_encrypt_authenticate gcm_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw( ocb_encrypt_authenticate ocb_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 ### not used
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use base qw(Crypt::Checksum Exporter);
77 our %EXPORT_TAGS = ( all => [qw( adler32_data adler32_data_hex adler32_data_int adler32_file adler32_file_hex adler32_file_int )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use base qw(Crypt::Checksum Exporter);
77 our %EXPORT_TAGS = ( all => [qw( crc32_data crc32_data_hex crc32_data_int crc32_file crc32_file_hex crc32_file_int )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw/ adler32_data adler32_data_hex adler32_data_int adler32_file adler32_file_hex adler32_file_int
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Cipher);
99
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use Carp;
77 $Carp::Internal{(__PACKAGE__)}++;
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b_160 blake2b_160_hex blake2b_160_b64 blake2b_160_b64u blake2b_160_file blake2b_160_file_hex blake2b_160_file_b64 blake2b_160_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b_256 blake2b_256_hex blake2b_256_b64 blake2b_256_b64u blake2b_256_file blake2b_256_file_hex blake2b_256_file_b64 blake2b_256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b_384 blake2b_384_hex blake2b_384_b64 blake2b_384_b64u blake2b_384_file blake2b_384_file_hex blake2b_384_file_b64 blake2b_384_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b_512 blake2b_512_hex blake2b_512_b64 blake2b_512_b64u blake2b_512_file blake2b_512_file_hex blake2b_512_file_b64 blake2b_512_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s_128 blake2s_128_hex blake2s_128_b64 blake2s_128_b64u blake2s_128_file blake2s_128_file_hex blake2s_128_file_b64 blake2s_128_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s_160 blake2s_160_hex blake2s_160_b64 blake2s_160_b64u blake2s_160_file blake2s_160_file_hex blake2s_160_file_b64 blake2s_160_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s_224 blake2s_224_hex blake2s_224_b64 blake2s_224_b64u blake2s_224_file blake2s_224_file_hex blake2s_224_file_b64 blake2s_224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s_256 blake2s_256_hex blake2s_256_b64 blake2s_256_b64u blake2s_256_file blake2s_256_file_hex blake2s_256_file_b64 blake2s_256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( chaes chaes_hex chaes_b64 chaes_b64u chaes_file chaes_file_hex chaes_file_b64 chaes_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( keccak224 keccak224_hex keccak224_b64 keccak224_b64u keccak224_file keccak224_file_hex keccak224_file_b64 keccak224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( keccak256 keccak256_hex keccak256_b64 keccak256_b64u keccak256_file keccak256_file_hex keccak256_file_b64 keccak256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( keccak384 keccak384_hex keccak384_b64 keccak384_b64u keccak384_file keccak384_file_hex keccak384_file_b64 keccak384_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( keccak512 keccak512_hex keccak512_b64 keccak512_b64u keccak512_file keccak512_file_hex keccak512_file_b64 keccak512_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( md2 md2_hex md2_b64 md2_b64u md2_file md2_file_hex md2_file_b64 md2_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( md4 md4_hex md4_b64 md4_b64u md4_file md4_file_hex md4_file_b64 md4_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( md5 md5_hex md5_b64 md5_b64u md5_file md5_file_hex md5_file_b64 md5_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( ripemd128 ripemd128_hex ripemd128_b64 ripemd128_b64u ripemd128_file ripemd128_file_hex ripemd128_file_b64 ripemd128_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( ripemd160 ripemd160_hex ripemd160_b64 ripemd160_b64u ripemd160_file ripemd160_file_hex ripemd160_file_b64 ripemd160_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( ripemd256 ripemd256_hex ripemd256_b64 ripemd256_b64u ripemd256_file ripemd256_file_hex ripemd256_file_b64 ripemd256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( ripemd320 ripemd320_hex ripemd320_b64 ripemd320_b64u ripemd320_file ripemd320_file_hex ripemd320_file_b64 ripemd320_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha1 sha1_hex sha1_b64 sha1_b64u sha1_file sha1_file_hex sha1_file_b64 sha1_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha224 sha224_hex sha224_b64 sha224_b64u sha224_file sha224_file_hex sha224_file_b64 sha224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha256 sha256_hex sha256_b64 sha256_b64u sha256_file sha256_file_hex sha256_file_b64 sha256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha384 sha384_hex sha384_b64 sha384_b64u sha384_file sha384_file_hex sha384_file_b64 sha384_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha3_224 sha3_224_hex sha3_224_b64 sha3_224_b64u sha3_224_file sha3_224_file_hex sha3_224_file_b64 sha3_224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha3_256 sha3_256_hex sha3_256_b64 sha3_256_b64u sha3_256_file sha3_256_file_hex sha3_256_file_b64 sha3_256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha3_384 sha3_384_hex sha3_384_b64 sha3_384_b64u sha3_384_file sha3_384_file_hex sha3_384_file_b64 sha3_384_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha3_512 sha3_512_hex sha3_512_b64 sha3_512_b64u sha3_512_file sha3_512_file_hex sha3_512_file_b64 sha3_512_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha512 sha512_hex sha512_b64 sha512_b64u sha512_file sha512_file_hex sha512_file_b64 sha512_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha512_224 sha512_224_hex sha512_224_b64 sha512_224_b64u sha512_224_file sha512_224_file_hex sha512_224_file_b64 sha512_224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha512_256 sha512_256_hex sha512_256_b64 sha512_256_b64u sha512_256_file sha512_256_file_hex sha512_256_file_b64 sha512_256_file_b64u )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use Carp;
77 $Carp::Internal{(__PACKAGE__)}++;
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( tiger192 tiger192_hex tiger192_b64 tiger192_b64u tiger192_file tiger192_file_hex tiger192_file_b64 tiger192_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( whirlpool whirlpool_hex whirlpool_b64 whirlpool_b64u whirlpool_file whirlpool_file_hex whirlpool_file_b64 whirlpool_file_b64u )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw( digest_data digest_data_hex digest_data_b64 digest_data_b64u digest_file digest_file_hex digest_file_b64 digest_file_b64u )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw(pbkdf1 pbkdf2 hkdf hkdf_expand hkdf_extract)] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b blake2b_hex blake2b_b64 blake2b_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s blake2s_hex blake2s_b64 blake2s_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( f9 f9_hex f9_b64 f9_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( hmac hmac_hex hmac_b64 hmac_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( omac omac_hex omac_b64 omac_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( pmac pmac_hex pmac_b64 pmac_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( pelican pelican_hex pelican_b64 pelican_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( poly1305 poly1305_hex poly1305_b64 poly1305_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( xcbc xcbc_hex xcbc_b64 xcbc_b64u )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use Carp;
77 $Carp::Internal{(__PACKAGE__)}++;
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 use Carp 'croak';
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.072';
77
88 use Crypt::Cipher;
99
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 ### not used
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw( dh_shared_secret )] );
226226 }
227227 elsif (ref $param eq 'SCALAR') {
228228 my $data = $$param;
229 $data = pem_to_der($data) if $data =~ /-----BEGIN DH PARAMETERS-----\s*(.+)\s*-----END DH PARAMETERS-----/s;
229 if ($data =~ /-----BEGIN DH PARAMETERS-----\s*(.+)\s*-----END DH PARAMETERS-----/s) {
230 $data = pem_to_der($data) or croak "FATAL: PEM/params decode failed";
231 }
230232 return $self->_generate_key_dhparam($data);
231233 }
232234 elsif (ref $param eq 'HASH') {
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw( dsa_encrypt dsa_decrypt dsa_sign_message dsa_verify_message dsa_sign_hash dsa_verify_hash )] );
3535 }
3636 elsif (@_ == 1 && ref $_[0] eq 'SCALAR') {
3737 my $data = ${$_[0]};
38 $data = pem_to_der($data) if $data =~ /-----BEGIN DSA PARAMETERS-----\s*(.+)\s*-----END DSA PARAMETERS-----/s;
38 if ($data =~ /-----BEGIN DSA PARAMETERS-----\s*(.+)\s*-----END DSA PARAMETERS-----/s) {
39 $data = pem_to_der($data) or croak "FATAL: PEM/params decode failed";
40 }
3941 return $self->_generate_key_dsaparam($data);
4042 }
4143 croak "FATAL: DSA generate_key - invalid args";
7577 croak "FATAL: invalid key data" unless $data;
7678
7779 if ($data =~ /-----BEGIN (DSA PRIVATE|DSA PUBLIC|PRIVATE|PUBLIC) KEY-----(.*?)-----END/sg) {
78 $data = pem_to_der($data, $password);
80 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
7981 return $self->_import($data);
8082 }
8183 elsif ($data =~ /---- BEGIN SSH2 PUBLIC KEY ----(.*?)---- END SSH2 PUBLIC KEY ----/sg) {
82 $data = pem_to_der($data);
84 $data = pem_to_der($data) or croak "FATAL: PEM/key decode failed";
8385 my ($typ, $p, $q, $g, $y) = Crypt::PK::_ssh_parse($data);
8486 return $self->_import_hex(unpack('H*',$p), unpack('H*',$q), unpack('H*',$g), undef, unpack('H*',$y)) if $typ && $p && $q && $g && $y && $typ eq 'ssh-dss';
8587 }
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw( ecc_encrypt ecc_decrypt ecc_sign_message ecc_verify_message ecc_sign_hash ecc_verify_hash ecc_shared_secret )] );
218218 croak "FATAL: invalid key data" unless $data;
219219
220220 if ($data =~ /-----BEGIN (EC PRIVATE|EC PUBLIC|PUBLIC) KEY-----(.*?)-----END/sg) {
221 $data = pem_to_der($data, $password);
221 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
222222 my $rv = eval { $self->_import($data) } || eval { $self->_import_old($data) };
223223 return $rv if $rv;
224224 }
225225 elsif ($data =~ /-----BEGIN PRIVATE KEY-----(.*?)-----END/sg) {
226 $data = pem_to_der($data, $password);
226 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
227227 return $self->_import_pkcs8($data, $password);
228228 }
229229 elsif ($data =~ /-----BEGIN ENCRYPTED PRIVATE KEY-----(.*?)-----END/sg) {
230 $data = pem_to_der($data, $password);
230 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
231231 return $self->_import_pkcs8($data, $password);
232232 }
233233 elsif ($data =~ /^\s*(\{.*?\})\s*$/s) {
243243 }
244244 }
245245 elsif ($data =~ /-----BEGIN CERTIFICATE-----(.*?)-----END CERTIFICATE-----/sg) {
246 $data = pem_to_der($data);
246 $data = pem_to_der($data) or croak "FATAL: PEM/cert decode failed";
247247 return $self->_import_x509($data);
248248 }
249249 elsif ($data =~ /---- BEGIN SSH2 PUBLIC KEY ----(.*?)---- END SSH2 PUBLIC KEY ----/sg) {
250 $data = pem_to_der($data);
250 $data = pem_to_der($data) or croak "FATAL: PEM/key decode failed";
251251 my ($typ, $skip, $pubkey) = Crypt::PK::_ssh_parse($data);
252252 return $self->import_key_raw($pubkey, "$2") if $pubkey && $typ =~ /^ecdsa-(.+?)-(.*)$/;
253253 }
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw( )] );
6363 croak "FATAL: invalid key data" unless $data;
6464
6565 if ($data =~ /-----BEGIN PUBLIC KEY-----(.*?)-----END/sg) {
66 $data = pem_to_der($data, $password);
66 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
6767 return $self->_import($data);
6868 }
6969 elsif ($data =~ /-----BEGIN PRIVATE KEY-----(.*?)-----END/sg) {
70 $data = pem_to_der($data, $password);
70 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
7171 return $self->_import_pkcs8($data, $password);
7272 }
7373 elsif ($data =~ /-----BEGIN ENCRYPTED PRIVATE KEY-----(.*?)-----END/sg) {
74 $data = pem_to_der($data, $password);
74 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
7575 return $self->_import_pkcs8($data, $password);
7676 }
7777 elsif ($data =~ /-----BEGIN ED25519 PRIVATE KEY-----(.*?)-----END/sg) {
78 $data = pem_to_der($data, $password);
78 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
7979 return $self->_import_pkcs8($data, $password);
8080 }
8181 elsif ($data =~ /^\s*(\{.*?\})\s*$/s) { # JSON
8686 }
8787 }
8888 elsif ($data =~ /-----BEGIN CERTIFICATE-----(.*?)-----END CERTIFICATE-----/sg) {
89 $data = pem_to_der($data);
89 $data = pem_to_der($data) or croak "FATAL: PEM/cert decode failed";
9090 return $self->_import_x509($data);
9191 }
9292 elsif ($data =~ /-----BEGIN OPENSSH PRIVATE KEY-----(.*?)-----END/sg) {
9696 croak "FATAL: OPENSSH PRIVATE KEY not supported";
9797 }
9898 elsif ($data =~ /---- BEGIN SSH2 PUBLIC KEY ----(.*?)---- END SSH2 PUBLIC KEY ----/sg) {
99 $data = pem_to_der($data);
99 $data = pem_to_der($data) or croak "FATAL: PEM/key decode failed";
100100 my ($typ, $pubkey) = Crypt::PK::_ssh_parse($data);
101101 return $self->_import_raw($pubkey, 0) if $typ eq 'ssh-ed25519' && length($pubkey) == 32;
102102 }
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw(rsa_encrypt rsa_decrypt rsa_sign_message rsa_verify_message rsa_sign_hash rsa_verify_hash)] );
121121 # PKCS#1 RSAPublicKey (PEM header: BEGIN RSA PUBLIC KEY)
122122 # PKCS#1 RSAPrivateKey (PEM header: BEGIN RSA PRIVATE KEY)
123123 # X.509 SubjectPublicKeyInfo (PEM header: BEGIN PUBLIC KEY)
124 $data = pem_to_der($data, $password);
124 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
125125 return $self->_import($data) if $data;
126126 }
127127 elsif ($data =~ /-----BEGIN PRIVATE KEY-----(.*?)-----END/sg) {
128128 # PKCS#8 PrivateKeyInfo (PEM header: BEGIN PRIVATE KEY)
129 $data = pem_to_der($data, $password);
129 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
130130 return $self->_import_pkcs8($data, $password);
131131 }
132132 elsif ($data =~ /-----BEGIN ENCRYPTED PRIVATE KEY-----(.*?)-----END/sg) {
133133 # PKCS#8 PrivateKeyInfo (PEM header: BEGIN ENCRYPTED PRIVATE KEY)
134 $data = pem_to_der($data, $password);
134 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
135135 return $self->_import_pkcs8($data, $password);
136136 }
137137 elsif ($data =~ /^\s*(\{.*?\})\s*$/s) {
146146 }
147147 }
148148 elsif ($data =~ /-----BEGIN CERTIFICATE-----(.*?)-----END CERTIFICATE-----/sg) {
149 $data = pem_to_der($data);
149 $data = pem_to_der($data) or croak "FATAL: PEM/cert decode failed";
150150 return $self->_import_x509($data);
151151 }
152152 elsif ($data =~ /---- BEGIN SSH2 PUBLIC KEY ----(.*?)---- END SSH2 PUBLIC KEY ----/sg) {
153 $data = pem_to_der($data);
153 $data = pem_to_der($data) or croak "FATAL: PEM/key decode failed";
154154 my ($typ, $N, $e) = Crypt::PK::_ssh_parse($data);
155155 return $self->_import_hex(unpack("H*", $e), unpack("H*", $N)) if $typ && $e && $N && $typ eq 'ssh-rsa';
156156 }
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw( )] );
6363 croak "FATAL: invalid key data" unless $data;
6464
6565 if ($data =~ /-----BEGIN PUBLIC KEY-----(.*?)-----END/sg) {
66 $data = pem_to_der($data, $password);
66 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
6767 return $self->_import($data);
6868 }
6969 elsif ($data =~ /-----BEGIN PRIVATE KEY-----(.*?)-----END/sg) {
70 $data = pem_to_der($data, $password);
70 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
7171 return $self->_import_pkcs8($data, $password);
7272 }
7373 elsif ($data =~ /-----BEGIN ENCRYPTED PRIVATE KEY-----(.*?)-----END/sg) {
74 $data = pem_to_der($data, $password);
74 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
7575 return $self->_import_pkcs8($data, $password);
7676 }
7777 elsif ($data =~ /-----BEGIN X25519 PRIVATE KEY-----(.*?)-----END/sg) {
78 $data = pem_to_der($data, $password);
78 $data = pem_to_der($data, $password) or croak "FATAL: PEM/key decode failed";
7979 return $self->_import_pkcs8($data, $password);
8080 }
8181 elsif ($data =~ /^\s*(\{.*?\})\s*$/s) { # JSON
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use Carp;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings ;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 require XSLoader;
77 XSLoader::load('CryptX', $VERSION);
129129
130130 =head1 COPYRIGHT
131131
132 Copyright (c) 2013-2020 DCIT, a.s. L<https://www.dcit.cz> / Karel Miko
132 Copyright (c) 2013-2021 DCIT, a.s. L<https://www.dcit.cz> / Karel Miko
133133
134134 =cut
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.072';
55
66 use CryptX;
77 use Carp;
2424 if ((15 - ccm->noncelen) > ccm->L) {
2525 ccm->L = 15 - ccm->noncelen;
2626 }
27 if (ccm->L > 8) {
28 return CRYPT_INVALID_ARG;
29 }
2730
2831 /* decrease noncelen to match L */
2932 if ((ccm->noncelen + ccm->L) > 15) {
3740 (ccm->L-1));
3841
3942 /* nonce */
40 for (y = 0; y < (16 - (ccm->L + 1)); y++) {
43 for (y = 0; y < 15 - ccm->L; y++) {
4144 ccm->PAD[x++] = nonce[y];
4245 }
4346
3434 }
3535
3636 /* make sure the taglen is valid */
37 if (taglen < 4 || taglen > 16 || (taglen % 2) == 1) {
37 if (taglen < 4 || taglen > 16 || (taglen % 2) == 1 || aadlen < 0 || ptlen < 0) {
3838 return CRYPT_INVALID_ARG;
3939 }
4040 ccm->taglen = taglen;
7474 }
7575
7676 /* make sure the taglen is valid */
77 if (*taglen < 4 || *taglen > 16 || (*taglen % 2) == 1) {
77 if (*taglen < 4 || *taglen > 16 || (*taglen % 2) == 1 || headerlen > 0x7fffffffu) {
7878 return CRYPT_INVALID_ARG;
7979 }
8080
107107 if ((15 - noncelen) > L) {
108108 L = 15 - noncelen;
109109 }
110 if (L > 8) {
111 return CRYPT_INVALID_ARG;
112 }
110113
111114 /* allocate mem for the symmetric key */
112115 if (uskey == NULL) {
140143 (L-1));
141144
142145 /* nonce */
143 for (y = 0; y < (16 - (L + 1)); y++) {
146 for (y = 0; y < 15 - L; y++) {
144147 PAD[x++] = nonce[y];
145148 }
146149
104104 #define ENDIAN_64BITWORD
105105 #if defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)
106106 #define ENDIAN_BIG
107 #endif
107 #else
108108 #define ENDIAN_LITTLE
109109 #endif
110110 #endif
181181 defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || \
182182 defined(__BIG_ENDIAN__) || \
183183 defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
184 defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)
184 defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) || \
185 defined(__m68k__)
185186 #define ENDIAN_BIG
186187 #elif defined(_BYTE_ORDER) && _BYTE_ORDER == _LITTLE_ENDIAN || \
187188 defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || \
285286
286287 #if !defined(LTC_NO_ROTATE) && (__has_builtin(__builtin_rotateleft32) && __has_builtin(__builtin_rotateright32))
287288 #define LTC_HAVE_ROTATE_BUILTIN
289 #endif
290
291 #if defined(__GNUC__)
292 #define LTC_ALIGN(n) __attribute__((aligned(n)))
293 #else
294 #define LTC_ALIGN(n)
288295 #endif
289296
290297 #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 405)
302309 # define LTC_DEPRECATED(s)
303310 # define LTC_DEPRECATED_PRAGMA(s)
304311 #endif
312
313 #endif /* TOMCRYPT_CFG_H */
317317 ctrlen;
318318
319319 /** The counter */
320 unsigned char ctr[MAXBLOCKSIZE],
320 unsigned char ctr[MAXBLOCKSIZE];
321321 /** The pad used to encrypt/decrypt */
322 pad[MAXBLOCKSIZE];
322 unsigned char pad[MAXBLOCKSIZE] LTC_ALIGN(16);
323323 /** The scheduled key */
324324 symmetric_key key;
325325 } symmetric_CTR;
394394 typedef struct {
395395 symmetric_key K;
396396 int cipher, /* which cipher */
397 taglen, /* length of the tag */
397 taglen, /* length of the tag (encoded in M value) */
398398 x; /* index in PAD */
399399
400400 unsigned long L, /* L value */
404404 current_aadlen, /* length of the currently provided add */
405405 noncelen; /* length of the nonce */
406406
407 unsigned char PAD[16],
407 unsigned char PAD[16], /* flags | Nonce N | l(m) */
408408 ctr[16],
409409 CTRPAD[16],
410410 CTRlen;
481481 #ifdef LTC_GCM_TABLES
482482 unsigned char PC[16][256][16] /* 16 tables of 8x128 */
483483 #ifdef LTC_GCM_TABLES_SSE2
484 __attribute__ ((aligned (16)))
484 LTC_ALIGN(16)
485485 #endif
486486 ;
487487 #endif
383383
384384 #ifdef LTC_MDSA
385385
386 /* Max diff between group and modulus size in bytes */
387 #define LTC_MDSA_DELTA 512
388
389 /* Max DSA group size in bytes (default allows 4k-bit groups) */
390 #define LTC_MDSA_MAX_GROUP 512
386 /* Max diff between group and modulus size in bytes (max case: L=8192bits, N=256bits) */
387 #define LTC_MDSA_DELTA 992
388
389 /* Max DSA group size in bytes */
390 #define LTC_MDSA_MAX_GROUP 64
391
392 /* Max DSA modulus size in bytes (the actual DSA size, max 8192 bits) */
393 #define LTC_MDSA_MAX_MODULUS 1024
391394
392395 /** DSA key structure */
393396 typedef struct {
6363 }
6464 #if defined(LTC_TEST) && defined(LTC_TEST_DBG)
6565 if (res != 0) {
66 fprintf(stderr, "Testvector #%i of %s failed:\n", which, what);
66 fprintf(stderr, "Testvector #%i(0x%x) of %s failed:\n", which, which, what);
6767 s_print_hex("SHOULD", should, should_len);
6868 s_print_hex("IS ", is, is_len);
6969 #if LTC_TEST_DBG > 1
7070 } else {
71 fprintf(stderr, "Testvector #%i of %s passed!\n", which, what);
71 fprintf(stderr, "Testvector #%i(0x%x) of %s passed!\n", which, which, what);
7272 #endif
7373 }
7474 #else
101101 {"LTC_MDSA", 1},
102102 C_STRINGIFY(LTC_MDSA_DELTA),
103103 C_STRINGIFY(LTC_MDSA_MAX_GROUP),
104 C_STRINGIFY(LTC_MDSA_MAX_MODULUS),
104105 #else
105106 {"LTC_MDSA", 0},
106107 #endif
154154 }
155155
156156 switch (type) {
157 case LTC_ASN1_CUSTOM_TYPE:
158 case LTC_ASN1_SET:
159 case LTC_ASN1_SETOF:
160 case LTC_ASN1_SEQUENCE:
161 break;
162 default:
163 /* Verify that all basic types are indeed UNIVERSAL&PRIMITIVE */
164 if (((flags & LTC_DER_SEQ_STRICT) == LTC_DER_SEQ_STRICT) && (inlen > 0)) {
165 if (in[x] & 0xE0u) {
166 err = CRYPT_PK_ASN1_ERROR;
167 goto LBL_ERR;
168 }
169 }
170 }
171
172 switch (type) {
157173 case LTC_ASN1_BOOLEAN:
158174 z = inlen;
159175 if ((err = der_decode_boolean(in + x, z, ((int *)data))) != CRYPT_OK) {
2525 int err, res, mr_tests_q, mr_tests_p, found_p, found_q, hash;
2626 unsigned char *wbuf, *sbuf, digest[MAXBLOCKSIZE];
2727 void *t2L1, *t2N1, *t2q, *t2seedlen, *U, *W, *X, *c, *h, *e, *seedinc;
28 const char *accepted_hashes[] = { "sha3-512", "sha512", "sha3-384", "sha384", "sha3-256", "sha256" };
2829
2930 /* check size */
30 if (group_size >= LTC_MDSA_MAX_GROUP || group_size < 1 || group_size >= modulus_size) {
31 if (group_size > LTC_MDSA_MAX_GROUP || group_size < 1 || group_size >= modulus_size || modulus_size > LTC_MDSA_MAX_MODULUS) {
3132 return CRYPT_INVALID_ARG;
3233 }
3334
8687 else { mr_tests_q = 64; }
8788 #endif
8889
89 if (N <= 256) {
90 hash = register_hash(&sha256_desc);
91 }
92 else if (N <= 384) {
93 hash = register_hash(&sha384_desc);
94 }
95 else if (N <= 512) {
96 hash = register_hash(&sha512_desc);
97 }
98 else {
90 hash = -1;
91 for (i = 0; i < sizeof(accepted_hashes)/sizeof(accepted_hashes[0]); ++i) {
92 hash = find_hash(accepted_hashes[i]);
93 if (hash != -1) break;
94 }
95 if (hash == -1) {
96 return CRYPT_INVALID_ARG; /* no appropriate hash function found */
97 }
98 if (N > hash_descriptor[hash].hashsize * 8) {
9999 return CRYPT_INVALID_ARG; /* group_size too big */
100100 }
101101
00 use strict;
11 use warnings;
2 use Test::More tests => 49;
2 use Test::More tests => 52;
33
44 use Crypt::PK::RSA qw(rsa_encrypt rsa_decrypt rsa_sign_message rsa_verify_message rsa_sign_hash rsa_verify_hash);
55
111111 ok($sig, 'rsa_sign_hash');
112112 ok(rsa_verify_hash('t/data/cryptx_pub_rsa1.der', $sig, $hash, 'SHA1'), 'rsa_verify_hash');
113113 }
114
115 {
116 ## https://github.com/DCIT/perl-CryptX/issues/69
117
118 # my $priv = Crypt::PK::RSA->new({
119 # e => "03",
120 # N => "E932AC92252F585B3A80A4DD76A897C8B7652952FE788F6EC8DD640587A1EE5647670A8AD4C2BE0F9FA6E49C605ADF77B5174230".
121 # "AF7BD50E5D6D6D6D28CCF0A886A514CC72E51D209CC772A52EF419F6A953F3135929588EBE9B351FCA61CED78F346FE00DBB6306".
122 # "E5C2A4C6DFC3779AF85AB417371CF34D8387B9B30AE46D7A5FF5A655B8D8455F1B94AE736989D60A6F2FD5CADBFFBD504C5A756A".
123 # "2E6BB5CECC13BCA7503F6DF8B52ACE5C410997E98809DB4DC30D943DE4E812A47553DCE54844A78E36401D13F77DC650619FED88".
124 # "D8B3926E3D8E319C80C744779AC5D6ABE252896950917476ECE5E8FC27D5F053D6018D91B502C4787558A002B9283DA7",
125 # d => "009b771db6c374e59227006de8f9c5ba85cf98c63754505f9f30939803afc1498eda44b1b1e32c7eb51519edbd9591ea4fce0f81".
126 # "75ca528e09939e48f37088a07059c36332f74368c06884f718c9f8114f1b8d4cb790c63b09d46778bfdc41348fb4cd9feab3d242".
127 # "04992c6dd9ea824fbca591cd64cf68a233ad0526775c9848fafa31528177e1f8df9181a8b945081106fd58bd3d73799b229575c4".
128 # "f3b29101a03ee1f05472b3615784d9244ce0ed639c77e8e212ab52abddf4a928224b6b6f74b7114786dd6071bd9113d7870c6b52".
129 # "c0bc8b9c102cfe321dac357e030ed6c580040ca41c13d6b4967811807ef2a225983ea9f88d67faa42620f42a4f5bdbe03b",
130 # });
131 # my $sig_hex = unpack("H*", $priv->sign_message('hello world!', 'SHA256', 'v1.5'));
132
133 my $pub = Crypt::PK::RSA->new({
134 e => "03",
135 N => "E932AC92252F585B3A80A4DD76A897C8B7652952FE788F6EC8DD640587A1EE5647670A8AD4C2BE0F9FA6E49C605ADF77B5174230".
136 "AF7BD50E5D6D6D6D28CCF0A886A514CC72E51D209CC772A52EF419F6A953F3135929588EBE9B351FCA61CED78F346FE00DBB6306".
137 "E5C2A4C6DFC3779AF85AB417371CF34D8387B9B30AE46D7A5FF5A655B8D8455F1B94AE736989D60A6F2FD5CADBFFBD504C5A756A".
138 "2E6BB5CECC13BCA7503F6DF8B52ACE5C410997E98809DB4DC30D943DE4E812A47553DCE54844A78E36401D13F77DC650619FED88".
139 "D8B3926E3D8E319C80C744779AC5D6ABE252896950917476ECE5E8FC27D5F053D6018D91B502C4787558A002B9283DA7",
140 });
141
142 my $sig1 = pack("H*", "8df69d774c6ac8b5f8aa16576ca37a4f948706c5daecb3c15cfd247a7657616b2bbb786b50158cac8c23e3".
143 "289d300d3fbb82380b8746d929df36bdaf43a5fc5d1d04c61c98d47c22de02d051be3ba9e42b1c47aa5192".
144 "66d4cae244e5ce99b24771a13a7c8c7b08868a3eccf70b4bc7570d5131a1ac8943d91b0151c39da2ad75cd".
145 "1b9a697d100eef6747217df581b272cfd1f549a901ff4951036a4eb28fd2ea1e9df3fa9fa457663f4259be".
146 "8e5f2f2fb84f831a0ca5320e2b79f04a17830f43062c4c8fc0d0b1ff90567f3342d524f682ca26661caadf".
147 "4272f2585e6013a92bfa68de72fe6174096890e4296aedd72da43aa508007df53fb852bd7162ab635b");
148
149 my $sig2 = pack("H*", "1ee08947536e6b11d8923c3b00061d26a6933b5345077ea0214fdcbcc1ad68395008ff709117047e6b01dd".
150 "2a371dfa032c0732abc86ab2e0273bbd0dfe6b1c769e21bb9079982801d8f72e01be3244959312ab09bb8f".
151 "88572dc23216719b9810c73edf826749604feb8da1345f83f0209271aca462c1235b4cb4ba538f85a9c03d".
152 "d1dde1856fe73fd86b95566df2dfe8b0895c34489b97e02c8e48dabad7067619edec6267a776fa416fbcac".
153 "0fcacf3efa7852ce33ed63a9149c685c303d98c3dc37ee87521bc5b130377345fc95c87aa48505470deaf6".
154 "fb1064df041e3f03322b1ec90d3608deb17bf77f47066ecc6c511bfba69eed6da42881dcce603fcb2a");
155
156 my $sig3 = pack("H*", "02364fdabb83d98118fe3d3bb86866038de4dc6e569f59fd6dc0360d3785e7fbded2f5a4c6d87052aeab25".
157 "c451a91f8dccbc0d6db3b59ddd57368180091183369221b67a399a96ca5d318a908575462fe42d1aabba27".
158 "7b7b5bb2aae43567ecd671dfc1d8b935c7dc06d0058a45dadabfc21b1cbae3cb719f3bca8b1365576e2eb9".
159 "54cba048beba174e515a919148ac4a9ae3505b3a8ad6326b63757d1dd59a9f83df60bb295b32d90053b016".
160 "b4cd2745eb29f12a2aad86c05f04ebd3cca3a8c63c752ccad07d7fd4e6e2adab4f353efbda04a6b5b7f4a6".
161 "d540c085e7ddc90f1665adb048dfc707eac2db28246e1bffe53f115a02f7c74defccafa7213cb22245");
162
163 is($pub->verify_message($sig1, 'hello world!', 'SHA256', 'v1.5'), 0, "github issue 69 - invalid signature/1");
164 is($pub->verify_message($sig2, 'hello world!', 'SHA256', 'v1.5'), 0, "github issue 69 - invalid signature/2");
165 is($pub->verify_message($sig3, 'hello world!', 'SHA256', 'v1.5'), 1, "github issue 69 - valid signature/3");
166 }