Codebase list libcryptx-perl / upstream/0.071+git20210410.1.8e1295b
Import upstream version 0.071+git20210410.1.8e1295b Debian Janitor 3 years ago
117 changed file(s) with 224 addition(s) and 214 deletion(s). Raw diff Collapse all Expand all
00 Changes for CryptX
1
2 0.072 2021-XX-XX
3 - fix #69 Identifier Octet's Leniency in RSA PKCS#1 Signature Verification
4 - bundled libtomcrypt update branch:develop (commit:ddf1b63a 2021-04-10)
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)
150150 LICENSE
151151 Makefile.PL
152152 MANIFEST This list of files
153 META.json
154 META.yml
155153 ppport.h
156154 README.md
157155 src/ltc/ciphers/aes/aes.c
10821080 t/prng_yarrow.t
10831081 t/sshkey.t
10841082 typemap
1083 META.yml Module YAML meta-data (added by MakeMaker)
1084 META.json Module JSON meta-data (added by MakeMaker)
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.44, CPAN::Meta::Converter version 2.150010",
77 "license" : [
88 "perl_5"
99 ],
4040 }
4141 }
4242 },
43 "release_status" : "stable",
43 "release_status" : "unstable",
4444 "resources" : {
4545 "bugtracker" : {
4646 "web" : "https://github.com/DCIT/perl-CryptX/issues"
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.071_001",
53 "x_serialization_backend" : "JSON::PP version 4.04"
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.44, 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.071_001
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
0 # NAME
10
2 CryptX - Cryptographic toolkit
3
4 # DESCRIPTION
5
6 Perl modules providing a cryptography based on [LibTomCrypt](https://github.com/libtom/libtomcrypt) library.
7
8 - Symmetric ciphers - see [Crypt::Cipher](https://metacpan.org/pod/Crypt%3A%3ACipher) and related modules
9
10 [Crypt::Cipher::AES](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AAES), [Crypt::Cipher::Anubis](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AAnubis), [Crypt::Cipher::Blowfish](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ABlowfish), [Crypt::Cipher::Camellia](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ACamellia), [Crypt::Cipher::CAST5](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ACAST5), [Crypt::Cipher::DES](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ADES),
11 [Crypt::Cipher::DES\_EDE](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ADES_EDE), [Crypt::Cipher::IDEA](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AIDEA), [Crypt::Cipher::KASUMI](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AKASUMI), [Crypt::Cipher::Khazad](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AKhazad), [Crypt::Cipher::MULTI2](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AMULTI2), [Crypt::Cipher::Noekeon](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ANoekeon),
12 [Crypt::Cipher::RC2](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ARC2), [Crypt::Cipher::RC5](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ARC5), [Crypt::Cipher::RC6](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ARC6), [Crypt::Cipher::SAFERP](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ASAFERP), [Crypt::Cipher::SAFER\_K128](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ASAFER_K128), [Crypt::Cipher::SAFER\_K64](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ASAFER_K64),
13 [Crypt::Cipher::SAFER\_SK128](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ASAFER_SK128), [Crypt::Cipher::SAFER\_SK64](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ASAFER_SK64), [Crypt::Cipher::SEED](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ASEED), [Crypt::Cipher::Serpent](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ASerpent), [Crypt::Cipher::Skipjack](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ASkipjack),
14 [Crypt::Cipher::Twofish](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ATwofish), [Crypt::Cipher::XTEA](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AXTEA)
15
16 - Block cipher modes
17
18 [Crypt::Mode::CBC](https://metacpan.org/pod/Crypt%3A%3AMode%3A%3ACBC), [Crypt::Mode::CFB](https://metacpan.org/pod/Crypt%3A%3AMode%3A%3ACFB), [Crypt::Mode::CTR](https://metacpan.org/pod/Crypt%3A%3AMode%3A%3ACTR), [Crypt::Mode::ECB](https://metacpan.org/pod/Crypt%3A%3AMode%3A%3AECB), [Crypt::Mode::OFB](https://metacpan.org/pod/Crypt%3A%3AMode%3A%3AOFB)
19
20 - Stream ciphers
21
22 [Crypt::Stream::RC4](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3ARC4), [Crypt::Stream::ChaCha](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3AChaCha), [Crypt::Stream::Salsa20](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3ASalsa20), [Crypt::Stream::Sober128](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3ASober128),
23 [Crypt::Stream::Sosemanuk](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3ASosemanuk), [Crypt::Stream::Rabbit](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3ARabbit)
24
25 - Authenticated encryption modes
26
27 [Crypt::AuthEnc::CCM](https://metacpan.org/pod/Crypt%3A%3AAuthEnc%3A%3ACCM), [Crypt::AuthEnc::EAX](https://metacpan.org/pod/Crypt%3A%3AAuthEnc%3A%3AEAX), [Crypt::AuthEnc::GCM](https://metacpan.org/pod/Crypt%3A%3AAuthEnc%3A%3AGCM), [Crypt::AuthEnc::OCB](https://metacpan.org/pod/Crypt%3A%3AAuthEnc%3A%3AOCB), [Crypt::AuthEnc::ChaCha20Poly1305](https://metacpan.org/pod/Crypt%3A%3AAuthEnc%3A%3AChaCha20Poly1305)
28
29 - Hash Functions - see [Crypt::Digest](https://metacpan.org/pod/Crypt%3A%3ADigest) and related modules
30
31 [Crypt::Digest::BLAKE2b\_160](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ABLAKE2b_160), [Crypt::Digest::BLAKE2b\_256](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ABLAKE2b_256), [Crypt::Digest::BLAKE2b\_384](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ABLAKE2b_384), [Crypt::Digest::BLAKE2b\_512](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ABLAKE2b_512),
32 [Crypt::Digest::BLAKE2s\_128](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ABLAKE2s_128), [Crypt::Digest::BLAKE2s\_160](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ABLAKE2s_160), [Crypt::Digest::BLAKE2s\_224](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ABLAKE2s_224), [Crypt::Digest::BLAKE2s\_256](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ABLAKE2s_256),
33 [Crypt::Digest::CHAES](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ACHAES), [Crypt::Digest::MD2](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3AMD2), [Crypt::Digest::MD4](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3AMD4), [Crypt::Digest::MD5](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3AMD5), [Crypt::Digest::RIPEMD128](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ARIPEMD128), [Crypt::Digest::RIPEMD160](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ARIPEMD160),
34 [Crypt::Digest::RIPEMD256](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ARIPEMD256), [Crypt::Digest::RIPEMD320](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ARIPEMD320), [Crypt::Digest::SHA1](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA1), [Crypt::Digest::SHA224](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA224), [Crypt::Digest::SHA256](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA256), [Crypt::Digest::SHA384](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA384),
35 [Crypt::Digest::SHA512](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA512), [Crypt::Digest::SHA512\_224](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA512_224), [Crypt::Digest::SHA512\_256](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA512_256), [Crypt::Digest::Tiger192](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ATiger192), [Crypt::Digest::Whirlpool](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3AWhirlpool),
36 [Crypt::Digest::Keccak224](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3AKeccak224), [Crypt::Digest::Keccak256](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3AKeccak256), [Crypt::Digest::Keccak384](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3AKeccak384), [Crypt::Digest::Keccak512](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3AKeccak512),
37 [Crypt::Digest::SHA3\_224](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA3_224), [Crypt::Digest::SHA3\_256](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA3_256), [Crypt::Digest::SHA3\_384](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA3_384), [Crypt::Digest::SHA3\_512](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA3_512), [Crypt::Digest::SHAKE](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHAKE)
38
39 - Checksums
40
41 [Crypt::Checksum::Adler32](https://metacpan.org/pod/Crypt%3A%3AChecksum%3A%3AAdler32), [Crypt::Checksum::CRC32](https://metacpan.org/pod/Crypt%3A%3AChecksum%3A%3ACRC32)
42
43 - Message Authentication Codes
44
45 [Crypt::Mac::BLAKE2b](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3ABLAKE2b), [Crypt::Mac::BLAKE2s](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3ABLAKE2s), [Crypt::Mac::F9](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3AF9), [Crypt::Mac::HMAC](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3AHMAC), [Crypt::Mac::OMAC](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3AOMAC),
46 [Crypt::Mac::Pelican](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3APelican), [Crypt::Mac::PMAC](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3APMAC), [Crypt::Mac::XCBC](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3AXCBC), [Crypt::Mac::Poly1305](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3APoly1305)
47
48 - Public key cryptography
49
50 [Crypt::PK::RSA](https://metacpan.org/pod/Crypt%3A%3APK%3A%3ARSA), [Crypt::PK::DSA](https://metacpan.org/pod/Crypt%3A%3APK%3A%3ADSA), [Crypt::PK::ECC](https://metacpan.org/pod/Crypt%3A%3APK%3A%3AECC), [Crypt::PK::DH](https://metacpan.org/pod/Crypt%3A%3APK%3A%3ADH), [Crypt::PK::Ed25519](https://metacpan.org/pod/Crypt%3A%3APK%3A%3AEd25519), [Crypt::PK::X25519](https://metacpan.org/pod/Crypt%3A%3APK%3A%3AX25519)
51
52 - Cryptographically secure random number generators - see [Crypt::PRNG](https://metacpan.org/pod/Crypt%3A%3APRNG) and related modules
53
54 [Crypt::PRNG::Fortuna](https://metacpan.org/pod/Crypt%3A%3APRNG%3A%3AFortuna), [Crypt::PRNG::Yarrow](https://metacpan.org/pod/Crypt%3A%3APRNG%3A%3AYarrow), [Crypt::PRNG::RC4](https://metacpan.org/pod/Crypt%3A%3APRNG%3A%3ARC4), [Crypt::PRNG::Sober128](https://metacpan.org/pod/Crypt%3A%3APRNG%3A%3ASober128), [Crypt::PRNG::ChaCha20](https://metacpan.org/pod/Crypt%3A%3APRNG%3A%3AChaCha20)
55
56 - Key derivation functions - PBKDF1, PBKDF2 and HKDF
57
58 [Crypt::KeyDerivation](https://metacpan.org/pod/Crypt%3A%3AKeyDerivation)
59
60 - Other handy functions related to cryptography
61
62 [Crypt::Misc](https://metacpan.org/pod/Crypt%3A%3AMisc)
63
64 # LICENSE
65
66 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
67
68 # COPYRIGHT
69
70 Copyright (c) 2013-2020 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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
55
66 ### not used
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.071_001';
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.071_001';
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.071_001';
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.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use base qw(Crypt::Cipher);
99
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.071_001';
55
66 use Carp;
77 $Carp::Internal{(__PACKAGE__)}++;
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
55
66 use Carp;
77 $Carp::Internal{(__PACKAGE__)}++;
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
55
66 use Carp;
77 $Carp::Internal{(__PACKAGE__)}++;
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.071_001';
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.071_001';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.070';
6 our $VERSION = '0.071_001';
77
88 use Crypt::Cipher;
99
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.071_001';
55
66 ### not used
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
55
66 use Carp;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
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.071_001';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.071_001';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.071_001';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.071_001';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.071_001';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.070';
4 our $VERSION = '0.071_001';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings ;
4 our $VERSION = '0.070';
4 our $VERSION = '0.071_001';
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.071_001';
55
66 use CryptX;
77 use Carp;
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) {
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 }