├── .gitignore ├── BUILD_README.md ├── CHANGELOG.md ├── HOWTO_gdrive_service_account.md ├── LICENSE ├── README.md ├── images ├── empty.txt ├── google01.png ├── google02.png ├── google03.png ├── google04.png ├── google05.png ├── google06.png ├── google07.png ├── google08.png ├── qtcreator_disable_shadow_build.png └── zd_running_pub.png ├── src.pro └── src ├── LICENSE ├── zd.pro ├── zd_logger_lib ├── src │ ├── private │ │ ├── app_logger.cpp │ │ ├── app_logger.h │ │ ├── debug_logger.cpp │ │ ├── debug_logger.h │ │ ├── file_logger.cpp │ │ ├── file_logger.h │ │ ├── io_thread.cpp │ │ ├── io_thread.h │ │ ├── msg_log_context.h │ │ ├── text_file_logger.cpp │ │ ├── text_file_logger.h │ │ ├── text_logger_manager.cpp │ │ └── text_logger_manager.h │ ├── qdebugex.h │ ├── unit_tests │ │ ├── main_unit_tests.cpp │ │ ├── private │ │ │ └── file_logger_tests.h │ │ └── zd_logger_tests.h │ ├── zd_logger.cpp │ ├── zd_logger.h │ └── zd_logger_global.h └── zd_logger_lib.pro ├── zd_shared_lib ├── src │ ├── botan_wrapper.cpp │ ├── botan_wrapper.h │ ├── botan_wrapper_private.cpp │ ├── botan_wrapper_private.h │ ├── increasing_timer.cpp │ ├── increasing_timer.h │ ├── lib │ │ └── botan │ │ │ ├── arm32 │ │ │ ├── include │ │ │ │ └── botan │ │ │ │ │ ├── alg_id.h │ │ │ │ │ ├── asn1_attribute.h │ │ │ │ │ ├── asn1_obj.h │ │ │ │ │ ├── asn1_oid.h │ │ │ │ │ ├── asn1_print.h │ │ │ │ │ ├── asn1_str.h │ │ │ │ │ ├── asn1_time.h │ │ │ │ │ ├── assert.h │ │ │ │ │ ├── base64.h │ │ │ │ │ ├── ber_dec.h │ │ │ │ │ ├── bigint.h │ │ │ │ │ ├── blinding.h │ │ │ │ │ ├── botan.h │ │ │ │ │ ├── bswap.h │ │ │ │ │ ├── buf_comp.h │ │ │ │ │ ├── build.h │ │ │ │ │ ├── calendar.h │ │ │ │ │ ├── charset.h │ │ │ │ │ ├── compiler.h │ │ │ │ │ ├── cpuid.h │ │ │ │ │ ├── curve_nistp.h │ │ │ │ │ ├── data_src.h │ │ │ │ │ ├── database.h │ │ │ │ │ ├── der_enc.h │ │ │ │ │ ├── divide.h │ │ │ │ │ ├── eme.h │ │ │ │ │ ├── emsa.h │ │ │ │ │ ├── emsa_pkcs1.h │ │ │ │ │ ├── entropy_src.h │ │ │ │ │ ├── exceptn.h │ │ │ │ │ ├── hash.h │ │ │ │ │ ├── hash_id.h │ │ │ │ │ ├── hex.h │ │ │ │ │ ├── init.h │ │ │ │ │ ├── kdf.h │ │ │ │ │ ├── key_spec.h │ │ │ │ │ ├── keypair.h │ │ │ │ │ ├── loadstor.h │ │ │ │ │ ├── lookup.h │ │ │ │ │ ├── mac.h │ │ │ │ │ ├── mdx_hash.h │ │ │ │ │ ├── mem_ops.h │ │ │ │ │ ├── mgf1.h │ │ │ │ │ ├── monty.h │ │ │ │ │ ├── mul128.h │ │ │ │ │ ├── mutex.h │ │ │ │ │ ├── numthry.h │ │ │ │ │ ├── oids.h │ │ │ │ │ ├── parsing.h │ │ │ │ │ ├── pem.h │ │ │ │ │ ├── pk_algs.h │ │ │ │ │ ├── pk_keys.h │ │ │ │ │ ├── pk_ops.h │ │ │ │ │ ├── pk_ops_fwd.h │ │ │ │ │ ├── pkcs8.h │ │ │ │ │ ├── pow_mod.h │ │ │ │ │ ├── pssr.h │ │ │ │ │ ├── pubkey.h │ │ │ │ │ ├── reducer.h │ │ │ │ │ ├── rng.h │ │ │ │ │ ├── rotate.h │ │ │ │ │ ├── rsa.h │ │ │ │ │ ├── scan_name.h │ │ │ │ │ ├── secmem.h │ │ │ │ │ ├── sha2_32.h │ │ │ │ │ ├── stl_compatibility.h │ │ │ │ │ ├── sym_algo.h │ │ │ │ │ ├── symkey.h │ │ │ │ │ ├── system_rng.h │ │ │ │ │ ├── types.h │ │ │ │ │ ├── version.h │ │ │ │ │ ├── workfactor.h │ │ │ │ │ └── x509_key.h │ │ │ └── lib │ │ │ │ ├── libbotan-2.so │ │ │ │ ├── libbotan-2.so.13 │ │ │ │ └── libbotan-2.so.13.14.0 │ │ │ ├── arm64 │ │ │ ├── include │ │ │ │ └── botan │ │ │ │ │ ├── alg_id.h │ │ │ │ │ ├── asn1_attribute.h │ │ │ │ │ ├── asn1_obj.h │ │ │ │ │ ├── asn1_oid.h │ │ │ │ │ ├── asn1_print.h │ │ │ │ │ ├── asn1_str.h │ │ │ │ │ ├── asn1_time.h │ │ │ │ │ ├── assert.h │ │ │ │ │ ├── base64.h │ │ │ │ │ ├── ber_dec.h │ │ │ │ │ ├── bigint.h │ │ │ │ │ ├── blinding.h │ │ │ │ │ ├── botan.h │ │ │ │ │ ├── bswap.h │ │ │ │ │ ├── buf_comp.h │ │ │ │ │ ├── build.h │ │ │ │ │ ├── calendar.h │ │ │ │ │ ├── charset.h │ │ │ │ │ ├── compiler.h │ │ │ │ │ ├── cpuid.h │ │ │ │ │ ├── curve_nistp.h │ │ │ │ │ ├── data_src.h │ │ │ │ │ ├── database.h │ │ │ │ │ ├── der_enc.h │ │ │ │ │ ├── divide.h │ │ │ │ │ ├── eme.h │ │ │ │ │ ├── emsa.h │ │ │ │ │ ├── emsa_pkcs1.h │ │ │ │ │ ├── entropy_src.h │ │ │ │ │ ├── exceptn.h │ │ │ │ │ ├── hash.h │ │ │ │ │ ├── hash_id.h │ │ │ │ │ ├── hex.h │ │ │ │ │ ├── init.h │ │ │ │ │ ├── kdf.h │ │ │ │ │ ├── key_spec.h │ │ │ │ │ ├── keypair.h │ │ │ │ │ ├── loadstor.h │ │ │ │ │ ├── lookup.h │ │ │ │ │ ├── mac.h │ │ │ │ │ ├── mdx_hash.h │ │ │ │ │ ├── mem_ops.h │ │ │ │ │ ├── mgf1.h │ │ │ │ │ ├── monty.h │ │ │ │ │ ├── mul128.h │ │ │ │ │ ├── mutex.h │ │ │ │ │ ├── numthry.h │ │ │ │ │ ├── oids.h │ │ │ │ │ ├── parsing.h │ │ │ │ │ ├── pem.h │ │ │ │ │ ├── pk_algs.h │ │ │ │ │ ├── pk_keys.h │ │ │ │ │ ├── pk_ops.h │ │ │ │ │ ├── pk_ops_fwd.h │ │ │ │ │ ├── pkcs8.h │ │ │ │ │ ├── pow_mod.h │ │ │ │ │ ├── pssr.h │ │ │ │ │ ├── pubkey.h │ │ │ │ │ ├── reducer.h │ │ │ │ │ ├── rng.h │ │ │ │ │ ├── rotate.h │ │ │ │ │ ├── rsa.h │ │ │ │ │ ├── scan_name.h │ │ │ │ │ ├── secmem.h │ │ │ │ │ ├── sha2_32.h │ │ │ │ │ ├── stl_compatibility.h │ │ │ │ │ ├── sym_algo.h │ │ │ │ │ ├── symkey.h │ │ │ │ │ ├── system_rng.h │ │ │ │ │ ├── types.h │ │ │ │ │ ├── version.h │ │ │ │ │ ├── workfactor.h │ │ │ │ │ └── x509_key.h │ │ │ └── lib │ │ │ │ ├── libbotan-2.so │ │ │ │ ├── libbotan-2.so.13 │ │ │ │ └── libbotan-2.so.13.14.0 │ │ │ ├── linux64 │ │ │ ├── include │ │ │ │ └── botan │ │ │ │ │ ├── aes.h │ │ │ │ │ ├── alg_id.h │ │ │ │ │ ├── asn1_attribute.h │ │ │ │ │ ├── asn1_obj.h │ │ │ │ │ ├── asn1_oid.h │ │ │ │ │ ├── asn1_print.h │ │ │ │ │ ├── asn1_str.h │ │ │ │ │ ├── asn1_time.h │ │ │ │ │ ├── assert.h │ │ │ │ │ ├── base64.h │ │ │ │ │ ├── ber_dec.h │ │ │ │ │ ├── bigint.h │ │ │ │ │ ├── blinding.h │ │ │ │ │ ├── block_cipher.h │ │ │ │ │ ├── botan.h │ │ │ │ │ ├── bswap.h │ │ │ │ │ ├── buf_comp.h │ │ │ │ │ ├── build.h │ │ │ │ │ ├── calendar.h │ │ │ │ │ ├── charset.h │ │ │ │ │ ├── compiler.h │ │ │ │ │ ├── cpuid.h │ │ │ │ │ ├── curve_nistp.h │ │ │ │ │ ├── data_src.h │ │ │ │ │ ├── database.h │ │ │ │ │ ├── der_enc.h │ │ │ │ │ ├── divide.h │ │ │ │ │ ├── eme.h │ │ │ │ │ ├── emsa.h │ │ │ │ │ ├── emsa_pkcs1.h │ │ │ │ │ ├── entropy_src.h │ │ │ │ │ ├── exceptn.h │ │ │ │ │ ├── hash.h │ │ │ │ │ ├── hash_id.h │ │ │ │ │ ├── hex.h │ │ │ │ │ ├── init.h │ │ │ │ │ ├── kdf.h │ │ │ │ │ ├── key_spec.h │ │ │ │ │ ├── keypair.h │ │ │ │ │ ├── loadstor.h │ │ │ │ │ ├── lookup.h │ │ │ │ │ ├── mac.h │ │ │ │ │ ├── mdx_hash.h │ │ │ │ │ ├── mem_ops.h │ │ │ │ │ ├── mgf1.h │ │ │ │ │ ├── monty.h │ │ │ │ │ ├── mul128.h │ │ │ │ │ ├── mutex.h │ │ │ │ │ ├── numthry.h │ │ │ │ │ ├── oids.h │ │ │ │ │ ├── parsing.h │ │ │ │ │ ├── pem.h │ │ │ │ │ ├── pk_algs.h │ │ │ │ │ ├── pk_keys.h │ │ │ │ │ ├── pk_ops.h │ │ │ │ │ ├── pk_ops_fwd.h │ │ │ │ │ ├── pkcs8.h │ │ │ │ │ ├── pow_mod.h │ │ │ │ │ ├── pssr.h │ │ │ │ │ ├── pubkey.h │ │ │ │ │ ├── reducer.h │ │ │ │ │ ├── rng.h │ │ │ │ │ ├── rotate.h │ │ │ │ │ ├── rsa.h │ │ │ │ │ ├── scan_name.h │ │ │ │ │ ├── secmem.h │ │ │ │ │ ├── sha2_32.h │ │ │ │ │ ├── stl_compatibility.h │ │ │ │ │ ├── sym_algo.h │ │ │ │ │ ├── symkey.h │ │ │ │ │ ├── system_rng.h │ │ │ │ │ ├── types.h │ │ │ │ │ ├── version.h │ │ │ │ │ ├── workfactor.h │ │ │ │ │ └── x509_key.h │ │ │ └── lib │ │ │ │ ├── libbotan-2.so │ │ │ │ ├── libbotan-2.so.13 │ │ │ │ └── libbotan-2.so.13.14.0 │ │ │ ├── macx │ │ │ ├── include │ │ │ │ └── botan │ │ │ │ │ ├── aes.h │ │ │ │ │ ├── alg_id.h │ │ │ │ │ ├── asn1_attribute.h │ │ │ │ │ ├── asn1_obj.h │ │ │ │ │ ├── asn1_oid.h │ │ │ │ │ ├── asn1_print.h │ │ │ │ │ ├── asn1_str.h │ │ │ │ │ ├── asn1_time.h │ │ │ │ │ ├── assert.h │ │ │ │ │ ├── base64.h │ │ │ │ │ ├── ber_dec.h │ │ │ │ │ ├── bigint.h │ │ │ │ │ ├── blinding.h │ │ │ │ │ ├── block_cipher.h │ │ │ │ │ ├── botan.h │ │ │ │ │ ├── bswap.h │ │ │ │ │ ├── buf_comp.h │ │ │ │ │ ├── build.h │ │ │ │ │ ├── calendar.h │ │ │ │ │ ├── charset.h │ │ │ │ │ ├── compiler.h │ │ │ │ │ ├── cpuid.h │ │ │ │ │ ├── curve_nistp.h │ │ │ │ │ ├── data_src.h │ │ │ │ │ ├── database.h │ │ │ │ │ ├── der_enc.h │ │ │ │ │ ├── divide.h │ │ │ │ │ ├── eme.h │ │ │ │ │ ├── emsa.h │ │ │ │ │ ├── emsa_pkcs1.h │ │ │ │ │ ├── entropy_src.h │ │ │ │ │ ├── exceptn.h │ │ │ │ │ ├── hash.h │ │ │ │ │ ├── hash_id.h │ │ │ │ │ ├── hex.h │ │ │ │ │ ├── init.h │ │ │ │ │ ├── kdf.h │ │ │ │ │ ├── key_spec.h │ │ │ │ │ ├── keypair.h │ │ │ │ │ ├── loadstor.h │ │ │ │ │ ├── lookup.h │ │ │ │ │ ├── mac.h │ │ │ │ │ ├── mdx_hash.h │ │ │ │ │ ├── mem_ops.h │ │ │ │ │ ├── mgf1.h │ │ │ │ │ ├── monty.h │ │ │ │ │ ├── mul128.h │ │ │ │ │ ├── mutex.h │ │ │ │ │ ├── numthry.h │ │ │ │ │ ├── oids.h │ │ │ │ │ ├── parsing.h │ │ │ │ │ ├── pem.h │ │ │ │ │ ├── pk_algs.h │ │ │ │ │ ├── pk_keys.h │ │ │ │ │ ├── pk_ops.h │ │ │ │ │ ├── pk_ops_fwd.h │ │ │ │ │ ├── pkcs8.h │ │ │ │ │ ├── pow_mod.h │ │ │ │ │ ├── pssr.h │ │ │ │ │ ├── pubkey.h │ │ │ │ │ ├── reducer.h │ │ │ │ │ ├── rng.h │ │ │ │ │ ├── rotate.h │ │ │ │ │ ├── rsa.h │ │ │ │ │ ├── scan_name.h │ │ │ │ │ ├── secmem.h │ │ │ │ │ ├── sha2_32.h │ │ │ │ │ ├── stl_compatibility.h │ │ │ │ │ ├── sym_algo.h │ │ │ │ │ ├── symkey.h │ │ │ │ │ ├── system_rng.h │ │ │ │ │ ├── types.h │ │ │ │ │ ├── version.h │ │ │ │ │ ├── workfactor.h │ │ │ │ │ └── x509_key.h │ │ │ └── lib │ │ │ │ ├── libbotan-2.13.14.0.dylib │ │ │ │ ├── libbotan-2.13.dylib │ │ │ │ ├── libbotan-2.dylib │ │ │ │ └── pkgconfig │ │ │ │ ├── ._botan-2.pc │ │ │ │ └── botan-2.pc │ │ │ ├── win32 │ │ │ ├── include │ │ │ │ └── botan │ │ │ │ │ ├── aes.h │ │ │ │ │ ├── alg_id.h │ │ │ │ │ ├── asn1_attribute.h │ │ │ │ │ ├── asn1_obj.h │ │ │ │ │ ├── asn1_oid.h │ │ │ │ │ ├── asn1_print.h │ │ │ │ │ ├── asn1_str.h │ │ │ │ │ ├── asn1_time.h │ │ │ │ │ ├── assert.h │ │ │ │ │ ├── base64.h │ │ │ │ │ ├── ber_dec.h │ │ │ │ │ ├── bigint.h │ │ │ │ │ ├── blinding.h │ │ │ │ │ ├── block_cipher.h │ │ │ │ │ ├── botan.h │ │ │ │ │ ├── bswap.h │ │ │ │ │ ├── buf_comp.h │ │ │ │ │ ├── build.h │ │ │ │ │ ├── calendar.h │ │ │ │ │ ├── charset.h │ │ │ │ │ ├── compiler.h │ │ │ │ │ ├── cpuid.h │ │ │ │ │ ├── curve_nistp.h │ │ │ │ │ ├── data_src.h │ │ │ │ │ ├── database.h │ │ │ │ │ ├── der_enc.h │ │ │ │ │ ├── divide.h │ │ │ │ │ ├── dyn_load.h │ │ │ │ │ ├── eme.h │ │ │ │ │ ├── emsa.h │ │ │ │ │ ├── emsa_pkcs1.h │ │ │ │ │ ├── entropy_src.h │ │ │ │ │ ├── exceptn.h │ │ │ │ │ ├── hash.h │ │ │ │ │ ├── hash_id.h │ │ │ │ │ ├── hex.h │ │ │ │ │ ├── init.h │ │ │ │ │ ├── kdf.h │ │ │ │ │ ├── key_spec.h │ │ │ │ │ ├── keypair.h │ │ │ │ │ ├── loadstor.h │ │ │ │ │ ├── lookup.h │ │ │ │ │ ├── mac.h │ │ │ │ │ ├── mdx_hash.h │ │ │ │ │ ├── mem_ops.h │ │ │ │ │ ├── mgf1.h │ │ │ │ │ ├── monty.h │ │ │ │ │ ├── mul128.h │ │ │ │ │ ├── mutex.h │ │ │ │ │ ├── numthry.h │ │ │ │ │ ├── oids.h │ │ │ │ │ ├── parsing.h │ │ │ │ │ ├── pem.h │ │ │ │ │ ├── pk_algs.h │ │ │ │ │ ├── pk_keys.h │ │ │ │ │ ├── pk_ops.h │ │ │ │ │ ├── pk_ops_fwd.h │ │ │ │ │ ├── pkcs8.h │ │ │ │ │ ├── pow_mod.h │ │ │ │ │ ├── pssr.h │ │ │ │ │ ├── pubkey.h │ │ │ │ │ ├── reducer.h │ │ │ │ │ ├── rng.h │ │ │ │ │ ├── rotate.h │ │ │ │ │ ├── rsa.h │ │ │ │ │ ├── scan_name.h │ │ │ │ │ ├── secmem.h │ │ │ │ │ ├── sha2_32.h │ │ │ │ │ ├── stl_compatibility.h │ │ │ │ │ ├── sym_algo.h │ │ │ │ │ ├── symkey.h │ │ │ │ │ ├── system_rng.h │ │ │ │ │ ├── types.h │ │ │ │ │ ├── version.h │ │ │ │ │ ├── workfactor.h │ │ │ │ │ └── x509_key.h │ │ │ └── lib │ │ │ │ ├── botan.dll │ │ │ │ └── botan.lib │ │ │ └── win64 │ │ │ ├── include │ │ │ └── botan │ │ │ │ ├── aes.h │ │ │ │ ├── alg_id.h │ │ │ │ ├── asn1_attribute.h │ │ │ │ ├── asn1_obj.h │ │ │ │ ├── asn1_oid.h │ │ │ │ ├── asn1_print.h │ │ │ │ ├── asn1_str.h │ │ │ │ ├── asn1_time.h │ │ │ │ ├── assert.h │ │ │ │ ├── base64.h │ │ │ │ ├── ber_dec.h │ │ │ │ ├── bigint.h │ │ │ │ ├── blinding.h │ │ │ │ ├── block_cipher.h │ │ │ │ ├── botan.h │ │ │ │ ├── bswap.h │ │ │ │ ├── buf_comp.h │ │ │ │ ├── build.h │ │ │ │ ├── calendar.h │ │ │ │ ├── charset.h │ │ │ │ ├── compiler.h │ │ │ │ ├── cpuid.h │ │ │ │ ├── curve_nistp.h │ │ │ │ ├── data_src.h │ │ │ │ ├── database.h │ │ │ │ ├── der_enc.h │ │ │ │ ├── divide.h │ │ │ │ ├── dyn_load.h │ │ │ │ ├── eme.h │ │ │ │ ├── emsa.h │ │ │ │ ├── emsa_pkcs1.h │ │ │ │ ├── entropy_src.h │ │ │ │ ├── exceptn.h │ │ │ │ ├── hash.h │ │ │ │ ├── hash_id.h │ │ │ │ ├── hex.h │ │ │ │ ├── init.h │ │ │ │ ├── kdf.h │ │ │ │ ├── key_spec.h │ │ │ │ ├── keypair.h │ │ │ │ ├── loadstor.h │ │ │ │ ├── lookup.h │ │ │ │ ├── mac.h │ │ │ │ ├── mdx_hash.h │ │ │ │ ├── mem_ops.h │ │ │ │ ├── mgf1.h │ │ │ │ ├── monty.h │ │ │ │ ├── mul128.h │ │ │ │ ├── mutex.h │ │ │ │ ├── numthry.h │ │ │ │ ├── oids.h │ │ │ │ ├── parsing.h │ │ │ │ ├── pem.h │ │ │ │ ├── pk_algs.h │ │ │ │ ├── pk_keys.h │ │ │ │ ├── pk_ops.h │ │ │ │ ├── pk_ops_fwd.h │ │ │ │ ├── pkcs8.h │ │ │ │ ├── pow_mod.h │ │ │ │ ├── pssr.h │ │ │ │ ├── pubkey.h │ │ │ │ ├── reducer.h │ │ │ │ ├── rng.h │ │ │ │ ├── rotate.h │ │ │ │ ├── rsa.h │ │ │ │ ├── scan_name.h │ │ │ │ ├── secmem.h │ │ │ │ ├── sha2_32.h │ │ │ │ ├── stl_compatibility.h │ │ │ │ ├── sym_algo.h │ │ │ │ ├── symkey.h │ │ │ │ ├── system_rng.h │ │ │ │ ├── types.h │ │ │ │ ├── version.h │ │ │ │ ├── workfactor.h │ │ │ │ └── x509_key.h │ │ │ └── lib │ │ │ ├── botan.dll │ │ │ └── botan.lib │ ├── meta_object_ext.cpp │ ├── meta_object_ext.h │ ├── name_to_object_binder.h │ ├── qt_compat.cpp │ ├── qt_compat.h │ ├── string_utils.cpp │ ├── string_utils.h │ ├── unit_tests │ │ ├── botan_wrapper_tests.h │ │ ├── main_unit_tests.cpp │ │ └── string_utils_tests.h │ └── zd_shared_lib_global.h ├── zd_shared.pri └── zd_shared_lib.pro ├── zdownloader ├── data │ └── zdownloader.ini ├── src │ ├── app_settings.cpp │ ├── app_settings.h │ ├── cmd_runner.cpp │ ├── cmd_runner.h │ ├── fn_scheduler.cpp │ ├── fn_scheduler.h │ ├── main.cpp │ ├── settings │ │ ├── downloader_settings.cpp │ │ ├── downloader_settings.h │ │ ├── general_settings.cpp │ │ ├── general_settings.h │ │ ├── links_checker_settings.cpp │ │ ├── links_checker_settings.h │ │ ├── net_proxy_settings.cpp │ │ ├── net_proxy_settings.h │ │ ├── output_messages_settings.cpp │ │ ├── output_messages_settings.h │ │ ├── scheduler_settings.cpp │ │ ├── scheduler_settings.h │ │ ├── unpack_settings.cpp │ │ ├── unpack_settings.h │ │ ├── unpacklog_settings.cpp │ │ └── unpacklog_settings.h │ ├── unix_sigwatch.cpp │ ├── unix_sigwatch.h │ ├── unpack.cpp │ ├── unpack.h │ ├── win_sigwatch.cpp │ └── win_sigwatch.h └── zdownloader.pro └── zdownloader_net_lib ├── src ├── empty_cookie_jar.cpp ├── empty_cookie_jar.h ├── http │ ├── abstract_get_request.cpp │ ├── abstract_get_request.h │ ├── abstract_http_request.cpp │ ├── abstract_http_request.h │ ├── abstract_post_request.cpp │ ├── abstract_post_request.h │ ├── del_request.cpp │ ├── del_request.h │ ├── dl_item_downloader.cpp │ ├── dl_item_downloader.h │ ├── download_item_updater.cpp │ ├── download_item_updater.h │ ├── download_manager.cpp │ ├── download_manager.h │ ├── file_downloader2.cpp │ ├── file_downloader2.h │ ├── gdrive │ │ ├── gdrive_api.cpp │ │ ├── gdrive_api.h │ │ ├── gdrive_file.cpp │ │ ├── gdrive_file.h │ │ ├── gdrive_service.cpp │ │ └── gdrive_service.h │ ├── get_request.cpp │ ├── get_request.h │ ├── head_downloader.cpp │ ├── head_downloader.h │ ├── html_downloader.cpp │ ├── html_downloader.h │ ├── link_manager.cpp │ ├── link_manager.h │ ├── megaup │ │ ├── megaup_link_extractor.cpp │ │ ├── megaup_link_extractor.h │ │ ├── megaup_service.cpp │ │ └── megaup_service.h │ ├── multi_link_checker.cpp │ ├── multi_link_checker.h │ ├── options_downloader.cpp │ ├── options_downloader.h │ ├── post_request.cpp │ ├── post_request.h │ ├── pre_post_job.cpp │ ├── pre_post_job.h │ ├── segment_calculator.cpp │ ├── segment_calculator.h │ ├── segmented_file_downloader.cpp │ ├── segmented_file_downloader.h │ ├── service.cpp │ ├── service.h │ ├── web_config.cpp │ ├── web_config.h │ └── zippyshare │ │ ├── zippy_link_extractor.cpp │ │ ├── zippy_link_extractor.h │ │ ├── zippy_service.cpp │ │ └── zippy_service.h ├── logged_nam.cpp ├── logged_nam.h ├── model │ ├── download_item.cpp │ ├── download_item.h │ ├── downloadable_items.cpp │ ├── downloadable_items.h │ ├── links_queue.cpp │ ├── links_queue.h │ ├── segment_metadata.cpp │ └── segment_metadata.h ├── net_thread.cpp ├── net_thread.h ├── settings │ ├── finished_downloads_settings.cpp │ ├── finished_downloads_settings.h │ ├── gdrive_settings.cpp │ └── gdrive_settings.h ├── unit_tests │ ├── http │ │ ├── gdrive │ │ │ ├── gdrive_api_tests.h │ │ │ └── gdrive_service_tests.h │ │ ├── link_manager_tests.h │ │ ├── segment_calculator_tests.h │ │ └── zippy_link_extractor_tests.h │ ├── main_unit_tests.cpp │ ├── model │ │ └── downloadable_items_tests.h │ └── utils │ │ ├── archive_filename_comparator_tests.h │ │ └── jwt_tests.h ├── utils │ ├── archive_filename_comparator.cpp │ ├── archive_filename_comparator.h │ ├── jwt.cpp │ └── jwt.h ├── zdownloader_net_lib.cpp ├── zdownloader_net_lib.h └── zdownloader_net_lib_global.h └── zdownloader_net_lib.pro /.gitignore: -------------------------------------------------------------------------------- 1 | # This file is used to ignore files which are generated 2 | # ---------------------------------------------------------------------------- 3 | 4 | *~ 5 | *.autosave 6 | *.a 7 | *.core 8 | *.moc 9 | *.o 10 | *.obj 11 | *.orig 12 | *.rej 13 | *_pch.h.cpp 14 | *_resource.rc 15 | *.qm 16 | .#* 17 | *.*# 18 | core 19 | !core/ 20 | tags 21 | .DS_Store 22 | .directory 23 | *.debug 24 | Makefile* 25 | *.prl 26 | *.app 27 | moc_*.cpp 28 | ui_*.h 29 | qrc_*.cpp 30 | Thumbs.db 31 | *.res 32 | *.rc 33 | /.qmake.cache 34 | /.qmake.stash 35 | 36 | # qtcreator generated files 37 | *.pro.user* 38 | moc_predefs.h 39 | 40 | # xemacs temporary files 41 | *.flc 42 | 43 | # Vim temporary files 44 | .*.swp 45 | 46 | # Visual Studio generated files 47 | *.ib_pdb_index 48 | *.idb 49 | *.ilk 50 | *.pdb 51 | *.sln 52 | *.suo 53 | *.vcproj 54 | *vcproj.*.*.user 55 | *.ncb 56 | *.sdf 57 | *.opensdf 58 | *.vcxproj 59 | *vcxproj.* 60 | 61 | # MinGW generated files 62 | *.Debug 63 | *.Release 64 | 65 | # Python byte code 66 | *.pyc 67 | 68 | # Binaries 69 | # -------- 70 | *.exe 71 | 72 | bin_debug/ 73 | bin_release/ 74 | -------------------------------------------------------------------------------- /HOWTO_gdrive_service_account.md: -------------------------------------------------------------------------------- 1 | ## How to enable google drive api and create google service account 2 | 3 | 1. Log in to google account. 4 | 2. Go to https://console.developers.google.com 5 | 2.1 Click "Select a project" and click "NEW PROJECT". 6 | ![screenshot](https://github.com/sin2000/zdownloader/blob/master/images/google01.png) 7 | 2.2 Enter project name 'zdproj' and click "Create". 8 | ![screenshot](https://github.com/sin2000/zdownloader/blob/master/images/google02.png) 9 | 10 | 3. Go to https://console.developers.google.com/apis/library?project=zdproj&supportedpurview=project 11 | 3.1 Search for google drive and click "Google Drive API" from search results. 12 | ![screenshot](https://github.com/sin2000/zdownloader/blob/master/images/google03.png) 13 | 3.2 Click "ENABLE". 14 | ![screenshot](https://github.com/sin2000/zdownloader/blob/master/images/google04.png) 15 | 16 | 4. Go to https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project=zdproj&supportedpurview=project 17 | 4.1 Click "CREATE CREDENTIALS" button. 18 | ![screenshot](https://github.com/sin2000/zdownloader/blob/master/images/google05.png) 19 | 4.2 On form select "Google Drive API", "Other non-UI (e.g. cron job, daemon)", "Application data", "No, I'm not using them". See image below. 20 | ![screenshot](https://github.com/sin2000/zdownloader/blob/master/images/google06.png) 21 | 4.3 Click "What credentials do I need?" button. 22 | 23 | 5. On next page set "Service account name" to "zd" and choose "Editor" in "Role"(Project->Editor). 24 | Make sure that "JSON" is selected as "Key type". 25 | ![screenshot](https://github.com/sin2000/zdownloader/blob/master/images/google07.png) 26 | 27 | 6. Click "Continue" button. JSON file will be downloaded with service account credentials. 28 | Save it near to zdownloader location and update google_service_account_json_file= in zdownloader.ini file. 29 | ![screenshot](https://github.com/sin2000/zdownloader/blob/master/images/google08.png) 30 | -------------------------------------------------------------------------------- /images/empty.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /images/google01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/images/google01.png -------------------------------------------------------------------------------- /images/google02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/images/google02.png -------------------------------------------------------------------------------- /images/google03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/images/google03.png -------------------------------------------------------------------------------- /images/google04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/images/google04.png -------------------------------------------------------------------------------- /images/google05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/images/google05.png -------------------------------------------------------------------------------- /images/google06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/images/google06.png -------------------------------------------------------------------------------- /images/google07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/images/google07.png -------------------------------------------------------------------------------- /images/google08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/images/google08.png -------------------------------------------------------------------------------- /images/qtcreator_disable_shadow_build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/images/qtcreator_disable_shadow_build.png -------------------------------------------------------------------------------- /images/zd_running_pub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/images/zd_running_pub.png -------------------------------------------------------------------------------- /src.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS = src 3 | src.file = src/zd.pro 4 | -------------------------------------------------------------------------------- /src/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 sin2000 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /src/zd.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS = zd_shared_lib \ 3 | zd_logger_lib \ 4 | zdownloader_net_lib \ 5 | zdownloader 6 | 7 | CONFIG += ordered 8 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/private/app_logger.h: -------------------------------------------------------------------------------- 1 | #ifndef APP_LOGGER_H 2 | #define APP_LOGGER_H 3 | 4 | #include 5 | #include 6 | 7 | class file_logger; 8 | class msg_log_context; 9 | class debug_logger; 10 | class botan_wrapper; 11 | 12 | class app_logger : public QObject 13 | { 14 | Q_OBJECT 15 | public: 16 | app_logger(QObject * parent = nullptr); 17 | ~app_logger(); 18 | 19 | void enable_filelog(const QString & dir_path, const QString & enc_pass, const QByteArray & rsa_public_key, 20 | const QString & timestamp_format_str, int max_rotate_bytes, int max_archive_files); 21 | void enable_debuglog(); 22 | 23 | void log_msg(const msg_log_context & ctx); 24 | 25 | private: 26 | QString format_msg(const msg_log_context & ctx) const; 27 | QString msg_type_to_string(QtMsgType type) const; 28 | void log_text_and_handle_rotate(const QByteArray & text); 29 | 30 | QString timestamp_format; 31 | file_logger * flog; 32 | debug_logger * dlog; 33 | }; 34 | 35 | #endif // APP_LOGGER_H 36 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/private/debug_logger.cpp: -------------------------------------------------------------------------------- 1 | #include "debug_logger.h" 2 | #include 3 | #include 4 | #include 5 | 6 | void debug_logger::log_msg(const QString & msg) const 7 | { 8 | static QTextStream qts(stdout); 9 | 10 | qts << msg << qt_compat::endl; 11 | } 12 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/private/debug_logger.h: -------------------------------------------------------------------------------- 1 | #ifndef DEBUG_LOGGER_H 2 | #define DEBUG_LOGGER_H 3 | 4 | class QString; 5 | 6 | class debug_logger 7 | { 8 | public: 9 | void log_msg(const QString & msg) const; 10 | }; 11 | 12 | #endif // DEBUG_LOGGER_H 13 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/private/file_logger.h: -------------------------------------------------------------------------------- 1 | #ifndef FILE_LOGGER_H 2 | #define FILE_LOGGER_H 3 | 4 | #include "../zd_logger_global.h" 5 | #include 6 | 7 | class QFile; 8 | class msg_log_context; 9 | class QLockFile; 10 | 11 | class ZD_LOGGERSHARED_EXPORT file_logger 12 | { 13 | public: 14 | file_logger(const QString & name = "", bool use_lock_file = false, bool use_qdebug = true); 15 | virtual ~file_logger(); 16 | 17 | void set_directory_path(const QString & directory_path); 18 | QString get_filename_from_pattern(int arch_counter, bool alt_name = false); 19 | void set_filename_pattern(const QString & filename_pattern); 20 | void set_max_rotate_bytes(int bytes); 21 | void set_max_archive_files(int max_files); 22 | bool open_log(); 23 | void close_log(); 24 | bool rotate_log(); // returns true if log was rotated 25 | void save_log(const QByteArray & text, bool flush = true, bool * log_rotated = nullptr); 26 | void save_log(const QString & text, bool flush = true); 27 | bool is_valid() const; 28 | QByteArray read_first_line() const; 29 | qint64 get_current_log_size() const; 30 | 31 | private: 32 | QString dir_path; 33 | QString fn_pattern; 34 | QFile * cur_log_file; 35 | QLockFile * lock_file; 36 | bool enabled_lock_file; 37 | bool enabled_qdebug; 38 | 39 | static const QString archive_placeholder; 40 | int max_archive_files; 41 | int max_rotate_bytes; 42 | }; 43 | 44 | #endif // FILE_LOGGER_H 45 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/private/io_thread.cpp: -------------------------------------------------------------------------------- 1 | #include "io_thread.h" 2 | #include "app_logger.h" 3 | #include "text_logger_manager.h" 4 | #include 5 | 6 | io_thread::io_thread() 7 | { 8 | app_log = new app_logger(); 9 | app_log->moveToThread(this); 10 | text_log_mgr = new text_logger_manager(this); 11 | } 12 | 13 | io_thread::~io_thread() 14 | { 15 | if(isRunning()) 16 | { 17 | quit(); 18 | wait(); 19 | } 20 | 21 | delete text_log_mgr; 22 | delete app_log; 23 | text_log_mgr = nullptr; 24 | app_log = nullptr; 25 | } 26 | 27 | void io_thread::run() 28 | { 29 | emit init_finished(); 30 | exec(); 31 | QCoreApplication::processEvents(); 32 | } 33 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/private/io_thread.h: -------------------------------------------------------------------------------- 1 | #ifndef IO_THREAD_H 2 | #define IO_THREAD_H 3 | 4 | #include "../zd_logger_global.h" 5 | #include 6 | 7 | class app_logger; 8 | class text_logger_manager; 9 | 10 | class ZD_LOGGERSHARED_EXPORT io_thread : public QThread 11 | { 12 | Q_OBJECT 13 | public: 14 | io_thread(); 15 | ~io_thread(); 16 | 17 | app_logger * app_log; 18 | text_logger_manager * text_log_mgr; 19 | 20 | signals: 21 | void init_finished(); 22 | 23 | protected: 24 | void run(); 25 | }; 26 | 27 | #endif // IO_THREAD_H 28 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/private/msg_log_context.h: -------------------------------------------------------------------------------- 1 | #ifndef MSG_LOG_CONTEXT_H 2 | #define MSG_LOG_CONTEXT_H 3 | 4 | #include 5 | #include 6 | 7 | class msg_log_context 8 | { 9 | public: 10 | qint64 timestamp_msecs; // since epoch 11 | QtMsgType msg_type; 12 | QString category; 13 | QString file; 14 | QString function; 15 | int line; 16 | int version; 17 | QString msg; // text of message 18 | }; 19 | 20 | //Q_DECLARE_METATYPE(msg_log_context) 21 | 22 | #endif // MSG_LOG_CONTEXT_H 23 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/private/text_file_logger.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXT_FILE_LOGGER_H 2 | #define TEXT_FILE_LOGGER_H 3 | 4 | #include "file_logger.h" 5 | #include 6 | 7 | class ZD_LOGGERSHARED_EXPORT text_file_logger : public QObject, protected file_logger 8 | { 9 | public: 10 | text_file_logger(const QString & name); 11 | 12 | void invoke_set_rotate_settings(int max_archive_file_count, int rotate_after_bytes); 13 | void invoke_set_timestamp_format(const QString & new_timestamp_format); 14 | void invoke_enable(const QString & directory_path, const QString & filename, bool write_open_msg); 15 | void invoke_disable(bool write_close_msg); 16 | void invoke_log_text(qint64 timestamp_msecs, const QString & raw_text, const QString & log_type = "I"); 17 | 18 | private: 19 | void set_rotate_settings(int max_archive_file_count, int rotate_after_bytes); 20 | void set_timestamp_format(const QString & new_timestamp_format); 21 | void enable(const QString & directory_path, const QString & filename, bool write_open_msg); 22 | void disable(bool write_close_message); 23 | void log_text(qint64 timestamp_msecs, const QString & raw_text, const QString & log_type = "I"); 24 | QString format_log_text(qint64 timestamp_msecs, const QString & raw_text, const QString & log_type) const; 25 | 26 | QString timestamp_format; 27 | }; 28 | 29 | #endif // TEXT_FILE_LOGGER_H 30 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/private/text_logger_manager.cpp: -------------------------------------------------------------------------------- 1 | #include "text_logger_manager.h" 2 | 3 | text_logger_manager::text_logger_manager(QThread * thread) 4 | :name_to_object_binder(thread) 5 | { 6 | } 7 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/private/text_logger_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXT_LOGGER_MANAGER_H 2 | #define TEXT_LOGGER_MANAGER_H 3 | 4 | #include "text_file_logger.h" 5 | #include 6 | 7 | class ZD_LOGGERSHARED_EXPORT text_logger_manager : public name_to_object_binder 8 | { 9 | public: 10 | text_logger_manager(QThread * thread); 11 | }; 12 | 13 | #endif // TEXT_LOGGER_MANAGER_H 14 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/qdebugex.h: -------------------------------------------------------------------------------- 1 | #ifndef QDEBUGEX_H 2 | #define QDEBUGEX_H 3 | 4 | #include 5 | #undef qDebug 6 | #define qDebug QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).debug().noquote 7 | 8 | #endif // QDEBUGEX_H 9 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/unit_tests/main_unit_tests.cpp: -------------------------------------------------------------------------------- 1 | //#include "AutoTest.h" 2 | 3 | //TEST_MAIN 4 | 5 | #include "zd_logger_tests.h" 6 | #include "private/file_logger_tests.h" 7 | #include 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | QCoreApplication app(argc, argv); 12 | 13 | int status = 0; 14 | { 15 | zd_logger_tests tc; 16 | status |= QTest::qExec(&tc, argc, argv); 17 | } 18 | 19 | { 20 | file_logger_tests tc; 21 | status |= QTest::qExec(&tc, argc, argv); 22 | } 23 | 24 | return status; 25 | } 26 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/unit_tests/zd_logger_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef ZD_LOGGER_TESTS_H 2 | #define ZD_LOGGER_TESTS_H 3 | 4 | #include "zd_logger.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | class zd_logger_tests : public QObject 11 | { 12 | Q_OBJECT 13 | 14 | private slots: 15 | void test_case() 16 | { 17 | zd_logger::inst().install_logger("./"); 18 | 19 | qDebug() << "dupa"; 20 | qDebug() << "dupa2"; 21 | qDebug() << "dupa3"; 22 | 23 | zd_logger::inst().uninstall_logger(); 24 | 25 | QCOMPARE("a", "a"); 26 | } 27 | }; 28 | 29 | #endif // ZD_LOGGER_TESTS_H 30 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/zd_logger.h: -------------------------------------------------------------------------------- 1 | #ifndef ZD_LOGGER_H 2 | #define ZD_LOGGER_H 3 | 4 | #include "zd_logger_global.h" 5 | #include "private/io_thread.h" 6 | #include "private/file_logger.h" 7 | #include "private/text_logger_manager.h" 8 | 9 | class io_thread; 10 | 11 | class ZD_LOGGERSHARED_EXPORT zd_logger : public io_thread 12 | { 13 | public: 14 | static zd_logger & inst(); 15 | static void delete_this(); 16 | 17 | // if log_directory_path is not empty open log file and redirect qDebug etc 18 | void install_logger(const QString & log_directory_path, const QString & timestamp_format, bool enable_debug_logger = true, 19 | const QString & encryption_password = "", const QByteArray & rsa_pubkey = "", 20 | int max_rotate_bytes = 4 * 1024 * 1024, int max_archive_files = 3); 21 | void uninstall_logger(); 22 | 23 | private: 24 | zd_logger() {} 25 | ~zd_logger(); 26 | zd_logger(zd_logger const &); 27 | void operator=(zd_logger const &); 28 | 29 | static void qt_log_msg_handler(QtMsgType type, const QMessageLogContext & context, const QString & msg); 30 | }; 31 | 32 | #endif // ZD_LOGGER_H 33 | -------------------------------------------------------------------------------- /src/zd_logger_lib/src/zd_logger_global.h: -------------------------------------------------------------------------------- 1 | #ifndef ZD_LOGGER_GLOBAL_H 2 | #define ZD_LOGGER_GLOBAL_H 3 | 4 | #include 5 | 6 | #ifndef ZD_STATIC_LINKAGE 7 | #if defined(UNIT_TEST) && defined(ZD_LOGGER_LIBRARY) 8 | #define ZD_LOGGERSHARED_EXPORT 9 | #else 10 | #ifdef ZD_LOGGER_LIBRARY 11 | #define ZD_LOGGERSHARED_EXPORT Q_DECL_EXPORT 12 | #else 13 | #define ZD_LOGGERSHARED_EXPORT Q_DECL_IMPORT 14 | #endif 15 | #endif 16 | #else 17 | #define ZD_LOGGERSHARED_EXPORT 18 | #endif 19 | 20 | #endif // ZD_LOGGER_GLOBAL_H 21 | -------------------------------------------------------------------------------- /src/zd_logger_lib/zd_logger_lib.pro: -------------------------------------------------------------------------------- 1 | # Configuration directives: 2 | # UNIT_TEST - indicates unit test mode 3 | 4 | include(../zd_shared_lib/zd_shared.pri) 5 | 6 | DEFINES += ZD_LOGGER_LIBRARY 7 | 8 | QT -= gui 9 | 10 | CONFIG(debug, debug|release) { 11 | TARGET = zd_logger_libd 12 | } 13 | else { 14 | TARGET = zd_logger_lib 15 | } 16 | 17 | TEMPLATE = lib 18 | 19 | # ZD SHARED LIBRARY ========================================================================================= 20 | CONFIG(release, debug|release): LIBS += -L$$PWD/../zd_shared_lib/bin_release/ -lzd_shared_lib 21 | else:CONFIG(debug, debug|release): LIBS += -L$$PWD/../zd_shared_lib/bin_debug/ -lzd_shared_libd 22 | 23 | INCLUDEPATH += $$PWD/../zd_shared_lib/src 24 | DEPENDPATH += $$PWD/../zd_shared_lib/src 25 | # ZD SHARED LIBRARY END ===================================================================================== 26 | 27 | INCLUDEPATH += ./src 28 | 29 | SOURCES += \ 30 | src/zd_logger.cpp \ 31 | src/private/file_logger.cpp \ 32 | src/private/io_thread.cpp \ 33 | src/private/app_logger.cpp \ 34 | src/private/debug_logger.cpp \ 35 | src/private/text_file_logger.cpp \ 36 | src/private/text_logger_manager.cpp 37 | 38 | HEADERS += \ 39 | src/zd_logger.h \ 40 | src/zd_logger_global.h \ 41 | src/private/file_logger.h \ 42 | src/private/msg_log_context.h \ 43 | src/private/io_thread.h \ 44 | src/private/app_logger.h \ 45 | src/private/debug_logger.h \ 46 | src/private/text_file_logger.h \ 47 | src/private/text_logger_manager.h \ 48 | src/qdebugex.h 49 | 50 | unit_test { 51 | message("UnitTest MODE ENABLED") 52 | 53 | QT += testlib 54 | TEMPLATE = app 55 | 56 | DEFINES += UNIT_TEST 57 | HEADERS += \ 58 | src/unit_tests/*.h \ 59 | src/unit_tests/private/*.h 60 | 61 | SOURCES += src/unit_tests/*.cpp 62 | } 63 | else { 64 | zd_static_linkage { 65 | CONFIG += staticlib 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/botan_wrapper.cpp: -------------------------------------------------------------------------------- 1 | #include "botan_wrapper.h" 2 | #include "botan_wrapper_private.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | botan_wrapper::botan_wrapper() 11 | :priv(new botan_wrapper_private) 12 | { 13 | } 14 | 15 | botan_wrapper::~botan_wrapper() 16 | { 17 | delete priv; 18 | } 19 | 20 | void botan_wrapper::rsa_sign(const QByteArray & input_data, const QString & privkey_pem, QByteArray * sign_b64_url) const 21 | { 22 | std::string label = ""; 23 | std::vector data(input_data.begin(), input_data.end()); 24 | 25 | try 26 | { 27 | auto decoded = Botan::PEM_Code::decode(privkey_pem.toStdString(), label); 28 | Botan::DataSource_Memory memkey(decoded); 29 | 30 | std::unique_ptr pk(Botan::PKCS8::load_key(memkey, *priv->get_rng())); 31 | Botan::PK_Signer signer(*pk, *priv->get_rng(), "EMSA3(SHA-256)"); 32 | signer.update(data); 33 | const std::vector sign_vec = signer.signature(*priv->get_rng()); 34 | 35 | *sign_b64_url = QByteArray(reinterpret_cast(sign_vec.data()), static_cast(sign_vec.size())); 36 | *sign_b64_url = sign_b64_url->toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals); 37 | } 38 | catch(const Botan::Exception & ex) 39 | { 40 | qDebug() << "exception: " << ex.what(); 41 | *sign_b64_url = QByteArray(); 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/botan_wrapper.h: -------------------------------------------------------------------------------- 1 | #ifndef BOTAN_WRAPPER_H 2 | #define BOTAN_WRAPPER_H 3 | 4 | #include "zd_shared_lib_global.h" 5 | 6 | class QByteArray; 7 | class botan_wrapper_private; 8 | 9 | class ZD_SHARED_LIB_EXPORT botan_wrapper 10 | { 11 | public: 12 | botan_wrapper(); 13 | ~botan_wrapper(); 14 | 15 | void rsa_sign(const QByteArray & input_data, const QString & privkey_pem, QByteArray * sign_b64_url) const; 16 | 17 | private: 18 | botan_wrapper_private * priv; 19 | }; 20 | 21 | #endif // BOTAN_WRAPPER_H 22 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/botan_wrapper_private.cpp: -------------------------------------------------------------------------------- 1 | #include "botan_wrapper_private.h" 2 | #include 3 | 4 | botan_wrapper_private::botan_wrapper_private() 5 | :rng(new Botan::System_RNG) 6 | { 7 | } 8 | 9 | botan_wrapper_private::~botan_wrapper_private() 10 | { 11 | delete rng; 12 | } 13 | 14 | Botan::RandomNumberGenerator * botan_wrapper_private::get_rng() const 15 | { 16 | return rng; 17 | } 18 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/botan_wrapper_private.h: -------------------------------------------------------------------------------- 1 | #ifndef BOTAN_WRAPPER_PRIVATE_H 2 | #define BOTAN_WRAPPER_PRIVATE_H 3 | 4 | #include 5 | #include 6 | 7 | class QByteArray; 8 | 9 | class botan_wrapper_private 10 | { 11 | public: 12 | botan_wrapper_private(); 13 | ~botan_wrapper_private(); 14 | 15 | Botan::RandomNumberGenerator * get_rng() const; 16 | 17 | private: 18 | Botan::RandomNumberGenerator * rng; 19 | }; 20 | 21 | #endif // BOTAN_WRAPPER_PRIVATE_H 22 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/increasing_timer.cpp: -------------------------------------------------------------------------------- 1 | #include "increasing_timer.h" 2 | #include 3 | #include 4 | 5 | increasing_timer::increasing_timer(QObject * parent) 6 | :QObject(parent), 7 | timer(new QTimer(this)), 8 | reset_timer(new QElapsedTimer), 9 | increase_from_msec(0), 10 | increase_to_msec(0), 11 | increase_step_msec(1000), 12 | reset_after_msec(0), 13 | interval_msec(0) 14 | { 15 | timer->setSingleShot(true); 16 | 17 | connect(timer, &QTimer::timeout, this, &increasing_timer::timeout); 18 | } 19 | 20 | increasing_timer::~increasing_timer() 21 | { 22 | delete reset_timer; 23 | } 24 | 25 | void increasing_timer::set_increase_range(int from_msec, int to_msec) 26 | { 27 | increase_from_msec = from_msec; 28 | increase_to_msec = to_msec; 29 | } 30 | 31 | void increasing_timer::set_reset_after(int msec) 32 | { 33 | reset_after_msec = msec; 34 | } 35 | 36 | void increasing_timer::set_increase_step(int msec) 37 | { 38 | increase_step_msec = msec; 39 | } 40 | 41 | int increasing_timer::start() 42 | { 43 | if(reset_timer->isValid() == false) 44 | { 45 | interval_msec = increase_from_msec; 46 | } 47 | else 48 | { 49 | if(reset_timer->hasExpired(reset_after_msec)) 50 | { 51 | interval_msec = increase_from_msec; 52 | } 53 | else 54 | { 55 | if(interval_msec < increase_to_msec) 56 | interval_msec += increase_step_msec; 57 | } 58 | } 59 | 60 | reset_timer->start(); 61 | timer->start(interval_msec); 62 | 63 | return interval_msec; 64 | } 65 | 66 | int increasing_timer::start(int msec) 67 | { 68 | timer->start(msec); 69 | 70 | return msec; 71 | } 72 | 73 | void increasing_timer::stop() 74 | { 75 | reset_timer->invalidate(); 76 | timer->stop(); 77 | } 78 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/increasing_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef INCREASING_TIMER_H 2 | #define INCREASING_TIMER_H 3 | 4 | #include "zd_shared_lib_global.h" 5 | #include 6 | 7 | class QTimer; 8 | class QElapsedTimer; 9 | 10 | class ZD_SHARED_LIB_EXPORT increasing_timer : public QObject 11 | { 12 | Q_OBJECT 13 | public: 14 | increasing_timer(QObject * parent = nullptr); 15 | ~increasing_timer(); 16 | void set_increase_range(int from_msec, int to_msec); 17 | void set_reset_after(int msec); 18 | void set_increase_step(int msec); 19 | int start(); 20 | int start(int msec); 21 | void stop(); 22 | 23 | signals: 24 | void timeout(); 25 | 26 | private: 27 | QTimer * timer; 28 | QElapsedTimer * reset_timer; 29 | int increase_from_msec; 30 | int increase_to_msec; 31 | int increase_step_msec; 32 | int reset_after_msec; 33 | int interval_msec; 34 | }; 35 | 36 | #endif // INCREASING_TIMER_H 37 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/include/botan/alg_id.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Algorithm Identifier 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ALGORITHM_IDENTIFIER_H_ 9 | #define BOTAN_ALGORITHM_IDENTIFIER_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Botan { 17 | 18 | /** 19 | * Algorithm Identifier 20 | */ 21 | class BOTAN_PUBLIC_API(2,0) AlgorithmIdentifier final : public ASN1_Object 22 | { 23 | public: 24 | enum Encoding_Option { USE_NULL_PARAM, USE_EMPTY_PARAM }; 25 | 26 | void encode_into(class DER_Encoder&) const override; 27 | void decode_from(class BER_Decoder&) override; 28 | 29 | AlgorithmIdentifier() = default; 30 | 31 | AlgorithmIdentifier(const OID& oid, Encoding_Option enc); 32 | AlgorithmIdentifier(const std::string& oid_name, Encoding_Option enc); 33 | 34 | AlgorithmIdentifier(const OID& oid, const std::vector& params); 35 | AlgorithmIdentifier(const std::string& oid_name, const std::vector& params); 36 | 37 | const OID& get_oid() const { return oid; } 38 | const std::vector& get_parameters() const { return parameters; } 39 | 40 | BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES: 41 | /* 42 | * These values are public for historical reasons, but in a future release 43 | * they will be made private. Do not access them. 44 | */ 45 | OID oid; 46 | std::vector parameters; 47 | }; 48 | 49 | /* 50 | * Comparison Operations 51 | */ 52 | bool BOTAN_PUBLIC_API(2,0) operator==(const AlgorithmIdentifier&, 53 | const AlgorithmIdentifier&); 54 | bool BOTAN_PUBLIC_API(2,0) operator!=(const AlgorithmIdentifier&, 55 | const AlgorithmIdentifier&); 56 | 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/include/botan/asn1_attribute.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASN.1 Attribute 3 | * (C) 1999-2007,2012 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ASN1_ATTRIBUTE_H_ 9 | #define BOTAN_ASN1_ATTRIBUTE_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Botan { 16 | 17 | /** 18 | * Attribute 19 | */ 20 | class BOTAN_PUBLIC_API(2,0) Attribute final : public ASN1_Object 21 | { 22 | public: 23 | void encode_into(class DER_Encoder& to) const override; 24 | void decode_from(class BER_Decoder& from) override; 25 | 26 | Attribute() = default; 27 | Attribute(const OID&, const std::vector&); 28 | Attribute(const std::string&, const std::vector&); 29 | 30 | const OID& get_oid() const { return oid; } 31 | 32 | const std::vector& get_parameters() const { return parameters; } 33 | 34 | BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES: 35 | /* 36 | * These values are public for historical reasons, but in a future release 37 | * they will be made private. Do not access them. 38 | */ 39 | OID oid; 40 | std::vector parameters; 41 | }; 42 | 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/include/botan/asn1_str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASN.1 string type 3 | * (C) 1999-2010 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ASN1_STRING_H_ 9 | #define BOTAN_ASN1_STRING_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * ASN.1 string type 17 | * This class normalizes all inputs to a UTF-8 std::string 18 | */ 19 | class BOTAN_PUBLIC_API(2,0) ASN1_String final : public ASN1_Object 20 | { 21 | public: 22 | void encode_into(class DER_Encoder&) const override; 23 | void decode_from(class BER_Decoder&) override; 24 | 25 | ASN1_Tag tagging() const { return m_tag; } 26 | 27 | const std::string& value() const { return m_utf8_str; } 28 | 29 | size_t size() const { return value().size(); } 30 | 31 | bool empty() const { return m_utf8_str.empty(); } 32 | 33 | std::string BOTAN_DEPRECATED("Use value() to get UTF-8 string instead") 34 | iso_8859() const; 35 | 36 | /** 37 | * Return true iff this is a tag for a known string type we can handle. 38 | * This ignores string types that are not supported, eg teletexString 39 | */ 40 | static bool is_string_type(ASN1_Tag tag); 41 | 42 | bool operator==(const ASN1_String& other) const 43 | { return value() == other.value(); } 44 | 45 | explicit ASN1_String(const std::string& utf8 = ""); 46 | ASN1_String(const std::string& utf8, ASN1_Tag tag); 47 | private: 48 | std::vector m_data; 49 | std::string m_utf8_str; 50 | ASN1_Tag m_tag; 51 | }; 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/include/botan/botan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A vague catch all include file for Botan 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_BOTAN_H_ 9 | #define BOTAN_BOTAN_H_ 10 | 11 | /* 12 | * There is no real reason for this header to exist beyond historical 13 | * reasons. The application should instead include the specific header 14 | * files that define the interfaces it intends to use. 15 | * 16 | * This header file will be removed in Botan 3.x 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #if defined(BOTAN_HAS_AUTO_SEEDING_RNG) 27 | #include 28 | #endif 29 | 30 | #if defined(BOTAN_HAS_FILTERS) 31 | #include 32 | #endif 33 | 34 | #if defined(BOTAN_HAS_PUBLIC_KEY_CRYPTO) 35 | #include 36 | #include 37 | #endif 38 | 39 | BOTAN_DEPRECATED_HEADER(botan.h) 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/include/botan/curve_nistp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Arithmetic operations specialized for NIST ECC primes 3 | * (C) 2014,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_NIST_PRIMES_H_ 9 | #define BOTAN_NIST_PRIMES_H_ 10 | 11 | #include 12 | 13 | BOTAN_FUTURE_INTERNAL_HEADER(curve_nistp.h) 14 | 15 | namespace Botan { 16 | 17 | /** 18 | * NIST Prime reduction functions. 19 | * 20 | * Reduces the value in place 21 | * 22 | * ws is a workspace function which is used as a temporary, 23 | * and will be resized as needed. 24 | */ 25 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p521(); 26 | BOTAN_PUBLIC_API(2,0) void redc_p521(BigInt& x, secure_vector& ws); 27 | 28 | /* 29 | Previously this macro indicated if the P-{192,224,256,384} reducers 30 | were available. Now they are always enabled and this macro has no meaning. 31 | The define will be removed in a future major release. 32 | */ 33 | #define BOTAN_HAS_NIST_PRIME_REDUCERS_W32 34 | 35 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p384(); 36 | BOTAN_PUBLIC_API(2,0) void redc_p384(BigInt& x, secure_vector& ws); 37 | 38 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p256(); 39 | BOTAN_PUBLIC_API(2,0) void redc_p256(BigInt& x, secure_vector& ws); 40 | 41 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p224(); 42 | BOTAN_PUBLIC_API(2,0) void redc_p224(BigInt& x, secure_vector& ws); 43 | 44 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p192(); 45 | BOTAN_PUBLIC_API(2,0) void redc_p192(BigInt& x, secure_vector& ws); 46 | 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/include/botan/hash_id.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hash Function Identification 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_HASHID_H_ 9 | #define BOTAN_HASHID_H_ 10 | 11 | #include 12 | #include 13 | 14 | namespace Botan { 15 | 16 | /** 17 | * Return the PKCS #1 hash identifier 18 | * @see RFC 3447 section 9.2 19 | * @param hash_name the name of the hash function 20 | * @return uint8_t sequence identifying the hash 21 | * @throw Invalid_Argument if the hash has no known PKCS #1 hash id 22 | */ 23 | BOTAN_PUBLIC_API(2,0) std::vector pkcs_hash_id(const std::string& hash_name); 24 | 25 | /** 26 | * Return the IEEE 1363 hash identifier 27 | * @param hash_name the name of the hash function 28 | * @return uint8_t code identifying the hash, or 0 if not known 29 | */ 30 | BOTAN_PUBLIC_API(2,0) uint8_t ieee1363_hash_id(const std::string& hash_name); 31 | 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/include/botan/init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Library Initialization 3 | * (C) 1999-2008,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_LIBRARY_INITIALIZER_H_ 9 | #define BOTAN_LIBRARY_INITIALIZER_H_ 10 | 11 | #include 12 | #include 13 | 14 | namespace Botan { 15 | 16 | BOTAN_DEPRECATED_HEADER(init.h) 17 | 18 | /* 19 | * Previously botan had state whose lifetime had to be explicitly 20 | * managed by the application. As of 1.11.14 this is no longer the 21 | * case, and this class is no longer needed and kept only for backwards 22 | * compatibility. 23 | */ 24 | class BOTAN_PUBLIC_API(2,0) BOTAN_DEPRECATED("LibraryInitializer is no longer required") LibraryInitializer final 25 | { 26 | public: 27 | explicit LibraryInitializer(const std::string& /*ignored*/ = "") { } 28 | 29 | static void initialize(const std::string& /*ignored*/ = "") {} 30 | static void deinitialize() {} 31 | }; 32 | 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/include/botan/mgf1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MGF1 3 | * (C) 1999-2007,2014 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_MGF1_H_ 9 | #define BOTAN_MGF1_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | class HashFunction; 16 | 17 | /** 18 | * MGF1 from PKCS #1 v2.0 19 | * @param hash hash function to use 20 | * @param in input buffer 21 | * @param in_len size of the input buffer in bytes 22 | * @param out output buffer 23 | * @param out_len size of the output buffer in bytes 24 | */ 25 | void BOTAN_PUBLIC_API(2,0) mgf1_mask(HashFunction& hash, 26 | const uint8_t in[], size_t in_len, 27 | uint8_t out[], size_t out_len); 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/include/botan/mutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2016 Jack Lloyd 3 | * 4 | * Botan is released under the Simplified BSD License (see license.txt) 5 | */ 6 | 7 | #ifndef BOTAN_UTIL_MUTEX_H_ 8 | #define BOTAN_UTIL_MUTEX_H_ 9 | 10 | #include 11 | 12 | #if defined(BOTAN_TARGET_OS_HAS_THREADS) 13 | 14 | #include 15 | 16 | namespace Botan { 17 | 18 | template using lock_guard_type = std::lock_guard; 19 | typedef std::mutex mutex_type; 20 | 21 | } 22 | 23 | #else 24 | 25 | // No threads 26 | 27 | namespace Botan { 28 | 29 | template 30 | class lock_guard final 31 | { 32 | public: 33 | explicit lock_guard(Mutex& m) : m_mutex(m) 34 | { m_mutex.lock(); } 35 | 36 | ~lock_guard() { m_mutex.unlock(); } 37 | 38 | lock_guard(const lock_guard& other) = delete; 39 | lock_guard& operator=(const lock_guard& other) = delete; 40 | private: 41 | Mutex& m_mutex; 42 | }; 43 | 44 | class noop_mutex final 45 | { 46 | public: 47 | void lock() {} 48 | void unlock() {} 49 | }; 50 | 51 | typedef noop_mutex mutex_type; 52 | template using lock_guard_type = lock_guard; 53 | 54 | } 55 | 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/include/botan/pk_algs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PK Key Factory 3 | * (C) 1999-2010,2016 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_PK_KEY_FACTORY_H_ 9 | #define BOTAN_PK_KEY_FACTORY_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Botan { 16 | 17 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 18 | load_public_key(const AlgorithmIdentifier& alg_id, 19 | const std::vector& key_bits); 20 | 21 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 22 | load_private_key(const AlgorithmIdentifier& alg_id, 23 | const secure_vector& key_bits); 24 | 25 | /** 26 | * Create a new key 27 | * For ECC keys, algo_params specifies EC group (eg, "secp256r1") 28 | * For DH/DSA/ElGamal keys, algo_params is DL group (eg, "modp/ietf/2048") 29 | * For RSA, algo_params is integer keylength 30 | * For McEliece, algo_params is n,t 31 | * If algo_params is left empty, suitable default parameters are chosen. 32 | */ 33 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 34 | create_private_key(const std::string& algo_name, 35 | RandomNumberGenerator& rng, 36 | const std::string& algo_params = "", 37 | const std::string& provider = ""); 38 | 39 | BOTAN_PUBLIC_API(2,2) 40 | std::vector 41 | probe_provider_private_key(const std::string& algo_name, 42 | const std::vector possible); 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/include/botan/pk_ops_fwd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PK Operation Types Forward Decls 3 | * (C) 2016 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_PK_OPERATIONS_FWD_H_ 9 | #define BOTAN_PK_OPERATIONS_FWD_H_ 10 | 11 | namespace Botan { 12 | 13 | namespace PK_Ops { 14 | 15 | class Encryption; 16 | class Decryption; 17 | class Verification; 18 | class Signature; 19 | class Key_Agreement; 20 | class KEM_Encryption; 21 | class KEM_Decryption; 22 | 23 | } 24 | 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/include/botan/system_rng.h: -------------------------------------------------------------------------------- 1 | /* 2 | * System RNG interface 3 | * (C) 2014,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_SYSTEM_RNG_H_ 9 | #define BOTAN_SYSTEM_RNG_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * Return a shared reference to a global PRNG instance provided by the 17 | * operating system. For instance might be instantiated by /dev/urandom 18 | * or CryptGenRandom. 19 | */ 20 | BOTAN_PUBLIC_API(2,0) RandomNumberGenerator& system_rng(); 21 | 22 | /* 23 | * Instantiable reference to the system RNG. 24 | */ 25 | class BOTAN_PUBLIC_API(2,0) System_RNG final : public RandomNumberGenerator 26 | { 27 | public: 28 | std::string name() const override { return system_rng().name(); } 29 | 30 | void randomize(uint8_t out[], size_t len) override { system_rng().randomize(out, len); } 31 | 32 | void add_entropy(const uint8_t in[], size_t length) override { system_rng().add_entropy(in, length); } 33 | 34 | bool is_seeded() const override { return system_rng().is_seeded(); } 35 | 36 | bool accepts_input() const override { return system_rng().accepts_input(); } 37 | 38 | void clear() override { system_rng().clear(); } 39 | }; 40 | 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/include/botan/workfactor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Public Key Work Factor Functions 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_WORKFACTOR_H_ 9 | #define BOTAN_WORKFACTOR_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * Estimate work factor for discrete logarithm 17 | * @param prime_group_size size of the group in bits 18 | * @return estimated security level for this group 19 | */ 20 | BOTAN_PUBLIC_API(2,0) size_t dl_work_factor(size_t prime_group_size); 21 | 22 | /** 23 | * Return the appropriate exponent size to use for a particular prime 24 | * group. This is twice the size of the estimated cost of breaking the 25 | * key using an index calculus attack; the assumption is that if an 26 | * arbitrary discrete log on a group of size bits would take about 2^n 27 | * effort, and thus using an exponent of size 2^(2*n) implies that all 28 | * available attacks are about as easy (as e.g Pollard's kangaroo 29 | * algorithm can compute the DL in sqrt(x) operations) while minimizing 30 | * the exponent size for performance reasons. 31 | */ 32 | BOTAN_PUBLIC_API(2,0) size_t dl_exponent_size(size_t prime_group_size); 33 | 34 | /** 35 | * Estimate work factor for integer factorization 36 | * @param n_bits size of modulus in bits 37 | * @return estimated security level for this modulus 38 | */ 39 | BOTAN_PUBLIC_API(2,0) size_t if_work_factor(size_t n_bits); 40 | 41 | /** 42 | * Estimate work factor for EC discrete logarithm 43 | * @param prime_group_size size of the group in bits 44 | * @return estimated security level for this group 45 | */ 46 | BOTAN_PUBLIC_API(2,0) size_t ecp_work_factor(size_t prime_group_size); 47 | 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/lib/libbotan-2.so: -------------------------------------------------------------------------------- 1 | libbotan-2.so.13.14.0 -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/lib/libbotan-2.so.13: -------------------------------------------------------------------------------- 1 | libbotan-2.so.13.14.0 -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm32/lib/libbotan-2.so.13.14.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/src/zd_shared_lib/src/lib/botan/arm32/lib/libbotan-2.so.13.14.0 -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/include/botan/alg_id.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Algorithm Identifier 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ALGORITHM_IDENTIFIER_H_ 9 | #define BOTAN_ALGORITHM_IDENTIFIER_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Botan { 17 | 18 | /** 19 | * Algorithm Identifier 20 | */ 21 | class BOTAN_PUBLIC_API(2,0) AlgorithmIdentifier final : public ASN1_Object 22 | { 23 | public: 24 | enum Encoding_Option { USE_NULL_PARAM, USE_EMPTY_PARAM }; 25 | 26 | void encode_into(class DER_Encoder&) const override; 27 | void decode_from(class BER_Decoder&) override; 28 | 29 | AlgorithmIdentifier() = default; 30 | 31 | AlgorithmIdentifier(const OID& oid, Encoding_Option enc); 32 | AlgorithmIdentifier(const std::string& oid_name, Encoding_Option enc); 33 | 34 | AlgorithmIdentifier(const OID& oid, const std::vector& params); 35 | AlgorithmIdentifier(const std::string& oid_name, const std::vector& params); 36 | 37 | const OID& get_oid() const { return oid; } 38 | const std::vector& get_parameters() const { return parameters; } 39 | 40 | BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES: 41 | /* 42 | * These values are public for historical reasons, but in a future release 43 | * they will be made private. Do not access them. 44 | */ 45 | OID oid; 46 | std::vector parameters; 47 | }; 48 | 49 | /* 50 | * Comparison Operations 51 | */ 52 | bool BOTAN_PUBLIC_API(2,0) operator==(const AlgorithmIdentifier&, 53 | const AlgorithmIdentifier&); 54 | bool BOTAN_PUBLIC_API(2,0) operator!=(const AlgorithmIdentifier&, 55 | const AlgorithmIdentifier&); 56 | 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/include/botan/asn1_attribute.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASN.1 Attribute 3 | * (C) 1999-2007,2012 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ASN1_ATTRIBUTE_H_ 9 | #define BOTAN_ASN1_ATTRIBUTE_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Botan { 16 | 17 | /** 18 | * Attribute 19 | */ 20 | class BOTAN_PUBLIC_API(2,0) Attribute final : public ASN1_Object 21 | { 22 | public: 23 | void encode_into(class DER_Encoder& to) const override; 24 | void decode_from(class BER_Decoder& from) override; 25 | 26 | Attribute() = default; 27 | Attribute(const OID&, const std::vector&); 28 | Attribute(const std::string&, const std::vector&); 29 | 30 | const OID& get_oid() const { return oid; } 31 | 32 | const std::vector& get_parameters() const { return parameters; } 33 | 34 | BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES: 35 | /* 36 | * These values are public for historical reasons, but in a future release 37 | * they will be made private. Do not access them. 38 | */ 39 | OID oid; 40 | std::vector parameters; 41 | }; 42 | 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/include/botan/asn1_str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASN.1 string type 3 | * (C) 1999-2010 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ASN1_STRING_H_ 9 | #define BOTAN_ASN1_STRING_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * ASN.1 string type 17 | * This class normalizes all inputs to a UTF-8 std::string 18 | */ 19 | class BOTAN_PUBLIC_API(2,0) ASN1_String final : public ASN1_Object 20 | { 21 | public: 22 | void encode_into(class DER_Encoder&) const override; 23 | void decode_from(class BER_Decoder&) override; 24 | 25 | ASN1_Tag tagging() const { return m_tag; } 26 | 27 | const std::string& value() const { return m_utf8_str; } 28 | 29 | size_t size() const { return value().size(); } 30 | 31 | bool empty() const { return m_utf8_str.empty(); } 32 | 33 | std::string BOTAN_DEPRECATED("Use value() to get UTF-8 string instead") 34 | iso_8859() const; 35 | 36 | /** 37 | * Return true iff this is a tag for a known string type we can handle. 38 | * This ignores string types that are not supported, eg teletexString 39 | */ 40 | static bool is_string_type(ASN1_Tag tag); 41 | 42 | bool operator==(const ASN1_String& other) const 43 | { return value() == other.value(); } 44 | 45 | explicit ASN1_String(const std::string& utf8 = ""); 46 | ASN1_String(const std::string& utf8, ASN1_Tag tag); 47 | private: 48 | std::vector m_data; 49 | std::string m_utf8_str; 50 | ASN1_Tag m_tag; 51 | }; 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/include/botan/botan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A vague catch all include file for Botan 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_BOTAN_H_ 9 | #define BOTAN_BOTAN_H_ 10 | 11 | /* 12 | * There is no real reason for this header to exist beyond historical 13 | * reasons. The application should instead include the specific header 14 | * files that define the interfaces it intends to use. 15 | * 16 | * This header file will be removed in Botan 3.x 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #if defined(BOTAN_HAS_AUTO_SEEDING_RNG) 27 | #include 28 | #endif 29 | 30 | #if defined(BOTAN_HAS_FILTERS) 31 | #include 32 | #endif 33 | 34 | #if defined(BOTAN_HAS_PUBLIC_KEY_CRYPTO) 35 | #include 36 | #include 37 | #endif 38 | 39 | BOTAN_DEPRECATED_HEADER(botan.h) 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/include/botan/curve_nistp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Arithmetic operations specialized for NIST ECC primes 3 | * (C) 2014,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_NIST_PRIMES_H_ 9 | #define BOTAN_NIST_PRIMES_H_ 10 | 11 | #include 12 | 13 | BOTAN_FUTURE_INTERNAL_HEADER(curve_nistp.h) 14 | 15 | namespace Botan { 16 | 17 | /** 18 | * NIST Prime reduction functions. 19 | * 20 | * Reduces the value in place 21 | * 22 | * ws is a workspace function which is used as a temporary, 23 | * and will be resized as needed. 24 | */ 25 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p521(); 26 | BOTAN_PUBLIC_API(2,0) void redc_p521(BigInt& x, secure_vector& ws); 27 | 28 | /* 29 | Previously this macro indicated if the P-{192,224,256,384} reducers 30 | were available. Now they are always enabled and this macro has no meaning. 31 | The define will be removed in a future major release. 32 | */ 33 | #define BOTAN_HAS_NIST_PRIME_REDUCERS_W32 34 | 35 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p384(); 36 | BOTAN_PUBLIC_API(2,0) void redc_p384(BigInt& x, secure_vector& ws); 37 | 38 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p256(); 39 | BOTAN_PUBLIC_API(2,0) void redc_p256(BigInt& x, secure_vector& ws); 40 | 41 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p224(); 42 | BOTAN_PUBLIC_API(2,0) void redc_p224(BigInt& x, secure_vector& ws); 43 | 44 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p192(); 45 | BOTAN_PUBLIC_API(2,0) void redc_p192(BigInt& x, secure_vector& ws); 46 | 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/include/botan/hash_id.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hash Function Identification 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_HASHID_H_ 9 | #define BOTAN_HASHID_H_ 10 | 11 | #include 12 | #include 13 | 14 | namespace Botan { 15 | 16 | /** 17 | * Return the PKCS #1 hash identifier 18 | * @see RFC 3447 section 9.2 19 | * @param hash_name the name of the hash function 20 | * @return uint8_t sequence identifying the hash 21 | * @throw Invalid_Argument if the hash has no known PKCS #1 hash id 22 | */ 23 | BOTAN_PUBLIC_API(2,0) std::vector pkcs_hash_id(const std::string& hash_name); 24 | 25 | /** 26 | * Return the IEEE 1363 hash identifier 27 | * @param hash_name the name of the hash function 28 | * @return uint8_t code identifying the hash, or 0 if not known 29 | */ 30 | BOTAN_PUBLIC_API(2,0) uint8_t ieee1363_hash_id(const std::string& hash_name); 31 | 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/include/botan/init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Library Initialization 3 | * (C) 1999-2008,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_LIBRARY_INITIALIZER_H_ 9 | #define BOTAN_LIBRARY_INITIALIZER_H_ 10 | 11 | #include 12 | #include 13 | 14 | namespace Botan { 15 | 16 | BOTAN_DEPRECATED_HEADER(init.h) 17 | 18 | /* 19 | * Previously botan had state whose lifetime had to be explicitly 20 | * managed by the application. As of 1.11.14 this is no longer the 21 | * case, and this class is no longer needed and kept only for backwards 22 | * compatibility. 23 | */ 24 | class BOTAN_PUBLIC_API(2,0) BOTAN_DEPRECATED("LibraryInitializer is no longer required") LibraryInitializer final 25 | { 26 | public: 27 | explicit LibraryInitializer(const std::string& /*ignored*/ = "") { } 28 | 29 | static void initialize(const std::string& /*ignored*/ = "") {} 30 | static void deinitialize() {} 31 | }; 32 | 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/include/botan/mgf1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MGF1 3 | * (C) 1999-2007,2014 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_MGF1_H_ 9 | #define BOTAN_MGF1_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | class HashFunction; 16 | 17 | /** 18 | * MGF1 from PKCS #1 v2.0 19 | * @param hash hash function to use 20 | * @param in input buffer 21 | * @param in_len size of the input buffer in bytes 22 | * @param out output buffer 23 | * @param out_len size of the output buffer in bytes 24 | */ 25 | void BOTAN_PUBLIC_API(2,0) mgf1_mask(HashFunction& hash, 26 | const uint8_t in[], size_t in_len, 27 | uint8_t out[], size_t out_len); 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/include/botan/mutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2016 Jack Lloyd 3 | * 4 | * Botan is released under the Simplified BSD License (see license.txt) 5 | */ 6 | 7 | #ifndef BOTAN_UTIL_MUTEX_H_ 8 | #define BOTAN_UTIL_MUTEX_H_ 9 | 10 | #include 11 | 12 | #if defined(BOTAN_TARGET_OS_HAS_THREADS) 13 | 14 | #include 15 | 16 | namespace Botan { 17 | 18 | template using lock_guard_type = std::lock_guard; 19 | typedef std::mutex mutex_type; 20 | 21 | } 22 | 23 | #else 24 | 25 | // No threads 26 | 27 | namespace Botan { 28 | 29 | template 30 | class lock_guard final 31 | { 32 | public: 33 | explicit lock_guard(Mutex& m) : m_mutex(m) 34 | { m_mutex.lock(); } 35 | 36 | ~lock_guard() { m_mutex.unlock(); } 37 | 38 | lock_guard(const lock_guard& other) = delete; 39 | lock_guard& operator=(const lock_guard& other) = delete; 40 | private: 41 | Mutex& m_mutex; 42 | }; 43 | 44 | class noop_mutex final 45 | { 46 | public: 47 | void lock() {} 48 | void unlock() {} 49 | }; 50 | 51 | typedef noop_mutex mutex_type; 52 | template using lock_guard_type = lock_guard; 53 | 54 | } 55 | 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/include/botan/pk_algs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PK Key Factory 3 | * (C) 1999-2010,2016 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_PK_KEY_FACTORY_H_ 9 | #define BOTAN_PK_KEY_FACTORY_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Botan { 16 | 17 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 18 | load_public_key(const AlgorithmIdentifier& alg_id, 19 | const std::vector& key_bits); 20 | 21 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 22 | load_private_key(const AlgorithmIdentifier& alg_id, 23 | const secure_vector& key_bits); 24 | 25 | /** 26 | * Create a new key 27 | * For ECC keys, algo_params specifies EC group (eg, "secp256r1") 28 | * For DH/DSA/ElGamal keys, algo_params is DL group (eg, "modp/ietf/2048") 29 | * For RSA, algo_params is integer keylength 30 | * For McEliece, algo_params is n,t 31 | * If algo_params is left empty, suitable default parameters are chosen. 32 | */ 33 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 34 | create_private_key(const std::string& algo_name, 35 | RandomNumberGenerator& rng, 36 | const std::string& algo_params = "", 37 | const std::string& provider = ""); 38 | 39 | BOTAN_PUBLIC_API(2,2) 40 | std::vector 41 | probe_provider_private_key(const std::string& algo_name, 42 | const std::vector possible); 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/include/botan/pk_ops_fwd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PK Operation Types Forward Decls 3 | * (C) 2016 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_PK_OPERATIONS_FWD_H_ 9 | #define BOTAN_PK_OPERATIONS_FWD_H_ 10 | 11 | namespace Botan { 12 | 13 | namespace PK_Ops { 14 | 15 | class Encryption; 16 | class Decryption; 17 | class Verification; 18 | class Signature; 19 | class Key_Agreement; 20 | class KEM_Encryption; 21 | class KEM_Decryption; 22 | 23 | } 24 | 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/include/botan/system_rng.h: -------------------------------------------------------------------------------- 1 | /* 2 | * System RNG interface 3 | * (C) 2014,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_SYSTEM_RNG_H_ 9 | #define BOTAN_SYSTEM_RNG_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * Return a shared reference to a global PRNG instance provided by the 17 | * operating system. For instance might be instantiated by /dev/urandom 18 | * or CryptGenRandom. 19 | */ 20 | BOTAN_PUBLIC_API(2,0) RandomNumberGenerator& system_rng(); 21 | 22 | /* 23 | * Instantiable reference to the system RNG. 24 | */ 25 | class BOTAN_PUBLIC_API(2,0) System_RNG final : public RandomNumberGenerator 26 | { 27 | public: 28 | std::string name() const override { return system_rng().name(); } 29 | 30 | void randomize(uint8_t out[], size_t len) override { system_rng().randomize(out, len); } 31 | 32 | void add_entropy(const uint8_t in[], size_t length) override { system_rng().add_entropy(in, length); } 33 | 34 | bool is_seeded() const override { return system_rng().is_seeded(); } 35 | 36 | bool accepts_input() const override { return system_rng().accepts_input(); } 37 | 38 | void clear() override { system_rng().clear(); } 39 | }; 40 | 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/include/botan/workfactor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Public Key Work Factor Functions 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_WORKFACTOR_H_ 9 | #define BOTAN_WORKFACTOR_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * Estimate work factor for discrete logarithm 17 | * @param prime_group_size size of the group in bits 18 | * @return estimated security level for this group 19 | */ 20 | BOTAN_PUBLIC_API(2,0) size_t dl_work_factor(size_t prime_group_size); 21 | 22 | /** 23 | * Return the appropriate exponent size to use for a particular prime 24 | * group. This is twice the size of the estimated cost of breaking the 25 | * key using an index calculus attack; the assumption is that if an 26 | * arbitrary discrete log on a group of size bits would take about 2^n 27 | * effort, and thus using an exponent of size 2^(2*n) implies that all 28 | * available attacks are about as easy (as e.g Pollard's kangaroo 29 | * algorithm can compute the DL in sqrt(x) operations) while minimizing 30 | * the exponent size for performance reasons. 31 | */ 32 | BOTAN_PUBLIC_API(2,0) size_t dl_exponent_size(size_t prime_group_size); 33 | 34 | /** 35 | * Estimate work factor for integer factorization 36 | * @param n_bits size of modulus in bits 37 | * @return estimated security level for this modulus 38 | */ 39 | BOTAN_PUBLIC_API(2,0) size_t if_work_factor(size_t n_bits); 40 | 41 | /** 42 | * Estimate work factor for EC discrete logarithm 43 | * @param prime_group_size size of the group in bits 44 | * @return estimated security level for this group 45 | */ 46 | BOTAN_PUBLIC_API(2,0) size_t ecp_work_factor(size_t prime_group_size); 47 | 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/lib/libbotan-2.so: -------------------------------------------------------------------------------- 1 | libbotan-2.so.13.14.0 -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/lib/libbotan-2.so.13: -------------------------------------------------------------------------------- 1 | libbotan-2.so.13.14.0 -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/arm64/lib/libbotan-2.so.13.14.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/src/zd_shared_lib/src/lib/botan/arm64/lib/libbotan-2.so.13.14.0 -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/include/botan/alg_id.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Algorithm Identifier 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ALGORITHM_IDENTIFIER_H_ 9 | #define BOTAN_ALGORITHM_IDENTIFIER_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Botan { 17 | 18 | /** 19 | * Algorithm Identifier 20 | */ 21 | class BOTAN_PUBLIC_API(2,0) AlgorithmIdentifier final : public ASN1_Object 22 | { 23 | public: 24 | enum Encoding_Option { USE_NULL_PARAM, USE_EMPTY_PARAM }; 25 | 26 | void encode_into(class DER_Encoder&) const override; 27 | void decode_from(class BER_Decoder&) override; 28 | 29 | AlgorithmIdentifier() = default; 30 | 31 | AlgorithmIdentifier(const OID& oid, Encoding_Option enc); 32 | AlgorithmIdentifier(const std::string& oid_name, Encoding_Option enc); 33 | 34 | AlgorithmIdentifier(const OID& oid, const std::vector& params); 35 | AlgorithmIdentifier(const std::string& oid_name, const std::vector& params); 36 | 37 | const OID& get_oid() const { return oid; } 38 | const std::vector& get_parameters() const { return parameters; } 39 | 40 | BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES: 41 | /* 42 | * These values are public for historical reasons, but in a future release 43 | * they will be made private. Do not access them. 44 | */ 45 | OID oid; 46 | std::vector parameters; 47 | }; 48 | 49 | /* 50 | * Comparison Operations 51 | */ 52 | bool BOTAN_PUBLIC_API(2,0) operator==(const AlgorithmIdentifier&, 53 | const AlgorithmIdentifier&); 54 | bool BOTAN_PUBLIC_API(2,0) operator!=(const AlgorithmIdentifier&, 55 | const AlgorithmIdentifier&); 56 | 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/include/botan/asn1_attribute.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASN.1 Attribute 3 | * (C) 1999-2007,2012 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ASN1_ATTRIBUTE_H_ 9 | #define BOTAN_ASN1_ATTRIBUTE_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Botan { 16 | 17 | /** 18 | * Attribute 19 | */ 20 | class BOTAN_PUBLIC_API(2,0) Attribute final : public ASN1_Object 21 | { 22 | public: 23 | void encode_into(class DER_Encoder& to) const override; 24 | void decode_from(class BER_Decoder& from) override; 25 | 26 | Attribute() = default; 27 | Attribute(const OID&, const std::vector&); 28 | Attribute(const std::string&, const std::vector&); 29 | 30 | const OID& get_oid() const { return oid; } 31 | 32 | const std::vector& get_parameters() const { return parameters; } 33 | 34 | BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES: 35 | /* 36 | * These values are public for historical reasons, but in a future release 37 | * they will be made private. Do not access them. 38 | */ 39 | OID oid; 40 | std::vector parameters; 41 | }; 42 | 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/include/botan/asn1_str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASN.1 string type 3 | * (C) 1999-2010 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ASN1_STRING_H_ 9 | #define BOTAN_ASN1_STRING_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * ASN.1 string type 17 | * This class normalizes all inputs to a UTF-8 std::string 18 | */ 19 | class BOTAN_PUBLIC_API(2,0) ASN1_String final : public ASN1_Object 20 | { 21 | public: 22 | void encode_into(class DER_Encoder&) const override; 23 | void decode_from(class BER_Decoder&) override; 24 | 25 | ASN1_Tag tagging() const { return m_tag; } 26 | 27 | const std::string& value() const { return m_utf8_str; } 28 | 29 | size_t size() const { return value().size(); } 30 | 31 | bool empty() const { return m_utf8_str.empty(); } 32 | 33 | std::string BOTAN_DEPRECATED("Use value() to get UTF-8 string instead") 34 | iso_8859() const; 35 | 36 | /** 37 | * Return true iff this is a tag for a known string type we can handle. 38 | * This ignores string types that are not supported, eg teletexString 39 | */ 40 | static bool is_string_type(ASN1_Tag tag); 41 | 42 | bool operator==(const ASN1_String& other) const 43 | { return value() == other.value(); } 44 | 45 | explicit ASN1_String(const std::string& utf8 = ""); 46 | ASN1_String(const std::string& utf8, ASN1_Tag tag); 47 | private: 48 | std::vector m_data; 49 | std::string m_utf8_str; 50 | ASN1_Tag m_tag; 51 | }; 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/include/botan/botan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A vague catch all include file for Botan 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_BOTAN_H_ 9 | #define BOTAN_BOTAN_H_ 10 | 11 | /* 12 | * There is no real reason for this header to exist beyond historical 13 | * reasons. The application should instead include the specific header 14 | * files that define the interfaces it intends to use. 15 | * 16 | * This header file will be removed in Botan 3.x 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #if defined(BOTAN_HAS_AUTO_SEEDING_RNG) 27 | #include 28 | #endif 29 | 30 | #if defined(BOTAN_HAS_FILTERS) 31 | #include 32 | #endif 33 | 34 | #if defined(BOTAN_HAS_PUBLIC_KEY_CRYPTO) 35 | #include 36 | #include 37 | #endif 38 | 39 | BOTAN_DEPRECATED_HEADER(botan.h) 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/include/botan/curve_nistp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Arithmetic operations specialized for NIST ECC primes 3 | * (C) 2014,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_NIST_PRIMES_H_ 9 | #define BOTAN_NIST_PRIMES_H_ 10 | 11 | #include 12 | 13 | BOTAN_FUTURE_INTERNAL_HEADER(curve_nistp.h) 14 | 15 | namespace Botan { 16 | 17 | /** 18 | * NIST Prime reduction functions. 19 | * 20 | * Reduces the value in place 21 | * 22 | * ws is a workspace function which is used as a temporary, 23 | * and will be resized as needed. 24 | */ 25 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p521(); 26 | BOTAN_PUBLIC_API(2,0) void redc_p521(BigInt& x, secure_vector& ws); 27 | 28 | /* 29 | Previously this macro indicated if the P-{192,224,256,384} reducers 30 | were available. Now they are always enabled and this macro has no meaning. 31 | The define will be removed in a future major release. 32 | */ 33 | #define BOTAN_HAS_NIST_PRIME_REDUCERS_W32 34 | 35 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p384(); 36 | BOTAN_PUBLIC_API(2,0) void redc_p384(BigInt& x, secure_vector& ws); 37 | 38 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p256(); 39 | BOTAN_PUBLIC_API(2,0) void redc_p256(BigInt& x, secure_vector& ws); 40 | 41 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p224(); 42 | BOTAN_PUBLIC_API(2,0) void redc_p224(BigInt& x, secure_vector& ws); 43 | 44 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p192(); 45 | BOTAN_PUBLIC_API(2,0) void redc_p192(BigInt& x, secure_vector& ws); 46 | 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/include/botan/hash_id.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hash Function Identification 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_HASHID_H_ 9 | #define BOTAN_HASHID_H_ 10 | 11 | #include 12 | #include 13 | 14 | namespace Botan { 15 | 16 | /** 17 | * Return the PKCS #1 hash identifier 18 | * @see RFC 3447 section 9.2 19 | * @param hash_name the name of the hash function 20 | * @return uint8_t sequence identifying the hash 21 | * @throw Invalid_Argument if the hash has no known PKCS #1 hash id 22 | */ 23 | BOTAN_PUBLIC_API(2,0) std::vector pkcs_hash_id(const std::string& hash_name); 24 | 25 | /** 26 | * Return the IEEE 1363 hash identifier 27 | * @param hash_name the name of the hash function 28 | * @return uint8_t code identifying the hash, or 0 if not known 29 | */ 30 | BOTAN_PUBLIC_API(2,0) uint8_t ieee1363_hash_id(const std::string& hash_name); 31 | 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/include/botan/init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Library Initialization 3 | * (C) 1999-2008,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_LIBRARY_INITIALIZER_H_ 9 | #define BOTAN_LIBRARY_INITIALIZER_H_ 10 | 11 | #include 12 | #include 13 | 14 | namespace Botan { 15 | 16 | BOTAN_DEPRECATED_HEADER(init.h) 17 | 18 | /* 19 | * Previously botan had state whose lifetime had to be explicitly 20 | * managed by the application. As of 1.11.14 this is no longer the 21 | * case, and this class is no longer needed and kept only for backwards 22 | * compatibility. 23 | */ 24 | class BOTAN_PUBLIC_API(2,0) BOTAN_DEPRECATED("LibraryInitializer is no longer required") LibraryInitializer final 25 | { 26 | public: 27 | explicit LibraryInitializer(const std::string& /*ignored*/ = "") { } 28 | 29 | static void initialize(const std::string& /*ignored*/ = "") {} 30 | static void deinitialize() {} 31 | }; 32 | 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/include/botan/mgf1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MGF1 3 | * (C) 1999-2007,2014 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_MGF1_H_ 9 | #define BOTAN_MGF1_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | class HashFunction; 16 | 17 | /** 18 | * MGF1 from PKCS #1 v2.0 19 | * @param hash hash function to use 20 | * @param in input buffer 21 | * @param in_len size of the input buffer in bytes 22 | * @param out output buffer 23 | * @param out_len size of the output buffer in bytes 24 | */ 25 | void BOTAN_PUBLIC_API(2,0) mgf1_mask(HashFunction& hash, 26 | const uint8_t in[], size_t in_len, 27 | uint8_t out[], size_t out_len); 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/include/botan/mutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2016 Jack Lloyd 3 | * 4 | * Botan is released under the Simplified BSD License (see license.txt) 5 | */ 6 | 7 | #ifndef BOTAN_UTIL_MUTEX_H_ 8 | #define BOTAN_UTIL_MUTEX_H_ 9 | 10 | #include 11 | 12 | #if defined(BOTAN_TARGET_OS_HAS_THREADS) 13 | 14 | #include 15 | 16 | namespace Botan { 17 | 18 | template using lock_guard_type = std::lock_guard; 19 | typedef std::mutex mutex_type; 20 | 21 | } 22 | 23 | #else 24 | 25 | // No threads 26 | 27 | namespace Botan { 28 | 29 | template 30 | class lock_guard final 31 | { 32 | public: 33 | explicit lock_guard(Mutex& m) : m_mutex(m) 34 | { m_mutex.lock(); } 35 | 36 | ~lock_guard() { m_mutex.unlock(); } 37 | 38 | lock_guard(const lock_guard& other) = delete; 39 | lock_guard& operator=(const lock_guard& other) = delete; 40 | private: 41 | Mutex& m_mutex; 42 | }; 43 | 44 | class noop_mutex final 45 | { 46 | public: 47 | void lock() {} 48 | void unlock() {} 49 | }; 50 | 51 | typedef noop_mutex mutex_type; 52 | template using lock_guard_type = lock_guard; 53 | 54 | } 55 | 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/include/botan/pk_algs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PK Key Factory 3 | * (C) 1999-2010,2016 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_PK_KEY_FACTORY_H_ 9 | #define BOTAN_PK_KEY_FACTORY_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Botan { 16 | 17 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 18 | load_public_key(const AlgorithmIdentifier& alg_id, 19 | const std::vector& key_bits); 20 | 21 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 22 | load_private_key(const AlgorithmIdentifier& alg_id, 23 | const secure_vector& key_bits); 24 | 25 | /** 26 | * Create a new key 27 | * For ECC keys, algo_params specifies EC group (eg, "secp256r1") 28 | * For DH/DSA/ElGamal keys, algo_params is DL group (eg, "modp/ietf/2048") 29 | * For RSA, algo_params is integer keylength 30 | * For McEliece, algo_params is n,t 31 | * If algo_params is left empty, suitable default parameters are chosen. 32 | */ 33 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 34 | create_private_key(const std::string& algo_name, 35 | RandomNumberGenerator& rng, 36 | const std::string& algo_params = "", 37 | const std::string& provider = ""); 38 | 39 | BOTAN_PUBLIC_API(2,2) 40 | std::vector 41 | probe_provider_private_key(const std::string& algo_name, 42 | const std::vector possible); 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/include/botan/pk_ops_fwd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PK Operation Types Forward Decls 3 | * (C) 2016 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_PK_OPERATIONS_FWD_H_ 9 | #define BOTAN_PK_OPERATIONS_FWD_H_ 10 | 11 | namespace Botan { 12 | 13 | namespace PK_Ops { 14 | 15 | class Encryption; 16 | class Decryption; 17 | class Verification; 18 | class Signature; 19 | class Key_Agreement; 20 | class KEM_Encryption; 21 | class KEM_Decryption; 22 | 23 | } 24 | 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/include/botan/system_rng.h: -------------------------------------------------------------------------------- 1 | /* 2 | * System RNG interface 3 | * (C) 2014,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_SYSTEM_RNG_H_ 9 | #define BOTAN_SYSTEM_RNG_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * Return a shared reference to a global PRNG instance provided by the 17 | * operating system. For instance might be instantiated by /dev/urandom 18 | * or CryptGenRandom. 19 | */ 20 | BOTAN_PUBLIC_API(2,0) RandomNumberGenerator& system_rng(); 21 | 22 | /* 23 | * Instantiable reference to the system RNG. 24 | */ 25 | class BOTAN_PUBLIC_API(2,0) System_RNG final : public RandomNumberGenerator 26 | { 27 | public: 28 | std::string name() const override { return system_rng().name(); } 29 | 30 | void randomize(uint8_t out[], size_t len) override { system_rng().randomize(out, len); } 31 | 32 | void add_entropy(const uint8_t in[], size_t length) override { system_rng().add_entropy(in, length); } 33 | 34 | bool is_seeded() const override { return system_rng().is_seeded(); } 35 | 36 | bool accepts_input() const override { return system_rng().accepts_input(); } 37 | 38 | void clear() override { system_rng().clear(); } 39 | }; 40 | 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/include/botan/workfactor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Public Key Work Factor Functions 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_WORKFACTOR_H_ 9 | #define BOTAN_WORKFACTOR_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * Estimate work factor for discrete logarithm 17 | * @param prime_group_size size of the group in bits 18 | * @return estimated security level for this group 19 | */ 20 | BOTAN_PUBLIC_API(2,0) size_t dl_work_factor(size_t prime_group_size); 21 | 22 | /** 23 | * Return the appropriate exponent size to use for a particular prime 24 | * group. This is twice the size of the estimated cost of breaking the 25 | * key using an index calculus attack; the assumption is that if an 26 | * arbitrary discrete log on a group of size bits would take about 2^n 27 | * effort, and thus using an exponent of size 2^(2*n) implies that all 28 | * available attacks are about as easy (as e.g Pollard's kangaroo 29 | * algorithm can compute the DL in sqrt(x) operations) while minimizing 30 | * the exponent size for performance reasons. 31 | */ 32 | BOTAN_PUBLIC_API(2,0) size_t dl_exponent_size(size_t prime_group_size); 33 | 34 | /** 35 | * Estimate work factor for integer factorization 36 | * @param n_bits size of modulus in bits 37 | * @return estimated security level for this modulus 38 | */ 39 | BOTAN_PUBLIC_API(2,0) size_t if_work_factor(size_t n_bits); 40 | 41 | /** 42 | * Estimate work factor for EC discrete logarithm 43 | * @param prime_group_size size of the group in bits 44 | * @return estimated security level for this group 45 | */ 46 | BOTAN_PUBLIC_API(2,0) size_t ecp_work_factor(size_t prime_group_size); 47 | 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/lib/libbotan-2.so: -------------------------------------------------------------------------------- 1 | libbotan-2.so.13.14.0 -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/lib/libbotan-2.so.13: -------------------------------------------------------------------------------- 1 | libbotan-2.so.13.14.0 -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/linux64/lib/libbotan-2.so.13.14.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/src/zd_shared_lib/src/lib/botan/linux64/lib/libbotan-2.so.13.14.0 -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/include/botan/alg_id.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Algorithm Identifier 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ALGORITHM_IDENTIFIER_H_ 9 | #define BOTAN_ALGORITHM_IDENTIFIER_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Botan { 17 | 18 | /** 19 | * Algorithm Identifier 20 | */ 21 | class BOTAN_PUBLIC_API(2,0) AlgorithmIdentifier final : public ASN1_Object 22 | { 23 | public: 24 | enum Encoding_Option { USE_NULL_PARAM, USE_EMPTY_PARAM }; 25 | 26 | void encode_into(class DER_Encoder&) const override; 27 | void decode_from(class BER_Decoder&) override; 28 | 29 | AlgorithmIdentifier() = default; 30 | 31 | AlgorithmIdentifier(const OID& oid, Encoding_Option enc); 32 | AlgorithmIdentifier(const std::string& oid_name, Encoding_Option enc); 33 | 34 | AlgorithmIdentifier(const OID& oid, const std::vector& params); 35 | AlgorithmIdentifier(const std::string& oid_name, const std::vector& params); 36 | 37 | const OID& get_oid() const { return oid; } 38 | const std::vector& get_parameters() const { return parameters; } 39 | 40 | BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES: 41 | /* 42 | * These values are public for historical reasons, but in a future release 43 | * they will be made private. Do not access them. 44 | */ 45 | OID oid; 46 | std::vector parameters; 47 | }; 48 | 49 | /* 50 | * Comparison Operations 51 | */ 52 | bool BOTAN_PUBLIC_API(2,0) operator==(const AlgorithmIdentifier&, 53 | const AlgorithmIdentifier&); 54 | bool BOTAN_PUBLIC_API(2,0) operator!=(const AlgorithmIdentifier&, 55 | const AlgorithmIdentifier&); 56 | 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/include/botan/asn1_attribute.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASN.1 Attribute 3 | * (C) 1999-2007,2012 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ASN1_ATTRIBUTE_H_ 9 | #define BOTAN_ASN1_ATTRIBUTE_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Botan { 16 | 17 | /** 18 | * Attribute 19 | */ 20 | class BOTAN_PUBLIC_API(2,0) Attribute final : public ASN1_Object 21 | { 22 | public: 23 | void encode_into(class DER_Encoder& to) const override; 24 | void decode_from(class BER_Decoder& from) override; 25 | 26 | Attribute() = default; 27 | Attribute(const OID&, const std::vector&); 28 | Attribute(const std::string&, const std::vector&); 29 | 30 | const OID& get_oid() const { return oid; } 31 | 32 | const std::vector& get_parameters() const { return parameters; } 33 | 34 | BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES: 35 | /* 36 | * These values are public for historical reasons, but in a future release 37 | * they will be made private. Do not access them. 38 | */ 39 | OID oid; 40 | std::vector parameters; 41 | }; 42 | 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/include/botan/asn1_str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASN.1 string type 3 | * (C) 1999-2010 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ASN1_STRING_H_ 9 | #define BOTAN_ASN1_STRING_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * ASN.1 string type 17 | * This class normalizes all inputs to a UTF-8 std::string 18 | */ 19 | class BOTAN_PUBLIC_API(2,0) ASN1_String final : public ASN1_Object 20 | { 21 | public: 22 | void encode_into(class DER_Encoder&) const override; 23 | void decode_from(class BER_Decoder&) override; 24 | 25 | ASN1_Tag tagging() const { return m_tag; } 26 | 27 | const std::string& value() const { return m_utf8_str; } 28 | 29 | size_t size() const { return value().size(); } 30 | 31 | bool empty() const { return m_utf8_str.empty(); } 32 | 33 | std::string BOTAN_DEPRECATED("Use value() to get UTF-8 string instead") 34 | iso_8859() const; 35 | 36 | /** 37 | * Return true iff this is a tag for a known string type we can handle. 38 | * This ignores string types that are not supported, eg teletexString 39 | */ 40 | static bool is_string_type(ASN1_Tag tag); 41 | 42 | bool operator==(const ASN1_String& other) const 43 | { return value() == other.value(); } 44 | 45 | explicit ASN1_String(const std::string& utf8 = ""); 46 | ASN1_String(const std::string& utf8, ASN1_Tag tag); 47 | private: 48 | std::vector m_data; 49 | std::string m_utf8_str; 50 | ASN1_Tag m_tag; 51 | }; 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/include/botan/botan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A vague catch all include file for Botan 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_BOTAN_H_ 9 | #define BOTAN_BOTAN_H_ 10 | 11 | /* 12 | * There is no real reason for this header to exist beyond historical 13 | * reasons. The application should instead include the specific header 14 | * files that define the interfaces it intends to use. 15 | * 16 | * This header file will be removed in Botan 3.x 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #if defined(BOTAN_HAS_AUTO_SEEDING_RNG) 27 | #include 28 | #endif 29 | 30 | #if defined(BOTAN_HAS_FILTERS) 31 | #include 32 | #endif 33 | 34 | #if defined(BOTAN_HAS_PUBLIC_KEY_CRYPTO) 35 | #include 36 | #include 37 | #endif 38 | 39 | BOTAN_DEPRECATED_HEADER(botan.h) 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/include/botan/curve_nistp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Arithmetic operations specialized for NIST ECC primes 3 | * (C) 2014,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_NIST_PRIMES_H_ 9 | #define BOTAN_NIST_PRIMES_H_ 10 | 11 | #include 12 | 13 | BOTAN_FUTURE_INTERNAL_HEADER(curve_nistp.h) 14 | 15 | namespace Botan { 16 | 17 | /** 18 | * NIST Prime reduction functions. 19 | * 20 | * Reduces the value in place 21 | * 22 | * ws is a workspace function which is used as a temporary, 23 | * and will be resized as needed. 24 | */ 25 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p521(); 26 | BOTAN_PUBLIC_API(2,0) void redc_p521(BigInt& x, secure_vector& ws); 27 | 28 | /* 29 | Previously this macro indicated if the P-{192,224,256,384} reducers 30 | were available. Now they are always enabled and this macro has no meaning. 31 | The define will be removed in a future major release. 32 | */ 33 | #define BOTAN_HAS_NIST_PRIME_REDUCERS_W32 34 | 35 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p384(); 36 | BOTAN_PUBLIC_API(2,0) void redc_p384(BigInt& x, secure_vector& ws); 37 | 38 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p256(); 39 | BOTAN_PUBLIC_API(2,0) void redc_p256(BigInt& x, secure_vector& ws); 40 | 41 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p224(); 42 | BOTAN_PUBLIC_API(2,0) void redc_p224(BigInt& x, secure_vector& ws); 43 | 44 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p192(); 45 | BOTAN_PUBLIC_API(2,0) void redc_p192(BigInt& x, secure_vector& ws); 46 | 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/include/botan/hash_id.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hash Function Identification 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_HASHID_H_ 9 | #define BOTAN_HASHID_H_ 10 | 11 | #include 12 | #include 13 | 14 | namespace Botan { 15 | 16 | /** 17 | * Return the PKCS #1 hash identifier 18 | * @see RFC 3447 section 9.2 19 | * @param hash_name the name of the hash function 20 | * @return uint8_t sequence identifying the hash 21 | * @throw Invalid_Argument if the hash has no known PKCS #1 hash id 22 | */ 23 | BOTAN_PUBLIC_API(2,0) std::vector pkcs_hash_id(const std::string& hash_name); 24 | 25 | /** 26 | * Return the IEEE 1363 hash identifier 27 | * @param hash_name the name of the hash function 28 | * @return uint8_t code identifying the hash, or 0 if not known 29 | */ 30 | BOTAN_PUBLIC_API(2,0) uint8_t ieee1363_hash_id(const std::string& hash_name); 31 | 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/include/botan/init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Library Initialization 3 | * (C) 1999-2008,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_LIBRARY_INITIALIZER_H_ 9 | #define BOTAN_LIBRARY_INITIALIZER_H_ 10 | 11 | #include 12 | #include 13 | 14 | namespace Botan { 15 | 16 | BOTAN_DEPRECATED_HEADER(init.h) 17 | 18 | /* 19 | * Previously botan had state whose lifetime had to be explicitly 20 | * managed by the application. As of 1.11.14 this is no longer the 21 | * case, and this class is no longer needed and kept only for backwards 22 | * compatibility. 23 | */ 24 | class BOTAN_PUBLIC_API(2,0) BOTAN_DEPRECATED("LibraryInitializer is no longer required") LibraryInitializer final 25 | { 26 | public: 27 | explicit LibraryInitializer(const std::string& /*ignored*/ = "") { } 28 | 29 | static void initialize(const std::string& /*ignored*/ = "") {} 30 | static void deinitialize() {} 31 | }; 32 | 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/include/botan/mgf1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MGF1 3 | * (C) 1999-2007,2014 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_MGF1_H_ 9 | #define BOTAN_MGF1_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | class HashFunction; 16 | 17 | /** 18 | * MGF1 from PKCS #1 v2.0 19 | * @param hash hash function to use 20 | * @param in input buffer 21 | * @param in_len size of the input buffer in bytes 22 | * @param out output buffer 23 | * @param out_len size of the output buffer in bytes 24 | */ 25 | void BOTAN_PUBLIC_API(2,0) mgf1_mask(HashFunction& hash, 26 | const uint8_t in[], size_t in_len, 27 | uint8_t out[], size_t out_len); 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/include/botan/mutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2016 Jack Lloyd 3 | * 4 | * Botan is released under the Simplified BSD License (see license.txt) 5 | */ 6 | 7 | #ifndef BOTAN_UTIL_MUTEX_H_ 8 | #define BOTAN_UTIL_MUTEX_H_ 9 | 10 | #include 11 | 12 | #if defined(BOTAN_TARGET_OS_HAS_THREADS) 13 | 14 | #include 15 | 16 | namespace Botan { 17 | 18 | template using lock_guard_type = std::lock_guard; 19 | typedef std::mutex mutex_type; 20 | 21 | } 22 | 23 | #else 24 | 25 | // No threads 26 | 27 | namespace Botan { 28 | 29 | template 30 | class lock_guard final 31 | { 32 | public: 33 | explicit lock_guard(Mutex& m) : m_mutex(m) 34 | { m_mutex.lock(); } 35 | 36 | ~lock_guard() { m_mutex.unlock(); } 37 | 38 | lock_guard(const lock_guard& other) = delete; 39 | lock_guard& operator=(const lock_guard& other) = delete; 40 | private: 41 | Mutex& m_mutex; 42 | }; 43 | 44 | class noop_mutex final 45 | { 46 | public: 47 | void lock() {} 48 | void unlock() {} 49 | }; 50 | 51 | typedef noop_mutex mutex_type; 52 | template using lock_guard_type = lock_guard; 53 | 54 | } 55 | 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/include/botan/pk_algs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PK Key Factory 3 | * (C) 1999-2010,2016 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_PK_KEY_FACTORY_H_ 9 | #define BOTAN_PK_KEY_FACTORY_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Botan { 16 | 17 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 18 | load_public_key(const AlgorithmIdentifier& alg_id, 19 | const std::vector& key_bits); 20 | 21 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 22 | load_private_key(const AlgorithmIdentifier& alg_id, 23 | const secure_vector& key_bits); 24 | 25 | /** 26 | * Create a new key 27 | * For ECC keys, algo_params specifies EC group (eg, "secp256r1") 28 | * For DH/DSA/ElGamal keys, algo_params is DL group (eg, "modp/ietf/2048") 29 | * For RSA, algo_params is integer keylength 30 | * For McEliece, algo_params is n,t 31 | * If algo_params is left empty, suitable default parameters are chosen. 32 | */ 33 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 34 | create_private_key(const std::string& algo_name, 35 | RandomNumberGenerator& rng, 36 | const std::string& algo_params = "", 37 | const std::string& provider = ""); 38 | 39 | BOTAN_PUBLIC_API(2,2) 40 | std::vector 41 | probe_provider_private_key(const std::string& algo_name, 42 | const std::vector possible); 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/include/botan/pk_ops_fwd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PK Operation Types Forward Decls 3 | * (C) 2016 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_PK_OPERATIONS_FWD_H_ 9 | #define BOTAN_PK_OPERATIONS_FWD_H_ 10 | 11 | namespace Botan { 12 | 13 | namespace PK_Ops { 14 | 15 | class Encryption; 16 | class Decryption; 17 | class Verification; 18 | class Signature; 19 | class Key_Agreement; 20 | class KEM_Encryption; 21 | class KEM_Decryption; 22 | 23 | } 24 | 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/include/botan/system_rng.h: -------------------------------------------------------------------------------- 1 | /* 2 | * System RNG interface 3 | * (C) 2014,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_SYSTEM_RNG_H_ 9 | #define BOTAN_SYSTEM_RNG_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * Return a shared reference to a global PRNG instance provided by the 17 | * operating system. For instance might be instantiated by /dev/urandom 18 | * or CryptGenRandom. 19 | */ 20 | BOTAN_PUBLIC_API(2,0) RandomNumberGenerator& system_rng(); 21 | 22 | /* 23 | * Instantiable reference to the system RNG. 24 | */ 25 | class BOTAN_PUBLIC_API(2,0) System_RNG final : public RandomNumberGenerator 26 | { 27 | public: 28 | std::string name() const override { return system_rng().name(); } 29 | 30 | void randomize(uint8_t out[], size_t len) override { system_rng().randomize(out, len); } 31 | 32 | void add_entropy(const uint8_t in[], size_t length) override { system_rng().add_entropy(in, length); } 33 | 34 | bool is_seeded() const override { return system_rng().is_seeded(); } 35 | 36 | bool accepts_input() const override { return system_rng().accepts_input(); } 37 | 38 | void clear() override { system_rng().clear(); } 39 | }; 40 | 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/include/botan/workfactor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Public Key Work Factor Functions 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_WORKFACTOR_H_ 9 | #define BOTAN_WORKFACTOR_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * Estimate work factor for discrete logarithm 17 | * @param prime_group_size size of the group in bits 18 | * @return estimated security level for this group 19 | */ 20 | BOTAN_PUBLIC_API(2,0) size_t dl_work_factor(size_t prime_group_size); 21 | 22 | /** 23 | * Return the appropriate exponent size to use for a particular prime 24 | * group. This is twice the size of the estimated cost of breaking the 25 | * key using an index calculus attack; the assumption is that if an 26 | * arbitrary discrete log on a group of size bits would take about 2^n 27 | * effort, and thus using an exponent of size 2^(2*n) implies that all 28 | * available attacks are about as easy (as e.g Pollard's kangaroo 29 | * algorithm can compute the DL in sqrt(x) operations) while minimizing 30 | * the exponent size for performance reasons. 31 | */ 32 | BOTAN_PUBLIC_API(2,0) size_t dl_exponent_size(size_t prime_group_size); 33 | 34 | /** 35 | * Estimate work factor for integer factorization 36 | * @param n_bits size of modulus in bits 37 | * @return estimated security level for this modulus 38 | */ 39 | BOTAN_PUBLIC_API(2,0) size_t if_work_factor(size_t n_bits); 40 | 41 | /** 42 | * Estimate work factor for EC discrete logarithm 43 | * @param prime_group_size size of the group in bits 44 | * @return estimated security level for this group 45 | */ 46 | BOTAN_PUBLIC_API(2,0) size_t ecp_work_factor(size_t prime_group_size); 47 | 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/lib/libbotan-2.13.14.0.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/src/zd_shared_lib/src/lib/botan/macx/lib/libbotan-2.13.14.0.dylib -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/lib/libbotan-2.13.dylib: -------------------------------------------------------------------------------- 1 | XSym 2 | 0024 3 | 96087499b07815d42f7dec6ccf11c3f8 4 | libbotan-2.13.14.0.dylib 5 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/lib/libbotan-2.dylib: -------------------------------------------------------------------------------- 1 | XSym 2 | 0024 3 | 96087499b07815d42f7dec6ccf11c3f8 4 | libbotan-2.13.14.0.dylib 5 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/lib/pkgconfig/._botan-2.pc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/src/zd_shared_lib/src/lib/botan/macx/lib/pkgconfig/._botan-2.pc -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/macx/lib/pkgconfig/botan-2.pc: -------------------------------------------------------------------------------- 1 | prefix=/Users/ddd/shr/Botan/inst 2 | exec_prefix=${prefix} 3 | libdir=/Users/ddd/shr/Botan/inst/lib 4 | includedir=${prefix}/include/botan-2 5 | 6 | Name: Botan 7 | Description: Crypto and TLS for C++11 8 | Version: 2.14.0 9 | 10 | Libs: -L${libdir} -lbotan-2 -fstack-protector -m64 -pthread -stdlib=libc++ 11 | Libs.private: 12 | Cflags: -I${includedir} 13 | 14 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/include/botan/alg_id.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Algorithm Identifier 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ALGORITHM_IDENTIFIER_H_ 9 | #define BOTAN_ALGORITHM_IDENTIFIER_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Botan { 17 | 18 | /** 19 | * Algorithm Identifier 20 | */ 21 | class BOTAN_PUBLIC_API(2,0) AlgorithmIdentifier final : public ASN1_Object 22 | { 23 | public: 24 | enum Encoding_Option { USE_NULL_PARAM, USE_EMPTY_PARAM }; 25 | 26 | void encode_into(class DER_Encoder&) const override; 27 | void decode_from(class BER_Decoder&) override; 28 | 29 | AlgorithmIdentifier() = default; 30 | 31 | AlgorithmIdentifier(const OID& oid, Encoding_Option enc); 32 | AlgorithmIdentifier(const std::string& oid_name, Encoding_Option enc); 33 | 34 | AlgorithmIdentifier(const OID& oid, const std::vector& params); 35 | AlgorithmIdentifier(const std::string& oid_name, const std::vector& params); 36 | 37 | const OID& get_oid() const { return oid; } 38 | const std::vector& get_parameters() const { return parameters; } 39 | 40 | BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES: 41 | /* 42 | * These values are public for historical reasons, but in a future release 43 | * they will be made private. Do not access them. 44 | */ 45 | OID oid; 46 | std::vector parameters; 47 | }; 48 | 49 | /* 50 | * Comparison Operations 51 | */ 52 | bool BOTAN_PUBLIC_API(2,0) operator==(const AlgorithmIdentifier&, 53 | const AlgorithmIdentifier&); 54 | bool BOTAN_PUBLIC_API(2,0) operator!=(const AlgorithmIdentifier&, 55 | const AlgorithmIdentifier&); 56 | 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/include/botan/asn1_attribute.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASN.1 Attribute 3 | * (C) 1999-2007,2012 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ASN1_ATTRIBUTE_H_ 9 | #define BOTAN_ASN1_ATTRIBUTE_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Botan { 16 | 17 | /** 18 | * Attribute 19 | */ 20 | class BOTAN_PUBLIC_API(2,0) Attribute final : public ASN1_Object 21 | { 22 | public: 23 | void encode_into(class DER_Encoder& to) const override; 24 | void decode_from(class BER_Decoder& from) override; 25 | 26 | Attribute() = default; 27 | Attribute(const OID&, const std::vector&); 28 | Attribute(const std::string&, const std::vector&); 29 | 30 | const OID& get_oid() const { return oid; } 31 | 32 | const std::vector& get_parameters() const { return parameters; } 33 | 34 | BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES: 35 | /* 36 | * These values are public for historical reasons, but in a future release 37 | * they will be made private. Do not access them. 38 | */ 39 | OID oid; 40 | std::vector parameters; 41 | }; 42 | 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/include/botan/asn1_str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASN.1 string type 3 | * (C) 1999-2010 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ASN1_STRING_H_ 9 | #define BOTAN_ASN1_STRING_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * ASN.1 string type 17 | * This class normalizes all inputs to a UTF-8 std::string 18 | */ 19 | class BOTAN_PUBLIC_API(2,0) ASN1_String final : public ASN1_Object 20 | { 21 | public: 22 | void encode_into(class DER_Encoder&) const override; 23 | void decode_from(class BER_Decoder&) override; 24 | 25 | ASN1_Tag tagging() const { return m_tag; } 26 | 27 | const std::string& value() const { return m_utf8_str; } 28 | 29 | size_t size() const { return value().size(); } 30 | 31 | bool empty() const { return m_utf8_str.empty(); } 32 | 33 | std::string BOTAN_DEPRECATED("Use value() to get UTF-8 string instead") 34 | iso_8859() const; 35 | 36 | /** 37 | * Return true iff this is a tag for a known string type we can handle. 38 | * This ignores string types that are not supported, eg teletexString 39 | */ 40 | static bool is_string_type(ASN1_Tag tag); 41 | 42 | bool operator==(const ASN1_String& other) const 43 | { return value() == other.value(); } 44 | 45 | explicit ASN1_String(const std::string& utf8 = ""); 46 | ASN1_String(const std::string& utf8, ASN1_Tag tag); 47 | private: 48 | std::vector m_data; 49 | std::string m_utf8_str; 50 | ASN1_Tag m_tag; 51 | }; 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/include/botan/botan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A vague catch all include file for Botan 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_BOTAN_H_ 9 | #define BOTAN_BOTAN_H_ 10 | 11 | /* 12 | * There is no real reason for this header to exist beyond historical 13 | * reasons. The application should instead include the specific header 14 | * files that define the interfaces it intends to use. 15 | * 16 | * This header file will be removed in Botan 3.x 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #if defined(BOTAN_HAS_AUTO_SEEDING_RNG) 27 | #include 28 | #endif 29 | 30 | #if defined(BOTAN_HAS_FILTERS) 31 | #include 32 | #endif 33 | 34 | #if defined(BOTAN_HAS_PUBLIC_KEY_CRYPTO) 35 | #include 36 | #include 37 | #endif 38 | 39 | BOTAN_DEPRECATED_HEADER(botan.h) 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/include/botan/curve_nistp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Arithmetic operations specialized for NIST ECC primes 3 | * (C) 2014,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_NIST_PRIMES_H_ 9 | #define BOTAN_NIST_PRIMES_H_ 10 | 11 | #include 12 | 13 | BOTAN_FUTURE_INTERNAL_HEADER(curve_nistp.h) 14 | 15 | namespace Botan { 16 | 17 | /** 18 | * NIST Prime reduction functions. 19 | * 20 | * Reduces the value in place 21 | * 22 | * ws is a workspace function which is used as a temporary, 23 | * and will be resized as needed. 24 | */ 25 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p521(); 26 | BOTAN_PUBLIC_API(2,0) void redc_p521(BigInt& x, secure_vector& ws); 27 | 28 | /* 29 | Previously this macro indicated if the P-{192,224,256,384} reducers 30 | were available. Now they are always enabled and this macro has no meaning. 31 | The define will be removed in a future major release. 32 | */ 33 | #define BOTAN_HAS_NIST_PRIME_REDUCERS_W32 34 | 35 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p384(); 36 | BOTAN_PUBLIC_API(2,0) void redc_p384(BigInt& x, secure_vector& ws); 37 | 38 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p256(); 39 | BOTAN_PUBLIC_API(2,0) void redc_p256(BigInt& x, secure_vector& ws); 40 | 41 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p224(); 42 | BOTAN_PUBLIC_API(2,0) void redc_p224(BigInt& x, secure_vector& ws); 43 | 44 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p192(); 45 | BOTAN_PUBLIC_API(2,0) void redc_p192(BigInt& x, secure_vector& ws); 46 | 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/include/botan/hash_id.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hash Function Identification 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_HASHID_H_ 9 | #define BOTAN_HASHID_H_ 10 | 11 | #include 12 | #include 13 | 14 | namespace Botan { 15 | 16 | /** 17 | * Return the PKCS #1 hash identifier 18 | * @see RFC 3447 section 9.2 19 | * @param hash_name the name of the hash function 20 | * @return uint8_t sequence identifying the hash 21 | * @throw Invalid_Argument if the hash has no known PKCS #1 hash id 22 | */ 23 | BOTAN_PUBLIC_API(2,0) std::vector pkcs_hash_id(const std::string& hash_name); 24 | 25 | /** 26 | * Return the IEEE 1363 hash identifier 27 | * @param hash_name the name of the hash function 28 | * @return uint8_t code identifying the hash, or 0 if not known 29 | */ 30 | BOTAN_PUBLIC_API(2,0) uint8_t ieee1363_hash_id(const std::string& hash_name); 31 | 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/include/botan/init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Library Initialization 3 | * (C) 1999-2008,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_LIBRARY_INITIALIZER_H_ 9 | #define BOTAN_LIBRARY_INITIALIZER_H_ 10 | 11 | #include 12 | #include 13 | 14 | namespace Botan { 15 | 16 | BOTAN_DEPRECATED_HEADER(init.h) 17 | 18 | /* 19 | * Previously botan had state whose lifetime had to be explicitly 20 | * managed by the application. As of 1.11.14 this is no longer the 21 | * case, and this class is no longer needed and kept only for backwards 22 | * compatibility. 23 | */ 24 | class BOTAN_PUBLIC_API(2,0) BOTAN_DEPRECATED("LibraryInitializer is no longer required") LibraryInitializer final 25 | { 26 | public: 27 | explicit LibraryInitializer(const std::string& /*ignored*/ = "") { } 28 | 29 | static void initialize(const std::string& /*ignored*/ = "") {} 30 | static void deinitialize() {} 31 | }; 32 | 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/include/botan/mgf1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MGF1 3 | * (C) 1999-2007,2014 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_MGF1_H_ 9 | #define BOTAN_MGF1_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | class HashFunction; 16 | 17 | /** 18 | * MGF1 from PKCS #1 v2.0 19 | * @param hash hash function to use 20 | * @param in input buffer 21 | * @param in_len size of the input buffer in bytes 22 | * @param out output buffer 23 | * @param out_len size of the output buffer in bytes 24 | */ 25 | void BOTAN_PUBLIC_API(2,0) mgf1_mask(HashFunction& hash, 26 | const uint8_t in[], size_t in_len, 27 | uint8_t out[], size_t out_len); 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/include/botan/mutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2016 Jack Lloyd 3 | * 4 | * Botan is released under the Simplified BSD License (see license.txt) 5 | */ 6 | 7 | #ifndef BOTAN_UTIL_MUTEX_H_ 8 | #define BOTAN_UTIL_MUTEX_H_ 9 | 10 | #include 11 | 12 | #if defined(BOTAN_TARGET_OS_HAS_THREADS) 13 | 14 | #include 15 | 16 | namespace Botan { 17 | 18 | template using lock_guard_type = std::lock_guard; 19 | typedef std::mutex mutex_type; 20 | 21 | } 22 | 23 | #else 24 | 25 | // No threads 26 | 27 | namespace Botan { 28 | 29 | template 30 | class lock_guard final 31 | { 32 | public: 33 | explicit lock_guard(Mutex& m) : m_mutex(m) 34 | { m_mutex.lock(); } 35 | 36 | ~lock_guard() { m_mutex.unlock(); } 37 | 38 | lock_guard(const lock_guard& other) = delete; 39 | lock_guard& operator=(const lock_guard& other) = delete; 40 | private: 41 | Mutex& m_mutex; 42 | }; 43 | 44 | class noop_mutex final 45 | { 46 | public: 47 | void lock() {} 48 | void unlock() {} 49 | }; 50 | 51 | typedef noop_mutex mutex_type; 52 | template using lock_guard_type = lock_guard; 53 | 54 | } 55 | 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/include/botan/pk_algs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PK Key Factory 3 | * (C) 1999-2010,2016 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_PK_KEY_FACTORY_H_ 9 | #define BOTAN_PK_KEY_FACTORY_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Botan { 16 | 17 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 18 | load_public_key(const AlgorithmIdentifier& alg_id, 19 | const std::vector& key_bits); 20 | 21 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 22 | load_private_key(const AlgorithmIdentifier& alg_id, 23 | const secure_vector& key_bits); 24 | 25 | /** 26 | * Create a new key 27 | * For ECC keys, algo_params specifies EC group (eg, "secp256r1") 28 | * For DH/DSA/ElGamal keys, algo_params is DL group (eg, "modp/ietf/2048") 29 | * For RSA, algo_params is integer keylength 30 | * For McEliece, algo_params is n,t 31 | * If algo_params is left empty, suitable default parameters are chosen. 32 | */ 33 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 34 | create_private_key(const std::string& algo_name, 35 | RandomNumberGenerator& rng, 36 | const std::string& algo_params = "", 37 | const std::string& provider = ""); 38 | 39 | BOTAN_PUBLIC_API(2,2) 40 | std::vector 41 | probe_provider_private_key(const std::string& algo_name, 42 | const std::vector possible); 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/include/botan/pk_ops_fwd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PK Operation Types Forward Decls 3 | * (C) 2016 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_PK_OPERATIONS_FWD_H_ 9 | #define BOTAN_PK_OPERATIONS_FWD_H_ 10 | 11 | namespace Botan { 12 | 13 | namespace PK_Ops { 14 | 15 | class Encryption; 16 | class Decryption; 17 | class Verification; 18 | class Signature; 19 | class Key_Agreement; 20 | class KEM_Encryption; 21 | class KEM_Decryption; 22 | 23 | } 24 | 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/include/botan/system_rng.h: -------------------------------------------------------------------------------- 1 | /* 2 | * System RNG interface 3 | * (C) 2014,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_SYSTEM_RNG_H_ 9 | #define BOTAN_SYSTEM_RNG_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * Return a shared reference to a global PRNG instance provided by the 17 | * operating system. For instance might be instantiated by /dev/urandom 18 | * or CryptGenRandom. 19 | */ 20 | BOTAN_PUBLIC_API(2,0) RandomNumberGenerator& system_rng(); 21 | 22 | /* 23 | * Instantiable reference to the system RNG. 24 | */ 25 | class BOTAN_PUBLIC_API(2,0) System_RNG final : public RandomNumberGenerator 26 | { 27 | public: 28 | std::string name() const override { return system_rng().name(); } 29 | 30 | void randomize(uint8_t out[], size_t len) override { system_rng().randomize(out, len); } 31 | 32 | void add_entropy(const uint8_t in[], size_t length) override { system_rng().add_entropy(in, length); } 33 | 34 | bool is_seeded() const override { return system_rng().is_seeded(); } 35 | 36 | bool accepts_input() const override { return system_rng().accepts_input(); } 37 | 38 | void clear() override { system_rng().clear(); } 39 | }; 40 | 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/include/botan/workfactor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Public Key Work Factor Functions 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_WORKFACTOR_H_ 9 | #define BOTAN_WORKFACTOR_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * Estimate work factor for discrete logarithm 17 | * @param prime_group_size size of the group in bits 18 | * @return estimated security level for this group 19 | */ 20 | BOTAN_PUBLIC_API(2,0) size_t dl_work_factor(size_t prime_group_size); 21 | 22 | /** 23 | * Return the appropriate exponent size to use for a particular prime 24 | * group. This is twice the size of the estimated cost of breaking the 25 | * key using an index calculus attack; the assumption is that if an 26 | * arbitrary discrete log on a group of size bits would take about 2^n 27 | * effort, and thus using an exponent of size 2^(2*n) implies that all 28 | * available attacks are about as easy (as e.g Pollard's kangaroo 29 | * algorithm can compute the DL in sqrt(x) operations) while minimizing 30 | * the exponent size for performance reasons. 31 | */ 32 | BOTAN_PUBLIC_API(2,0) size_t dl_exponent_size(size_t prime_group_size); 33 | 34 | /** 35 | * Estimate work factor for integer factorization 36 | * @param n_bits size of modulus in bits 37 | * @return estimated security level for this modulus 38 | */ 39 | BOTAN_PUBLIC_API(2,0) size_t if_work_factor(size_t n_bits); 40 | 41 | /** 42 | * Estimate work factor for EC discrete logarithm 43 | * @param prime_group_size size of the group in bits 44 | * @return estimated security level for this group 45 | */ 46 | BOTAN_PUBLIC_API(2,0) size_t ecp_work_factor(size_t prime_group_size); 47 | 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/lib/botan.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/src/zd_shared_lib/src/lib/botan/win32/lib/botan.dll -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win32/lib/botan.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/src/zd_shared_lib/src/lib/botan/win32/lib/botan.lib -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/include/botan/alg_id.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Algorithm Identifier 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ALGORITHM_IDENTIFIER_H_ 9 | #define BOTAN_ALGORITHM_IDENTIFIER_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Botan { 17 | 18 | /** 19 | * Algorithm Identifier 20 | */ 21 | class BOTAN_PUBLIC_API(2,0) AlgorithmIdentifier final : public ASN1_Object 22 | { 23 | public: 24 | enum Encoding_Option { USE_NULL_PARAM, USE_EMPTY_PARAM }; 25 | 26 | void encode_into(class DER_Encoder&) const override; 27 | void decode_from(class BER_Decoder&) override; 28 | 29 | AlgorithmIdentifier() = default; 30 | 31 | AlgorithmIdentifier(const OID& oid, Encoding_Option enc); 32 | AlgorithmIdentifier(const std::string& oid_name, Encoding_Option enc); 33 | 34 | AlgorithmIdentifier(const OID& oid, const std::vector& params); 35 | AlgorithmIdentifier(const std::string& oid_name, const std::vector& params); 36 | 37 | const OID& get_oid() const { return oid; } 38 | const std::vector& get_parameters() const { return parameters; } 39 | 40 | BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES: 41 | /* 42 | * These values are public for historical reasons, but in a future release 43 | * they will be made private. Do not access them. 44 | */ 45 | OID oid; 46 | std::vector parameters; 47 | }; 48 | 49 | /* 50 | * Comparison Operations 51 | */ 52 | bool BOTAN_PUBLIC_API(2,0) operator==(const AlgorithmIdentifier&, 53 | const AlgorithmIdentifier&); 54 | bool BOTAN_PUBLIC_API(2,0) operator!=(const AlgorithmIdentifier&, 55 | const AlgorithmIdentifier&); 56 | 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/include/botan/asn1_attribute.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASN.1 Attribute 3 | * (C) 1999-2007,2012 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ASN1_ATTRIBUTE_H_ 9 | #define BOTAN_ASN1_ATTRIBUTE_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Botan { 16 | 17 | /** 18 | * Attribute 19 | */ 20 | class BOTAN_PUBLIC_API(2,0) Attribute final : public ASN1_Object 21 | { 22 | public: 23 | void encode_into(class DER_Encoder& to) const override; 24 | void decode_from(class BER_Decoder& from) override; 25 | 26 | Attribute() = default; 27 | Attribute(const OID&, const std::vector&); 28 | Attribute(const std::string&, const std::vector&); 29 | 30 | const OID& get_oid() const { return oid; } 31 | 32 | const std::vector& get_parameters() const { return parameters; } 33 | 34 | BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES: 35 | /* 36 | * These values are public for historical reasons, but in a future release 37 | * they will be made private. Do not access them. 38 | */ 39 | OID oid; 40 | std::vector parameters; 41 | }; 42 | 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/include/botan/asn1_str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASN.1 string type 3 | * (C) 1999-2010 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_ASN1_STRING_H_ 9 | #define BOTAN_ASN1_STRING_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * ASN.1 string type 17 | * This class normalizes all inputs to a UTF-8 std::string 18 | */ 19 | class BOTAN_PUBLIC_API(2,0) ASN1_String final : public ASN1_Object 20 | { 21 | public: 22 | void encode_into(class DER_Encoder&) const override; 23 | void decode_from(class BER_Decoder&) override; 24 | 25 | ASN1_Tag tagging() const { return m_tag; } 26 | 27 | const std::string& value() const { return m_utf8_str; } 28 | 29 | size_t size() const { return value().size(); } 30 | 31 | bool empty() const { return m_utf8_str.empty(); } 32 | 33 | std::string BOTAN_DEPRECATED("Use value() to get UTF-8 string instead") 34 | iso_8859() const; 35 | 36 | /** 37 | * Return true iff this is a tag for a known string type we can handle. 38 | * This ignores string types that are not supported, eg teletexString 39 | */ 40 | static bool is_string_type(ASN1_Tag tag); 41 | 42 | bool operator==(const ASN1_String& other) const 43 | { return value() == other.value(); } 44 | 45 | explicit ASN1_String(const std::string& utf8 = ""); 46 | ASN1_String(const std::string& utf8, ASN1_Tag tag); 47 | private: 48 | std::vector m_data; 49 | std::string m_utf8_str; 50 | ASN1_Tag m_tag; 51 | }; 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/include/botan/botan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A vague catch all include file for Botan 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_BOTAN_H_ 9 | #define BOTAN_BOTAN_H_ 10 | 11 | /* 12 | * There is no real reason for this header to exist beyond historical 13 | * reasons. The application should instead include the specific header 14 | * files that define the interfaces it intends to use. 15 | * 16 | * This header file will be removed in Botan 3.x 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #if defined(BOTAN_HAS_AUTO_SEEDING_RNG) 27 | #include 28 | #endif 29 | 30 | #if defined(BOTAN_HAS_FILTERS) 31 | #include 32 | #endif 33 | 34 | #if defined(BOTAN_HAS_PUBLIC_KEY_CRYPTO) 35 | #include 36 | #include 37 | #endif 38 | 39 | BOTAN_DEPRECATED_HEADER(botan.h) 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/include/botan/curve_nistp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Arithmetic operations specialized for NIST ECC primes 3 | * (C) 2014,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_NIST_PRIMES_H_ 9 | #define BOTAN_NIST_PRIMES_H_ 10 | 11 | #include 12 | 13 | BOTAN_FUTURE_INTERNAL_HEADER(curve_nistp.h) 14 | 15 | namespace Botan { 16 | 17 | /** 18 | * NIST Prime reduction functions. 19 | * 20 | * Reduces the value in place 21 | * 22 | * ws is a workspace function which is used as a temporary, 23 | * and will be resized as needed. 24 | */ 25 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p521(); 26 | BOTAN_PUBLIC_API(2,0) void redc_p521(BigInt& x, secure_vector& ws); 27 | 28 | /* 29 | Previously this macro indicated if the P-{192,224,256,384} reducers 30 | were available. Now they are always enabled and this macro has no meaning. 31 | The define will be removed in a future major release. 32 | */ 33 | #define BOTAN_HAS_NIST_PRIME_REDUCERS_W32 34 | 35 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p384(); 36 | BOTAN_PUBLIC_API(2,0) void redc_p384(BigInt& x, secure_vector& ws); 37 | 38 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p256(); 39 | BOTAN_PUBLIC_API(2,0) void redc_p256(BigInt& x, secure_vector& ws); 40 | 41 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p224(); 42 | BOTAN_PUBLIC_API(2,0) void redc_p224(BigInt& x, secure_vector& ws); 43 | 44 | BOTAN_PUBLIC_API(2,0) const BigInt& prime_p192(); 45 | BOTAN_PUBLIC_API(2,0) void redc_p192(BigInt& x, secure_vector& ws); 46 | 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/include/botan/hash_id.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hash Function Identification 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_HASHID_H_ 9 | #define BOTAN_HASHID_H_ 10 | 11 | #include 12 | #include 13 | 14 | namespace Botan { 15 | 16 | /** 17 | * Return the PKCS #1 hash identifier 18 | * @see RFC 3447 section 9.2 19 | * @param hash_name the name of the hash function 20 | * @return uint8_t sequence identifying the hash 21 | * @throw Invalid_Argument if the hash has no known PKCS #1 hash id 22 | */ 23 | BOTAN_PUBLIC_API(2,0) std::vector pkcs_hash_id(const std::string& hash_name); 24 | 25 | /** 26 | * Return the IEEE 1363 hash identifier 27 | * @param hash_name the name of the hash function 28 | * @return uint8_t code identifying the hash, or 0 if not known 29 | */ 30 | BOTAN_PUBLIC_API(2,0) uint8_t ieee1363_hash_id(const std::string& hash_name); 31 | 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/include/botan/init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Library Initialization 3 | * (C) 1999-2008,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_LIBRARY_INITIALIZER_H_ 9 | #define BOTAN_LIBRARY_INITIALIZER_H_ 10 | 11 | #include 12 | #include 13 | 14 | namespace Botan { 15 | 16 | BOTAN_DEPRECATED_HEADER(init.h) 17 | 18 | /* 19 | * Previously botan had state whose lifetime had to be explicitly 20 | * managed by the application. As of 1.11.14 this is no longer the 21 | * case, and this class is no longer needed and kept only for backwards 22 | * compatibility. 23 | */ 24 | class BOTAN_PUBLIC_API(2,0) BOTAN_DEPRECATED("LibraryInitializer is no longer required") LibraryInitializer final 25 | { 26 | public: 27 | explicit LibraryInitializer(const std::string& /*ignored*/ = "") { } 28 | 29 | static void initialize(const std::string& /*ignored*/ = "") {} 30 | static void deinitialize() {} 31 | }; 32 | 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/include/botan/mgf1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MGF1 3 | * (C) 1999-2007,2014 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_MGF1_H_ 9 | #define BOTAN_MGF1_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | class HashFunction; 16 | 17 | /** 18 | * MGF1 from PKCS #1 v2.0 19 | * @param hash hash function to use 20 | * @param in input buffer 21 | * @param in_len size of the input buffer in bytes 22 | * @param out output buffer 23 | * @param out_len size of the output buffer in bytes 24 | */ 25 | void BOTAN_PUBLIC_API(2,0) mgf1_mask(HashFunction& hash, 26 | const uint8_t in[], size_t in_len, 27 | uint8_t out[], size_t out_len); 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/include/botan/mutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2016 Jack Lloyd 3 | * 4 | * Botan is released under the Simplified BSD License (see license.txt) 5 | */ 6 | 7 | #ifndef BOTAN_UTIL_MUTEX_H_ 8 | #define BOTAN_UTIL_MUTEX_H_ 9 | 10 | #include 11 | 12 | #if defined(BOTAN_TARGET_OS_HAS_THREADS) 13 | 14 | #include 15 | 16 | namespace Botan { 17 | 18 | template using lock_guard_type = std::lock_guard; 19 | typedef std::mutex mutex_type; 20 | 21 | } 22 | 23 | #else 24 | 25 | // No threads 26 | 27 | namespace Botan { 28 | 29 | template 30 | class lock_guard final 31 | { 32 | public: 33 | explicit lock_guard(Mutex& m) : m_mutex(m) 34 | { m_mutex.lock(); } 35 | 36 | ~lock_guard() { m_mutex.unlock(); } 37 | 38 | lock_guard(const lock_guard& other) = delete; 39 | lock_guard& operator=(const lock_guard& other) = delete; 40 | private: 41 | Mutex& m_mutex; 42 | }; 43 | 44 | class noop_mutex final 45 | { 46 | public: 47 | void lock() {} 48 | void unlock() {} 49 | }; 50 | 51 | typedef noop_mutex mutex_type; 52 | template using lock_guard_type = lock_guard; 53 | 54 | } 55 | 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/include/botan/pk_algs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PK Key Factory 3 | * (C) 1999-2010,2016 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_PK_KEY_FACTORY_H_ 9 | #define BOTAN_PK_KEY_FACTORY_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Botan { 16 | 17 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 18 | load_public_key(const AlgorithmIdentifier& alg_id, 19 | const std::vector& key_bits); 20 | 21 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 22 | load_private_key(const AlgorithmIdentifier& alg_id, 23 | const secure_vector& key_bits); 24 | 25 | /** 26 | * Create a new key 27 | * For ECC keys, algo_params specifies EC group (eg, "secp256r1") 28 | * For DH/DSA/ElGamal keys, algo_params is DL group (eg, "modp/ietf/2048") 29 | * For RSA, algo_params is integer keylength 30 | * For McEliece, algo_params is n,t 31 | * If algo_params is left empty, suitable default parameters are chosen. 32 | */ 33 | BOTAN_PUBLIC_API(2,0) std::unique_ptr 34 | create_private_key(const std::string& algo_name, 35 | RandomNumberGenerator& rng, 36 | const std::string& algo_params = "", 37 | const std::string& provider = ""); 38 | 39 | BOTAN_PUBLIC_API(2,2) 40 | std::vector 41 | probe_provider_private_key(const std::string& algo_name, 42 | const std::vector possible); 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/include/botan/pk_ops_fwd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PK Operation Types Forward Decls 3 | * (C) 2016 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_PK_OPERATIONS_FWD_H_ 9 | #define BOTAN_PK_OPERATIONS_FWD_H_ 10 | 11 | namespace Botan { 12 | 13 | namespace PK_Ops { 14 | 15 | class Encryption; 16 | class Decryption; 17 | class Verification; 18 | class Signature; 19 | class Key_Agreement; 20 | class KEM_Encryption; 21 | class KEM_Decryption; 22 | 23 | } 24 | 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/include/botan/system_rng.h: -------------------------------------------------------------------------------- 1 | /* 2 | * System RNG interface 3 | * (C) 2014,2015 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_SYSTEM_RNG_H_ 9 | #define BOTAN_SYSTEM_RNG_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * Return a shared reference to a global PRNG instance provided by the 17 | * operating system. For instance might be instantiated by /dev/urandom 18 | * or CryptGenRandom. 19 | */ 20 | BOTAN_PUBLIC_API(2,0) RandomNumberGenerator& system_rng(); 21 | 22 | /* 23 | * Instantiable reference to the system RNG. 24 | */ 25 | class BOTAN_PUBLIC_API(2,0) System_RNG final : public RandomNumberGenerator 26 | { 27 | public: 28 | std::string name() const override { return system_rng().name(); } 29 | 30 | void randomize(uint8_t out[], size_t len) override { system_rng().randomize(out, len); } 31 | 32 | void add_entropy(const uint8_t in[], size_t length) override { system_rng().add_entropy(in, length); } 33 | 34 | bool is_seeded() const override { return system_rng().is_seeded(); } 35 | 36 | bool accepts_input() const override { return system_rng().accepts_input(); } 37 | 38 | void clear() override { system_rng().clear(); } 39 | }; 40 | 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/include/botan/workfactor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Public Key Work Factor Functions 3 | * (C) 1999-2007 Jack Lloyd 4 | * 5 | * Botan is released under the Simplified BSD License (see license.txt) 6 | */ 7 | 8 | #ifndef BOTAN_WORKFACTOR_H_ 9 | #define BOTAN_WORKFACTOR_H_ 10 | 11 | #include 12 | 13 | namespace Botan { 14 | 15 | /** 16 | * Estimate work factor for discrete logarithm 17 | * @param prime_group_size size of the group in bits 18 | * @return estimated security level for this group 19 | */ 20 | BOTAN_PUBLIC_API(2,0) size_t dl_work_factor(size_t prime_group_size); 21 | 22 | /** 23 | * Return the appropriate exponent size to use for a particular prime 24 | * group. This is twice the size of the estimated cost of breaking the 25 | * key using an index calculus attack; the assumption is that if an 26 | * arbitrary discrete log on a group of size bits would take about 2^n 27 | * effort, and thus using an exponent of size 2^(2*n) implies that all 28 | * available attacks are about as easy (as e.g Pollard's kangaroo 29 | * algorithm can compute the DL in sqrt(x) operations) while minimizing 30 | * the exponent size for performance reasons. 31 | */ 32 | BOTAN_PUBLIC_API(2,0) size_t dl_exponent_size(size_t prime_group_size); 33 | 34 | /** 35 | * Estimate work factor for integer factorization 36 | * @param n_bits size of modulus in bits 37 | * @return estimated security level for this modulus 38 | */ 39 | BOTAN_PUBLIC_API(2,0) size_t if_work_factor(size_t n_bits); 40 | 41 | /** 42 | * Estimate work factor for EC discrete logarithm 43 | * @param prime_group_size size of the group in bits 44 | * @return estimated security level for this group 45 | */ 46 | BOTAN_PUBLIC_API(2,0) size_t ecp_work_factor(size_t prime_group_size); 47 | 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/lib/botan.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/src/zd_shared_lib/src/lib/botan/win64/lib/botan.dll -------------------------------------------------------------------------------- /src/zd_shared_lib/src/lib/botan/win64/lib/botan.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sin2000/zdownloader/39d563f57425d95286f5913114933e1f3bbda5d3/src/zd_shared_lib/src/lib/botan/win64/lib/botan.lib -------------------------------------------------------------------------------- /src/zd_shared_lib/src/meta_object_ext.cpp: -------------------------------------------------------------------------------- 1 | #include "meta_object_ext.h" 2 | #include 3 | 4 | QUrlQuery meta_object_ext::custobj_to_url_query(const QMetaObject & meta_obj, const void * obj) 5 | { 6 | QUrlQuery url_query; 7 | 8 | const int prop_count = meta_obj.propertyCount(); 9 | for(int i = 0; i < prop_count; ++i) 10 | { 11 | const QMetaProperty prop = meta_obj.property(i); 12 | const char * name = prop.name(); 13 | QVariant val = prop.readOnGadget(obj); 14 | if(val.isValid()) 15 | { 16 | switch(val.type()) 17 | { 18 | case QVariant::Int: 19 | if(val.toInt() == -1) 20 | continue; 21 | break; 22 | 23 | case QVariant::String: 24 | if(val.toString().isNull()) 25 | continue; 26 | break; 27 | 28 | default: 29 | break; 30 | } 31 | 32 | url_query.addQueryItem(QString::fromLatin1(name), val.toString()); 33 | } 34 | } 35 | 36 | return url_query; 37 | } 38 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/meta_object_ext.h: -------------------------------------------------------------------------------- 1 | #ifndef META_OBJECT_EXT_H 2 | #define META_OBJECT_EXT_H 3 | 4 | #include "zd_shared_lib_global.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace detail { 11 | template 12 | struct FEvent : QEvent 13 | { 14 | using Fun = typename std::decay::type; 15 | const QObject * const obj; 16 | const QMetaObject * const type = obj->metaObject(); 17 | Fun fun; 18 | 19 | template 20 | FEvent(const QObject * object, Fun && func) 21 | :QEvent(QEvent::None), 22 | obj(object), 23 | fun(std::forward(func)) 24 | { 25 | } 26 | 27 | ~FEvent() 28 | { 29 | if(obj->metaObject()->inherits(type)) // ensure that the object is not being destructed 30 | fun(); 31 | } 32 | }; 33 | } 34 | 35 | class ZD_SHARED_LIB_EXPORT meta_object_ext 36 | { 37 | public: 38 | // obj must have Q_GADGET inside 39 | static QUrlQuery custobj_to_url_query(const QMetaObject & meta_obj, const void * obj); 40 | 41 | template 42 | static void post_to_object(F && fun, QObject * obj) 43 | { 44 | QCoreApplication::postEvent(obj, new detail::FEvent(obj, std::forward(fun))); 45 | } 46 | 47 | // use example: meta_object_ext::invoke_async(this, &scp_user_guest::set_post_body, input); 48 | template 49 | static void invoke_async(T * object, R (T::*function)(Params...), Args &&... args) 50 | { 51 | post_to_object(std::bind(function, object, std::forward(args)...), object); 52 | } 53 | }; 54 | 55 | #endif // META_OBJECT_EXT_H 56 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/qt_compat.cpp: -------------------------------------------------------------------------------- 1 | #include "qt_compat.h" 2 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/qt_compat.h: -------------------------------------------------------------------------------- 1 | #ifndef QT_COMPAT_H 2 | #define QT_COMPAT_H 3 | 4 | #include 5 | #include 6 | 7 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) 8 | 9 | #include 10 | 11 | namespace qt_compat { 12 | constexpr auto split_skip_empty_parts = Qt::SkipEmptyParts; 13 | constexpr auto split_keep_empty_parts = Qt::KeepEmptyParts; 14 | constexpr auto endl = Qt::endl; 15 | } 16 | 17 | #else 18 | 19 | #include 20 | 21 | namespace qt_compat { 22 | constexpr QString::SplitBehavior split_skip_empty_parts = QString::SkipEmptyParts; 23 | constexpr QString::SplitBehavior split_keep_empty_parts = QString::KeepEmptyParts; 24 | constexpr auto endl = ::endl; 25 | } 26 | 27 | #endif 28 | 29 | #endif // QT_COMPAT_H 30 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/string_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef STRING_UTILS_H 2 | #define STRING_UTILS_H 3 | 4 | #include "zd_shared_lib_global.h" 5 | #include 6 | 7 | class ZD_SHARED_LIB_EXPORT string_utils 8 | { 9 | public: 10 | string_utils(); 11 | //example QSet() << '0' << '1' << '2'; 12 | static int find_first_of(const QSet & chars, const QString & text, int from = 0); 13 | static QString pull_string(const QString & src, const QString & start, const QString & end = ""); 14 | static QString seconds_to_string(qint64 seconds); 15 | static QString bytes_to_human_readable_string(qint64 bytes); 16 | static QString remove_all_whitespace(const QString & text); 17 | }; 18 | 19 | #endif // STRING_UTILS_H 20 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/unit_tests/main_unit_tests.cpp: -------------------------------------------------------------------------------- 1 | #include "botan_wrapper_tests.h" 2 | #include "string_utils_tests.h" 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QCoreApplication app(argc, argv); 8 | 9 | int status = 0; 10 | 11 | { 12 | botan_wrapper_tests tc; 13 | status |= QTest::qExec(&tc, argc, argv); 14 | } 15 | 16 | { 17 | string_utils_tests tc; 18 | status |= QTest::qExec(&tc, argc, argv); 19 | } 20 | 21 | return status; 22 | } 23 | -------------------------------------------------------------------------------- /src/zd_shared_lib/src/zd_shared_lib_global.h: -------------------------------------------------------------------------------- 1 | #ifndef ZD_SHARED_LIB_GLOBAL_H 2 | #define ZD_SHARED_LIB_GLOBAL_H 3 | 4 | #include 5 | 6 | #ifndef ZD_STATIC_LINKAGE 7 | #if defined(UNIT_TEST) && defined(ZD_SHARED_LIB_LIBRARY) 8 | #define ZD_SHARED_LIB_EXPORT 9 | #else 10 | #ifdef ZD_SHARED_LIB_LIBRARY 11 | #define ZD_SHARED_LIB_EXPORT Q_DECL_EXPORT 12 | #else 13 | #define ZD_SHARED_LIB_EXPORT Q_DECL_IMPORT 14 | #endif 15 | #endif 16 | #else 17 | #define ZD_SHARED_LIB_EXPORT 18 | #endif 19 | 20 | #endif // ZD_SHARED_LIB_GLOBAL_H 21 | -------------------------------------------------------------------------------- /src/zdownloader/src/app_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef APP_SETTINGS_H 2 | #define APP_SETTINGS_H 3 | 4 | #include "settings/general_settings.h" 5 | #include "settings/links_checker_settings.h" 6 | #include "settings/downloader_settings.h" 7 | #include "settings/output_messages_settings.h" 8 | #include "settings/unpack_settings.h" 9 | #include "settings/net_proxy_settings.h" 10 | #include "settings/scheduler_settings.h" 11 | #include "settings/unpacklog_settings.h" 12 | #include 13 | #include 14 | 15 | class QSettings; 16 | 17 | class app_settings 18 | { 19 | public: 20 | void load(); 21 | 22 | const QString settings_file_path = "./zdownloader.ini"; 23 | 24 | general_settings general; 25 | links_checker_settings link_checker; 26 | downloader_settings downloader; 27 | output_messages_settings out_msgs; 28 | finished_downloads_settings fin_dls; 29 | unpack_settings unpack; 30 | net_proxy_settings net_proxy; 31 | scheduler_settings scheduler; 32 | gdrive_settings gdrive; 33 | unpacklog_settings unpacklog; 34 | 35 | private: 36 | void load_general_settings(QSettings * s); 37 | void load_links_checker_settings(QSettings * s); 38 | void load_downloader_settings(QSettings * s); 39 | void load_output_messages_settings(QSettings * s); 40 | void load_finished_downloads_settings(QSettings * s); 41 | void load_unpack_settings(QSettings * s); 42 | void load_net_proxy_settings(QSettings * s); 43 | void load_scheduler_settings(QSettings * s); 44 | void load_gdrive_settings(QSettings * s); 45 | void load_upacklog_settings(QSettings * s); 46 | }; 47 | 48 | #endif // APP_SETTINGS_H 49 | -------------------------------------------------------------------------------- /src/zdownloader/src/cmd_runner.h: -------------------------------------------------------------------------------- 1 | #ifndef CMD_RUNNER_H 2 | #define CMD_RUNNER_H 3 | 4 | #include "app_settings.h" 5 | #include 6 | #include 7 | 8 | class unpack; 9 | class fn_scheduler; 10 | 11 | class cmd_runner : public QObject 12 | { 13 | Q_OBJECT 14 | public: 15 | cmd_runner(app_settings * app_prefs); 16 | ~cmd_runner(); 17 | void unix_signal_received(int signal); 18 | void win_signal_received(); 19 | 20 | private: 21 | void zdown_net_init_finished(); 22 | void reload_settings(); 23 | bool apply_settings(); 24 | bool apply_unpacklog_settings(); 25 | bool apply_scheduler_settings(); 26 | bool apply_gdrive_settings(); 27 | void set_application_proxy(const net_proxy_settings & proxy_prefs); 28 | 29 | void load_state(); 30 | void load_state_finished(const QString & error_text); 31 | void start_downloads(); 32 | void scheduler_stop_triggered(); 33 | void download_finished(const QString & error_text); 34 | void downloader_last_item_in_group_finished(const QString & filename); 35 | void unpack_queue_finished(); 36 | void schedule_system_shutdown(); 37 | 38 | void exit_app(bool allow_schedule_shutdown); 39 | void stop_zd_net(); 40 | void zdown_net_finished(); 41 | 42 | app_settings * app_set; 43 | const QString log_dir = "./logs"; 44 | zdownloader_net_lib * zdown_net; 45 | 46 | bool init_finished; 47 | bool shutdown_system_on_finish; 48 | bool all_downloads_finished; 49 | unpack * unpack_mod; 50 | 51 | fn_scheduler * start_download_sched; 52 | fn_scheduler * stop_download_sched; 53 | }; 54 | 55 | #endif // CMD_RUNNER_H 56 | -------------------------------------------------------------------------------- /src/zdownloader/src/fn_scheduler.cpp: -------------------------------------------------------------------------------- 1 | #include "fn_scheduler.h" 2 | #include 3 | #include 4 | 5 | fn_scheduler::fn_scheduler(QObject * parent) 6 | :QObject(parent), 7 | check_timer(new QTimer(this)) 8 | { 9 | check_timer->setSingleShot(true); 10 | check_timer->setTimerType(Qt::PreciseTimer); 11 | connect(check_timer, &QTimer::timeout, this, &fn_scheduler::timeout); 12 | } 13 | 14 | void fn_scheduler::set_activation_time(const QTime & time) 15 | { 16 | act_date.setTime(time); 17 | } 18 | 19 | void fn_scheduler::start() 20 | { 21 | const QDateTime now = QDateTime::currentDateTime(); 22 | act_date.setDate(now.date()); 23 | if(act_date.time() < now.time()) 24 | act_date = act_date.addDays(1); 25 | 26 | const int msecs = static_cast(now.msecsTo(act_date)); 27 | check_timer->start(msecs); 28 | qDebug() << "fn_scheduler activation at:" << act_date; 29 | } 30 | 31 | bool fn_scheduler::is_active() const 32 | { 33 | return check_timer->isActive(); 34 | } 35 | 36 | void fn_scheduler::timeout() 37 | { 38 | qDebug() << "fn_scheduler activated"; 39 | emit activated(); 40 | } 41 | -------------------------------------------------------------------------------- /src/zdownloader/src/fn_scheduler.h: -------------------------------------------------------------------------------- 1 | #ifndef FN_SCHEDULER_H 2 | #define FN_SCHEDULER_H 3 | 4 | #include 5 | #include 6 | 7 | class QTimer; 8 | 9 | class fn_scheduler : public QObject 10 | { 11 | Q_OBJECT 12 | public: 13 | fn_scheduler(QObject * parent = nullptr); 14 | void set_activation_time(const QTime & time); 15 | void start(); 16 | bool is_active() const; 17 | 18 | signals: 19 | void activated(); 20 | 21 | private: 22 | void timeout(); 23 | 24 | QDateTime act_date; 25 | QTimer * check_timer; 26 | }; 27 | 28 | #endif // FN_SCHEDULER_H 29 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/downloader_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef DOWNLOADER_SETTINGS_H 2 | #define DOWNLOADER_SETTINGS_H 3 | 4 | #include 5 | 6 | class downloader_settings 7 | { 8 | public: 9 | QString validate() const; 10 | 11 | int max_parallel_file_downloads = 1; 12 | int max_segments_per_file = 1; 13 | int min_segment_size_mb = 4; 14 | int segment_network_read_buffer_kb = 1024; 15 | int segment_file_write_buffer_kb = 1024; 16 | int min_seconds_before_next_download = 0; 17 | int max_seconds_before_next_download = 7; 18 | int next_download_increase_step_msecs = 250; 19 | int next_download_increase_reset_after_seconds = 8; 20 | int progress_check_interval_seconds = 15; 21 | int speed_check_interval_seconds = 8; 22 | int user_reconnect_interval_minutes = 4; 23 | int min_avg_speed_before_reconnect_mbps = 13; 24 | }; 25 | 26 | #endif // DOWNLOADER_SETTINGS_H 27 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/general_settings.cpp: -------------------------------------------------------------------------------- 1 | #include "general_settings.h" 2 | 3 | QString general_settings::validate() const 4 | { 5 | const int min = 10; 6 | const int max = 12 * 60 * 60; 7 | 8 | if(max_seconds_before_reset_inactive_connection < min 9 | || max_seconds_before_reset_inactive_connection > max) 10 | { 11 | return "max_seconds_before_reset_inactive_connection must be: from " + QString::number(min) + " to " + QString::number(max); 12 | } 13 | 14 | return ""; 15 | } 16 | 17 | void general_settings::correct_dirs() 18 | { 19 | if(download_directory.isEmpty()) 20 | download_directory = "."; 21 | if(download_lists_directory.isEmpty()) 22 | download_lists_directory = "."; 23 | if(links_file_directory.isEmpty()) 24 | links_file_directory = "."; 25 | } 26 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/general_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef GENERAL_SETTINGS_H 2 | #define GENERAL_SETTINGS_H 3 | 4 | #include 5 | 6 | class general_settings 7 | { 8 | public: 9 | QString validate() const; 10 | void correct_dirs(); 11 | 12 | QString download_directory; 13 | QString user_agent_for_https_connections; 14 | bool shutdown_system_on_finish = false; 15 | int max_seconds_before_reset_inactive_connection = 60; 16 | QString download_lists_directory; 17 | QString links_file_directory; 18 | }; 19 | 20 | #endif // GENERAL_SETTINGS_H 21 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/links_checker_settings.cpp: -------------------------------------------------------------------------------- 1 | #include "links_checker_settings.h" 2 | 3 | QString links_checker_settings::validate() const 4 | { 5 | int min = 1; 6 | int max = 20; 7 | if(max_parallel_link_checks < min 8 | || max_parallel_link_checks > max) 9 | { 10 | return "max_parallel_link_checks must be: from " + QString::number(min) + " to " + QString::number(max); 11 | } 12 | 13 | min = 1; 14 | max = 3600; 15 | if(max_seconds_before_check_link_again_on_error < min 16 | || max_seconds_before_check_link_again_on_error > max) 17 | { 18 | return "max_seconds_before_check_link_again_on_error must be: from " + QString::number(min) + " to " + QString::number(max); 19 | } 20 | 21 | return ""; 22 | } 23 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/links_checker_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef LINKS_CHECKER_SETTINGS_H 2 | #define LINKS_CHECKER_SETTINGS_H 3 | 4 | #include 5 | 6 | class links_checker_settings 7 | { 8 | public: 9 | QString validate() const; 10 | 11 | int max_parallel_link_checks = 5; 12 | int max_seconds_before_check_link_again_on_error = 10; 13 | }; 14 | 15 | #endif // LINKS_CHECKER_SETTINGS_H 16 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/net_proxy_settings.cpp: -------------------------------------------------------------------------------- 1 | #include "net_proxy_settings.h" 2 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/net_proxy_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef NET_PROXY_SETTINGS_H 2 | #define NET_PROXY_SETTINGS_H 3 | 4 | #include 5 | #include 6 | 7 | class net_proxy_settings 8 | { 9 | public: 10 | bool enable_network_proxy = false; 11 | QNetworkProxy::ProxyType proxy_type = QNetworkProxy::Socks5Proxy; 12 | QString hostname; 13 | quint16 port = 8000; 14 | QString username; 15 | QString password; 16 | }; 17 | 18 | #endif // NET_PROXY_SETTINGS_H 19 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/output_messages_settings.cpp: -------------------------------------------------------------------------------- 1 | #include "output_messages_settings.h" 2 | 3 | QString output_messages_settings::validate() const 4 | { 5 | int min = 256; 6 | int max = 512000; 7 | if(log_max_rotate_kb < min || log_max_rotate_kb > max) 8 | return "log_max_rotate_kb must be: from " + QString::number(min) + " to " + QString::number(max); 9 | 10 | min = 1; 11 | max = 9; 12 | if(log_max_archive_files < min || log_max_archive_files > max) 13 | return "log_max_archive_files must be: from " + QString::number(min) + " to " + QString::number(max); 14 | 15 | return ""; 16 | } 17 | 18 | void output_messages_settings::correct_dirs() 19 | { 20 | if(log_directory.isEmpty()) 21 | log_directory = "."; 22 | } 23 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/output_messages_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef OUTPUT_MESSAGES_SETTINGS_H 2 | #define OUTPUT_MESSAGES_SETTINGS_H 3 | 4 | #include 5 | 6 | class output_messages_settings 7 | { 8 | public: 9 | QString validate() const; 10 | void correct_dirs(); 11 | 12 | bool log_to_file_enabled = true; 13 | QString log_directory; 14 | QString timestamp_format; 15 | int log_max_rotate_kb = 4096; 16 | int log_max_archive_files = 3; 17 | }; 18 | 19 | #endif // OUTPUT_MESSAGES_SETTINGS_H 20 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/scheduler_settings.cpp: -------------------------------------------------------------------------------- 1 | #include "scheduler_settings.h" 2 | 3 | QString scheduler_settings::validate() const 4 | { 5 | if(scheduler_enabled == false) 6 | return ""; 7 | 8 | if(start_download_at.isValid() == false) 9 | return "start_download_at is invalid"; 10 | 11 | if(stop_download_at.isValid() == false) 12 | return "stop_download_at is invalid"; 13 | 14 | if(start_download_at == stop_download_at) 15 | return "start_download_at is same as stop_download_at"; 16 | 17 | return ""; 18 | } 19 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/scheduler_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef SCHEDULER_SETTINGS_H 2 | #define SCHEDULER_SETTINGS_H 3 | 4 | #include 5 | 6 | class scheduler_settings 7 | { 8 | public: 9 | QString validate() const; 10 | 11 | bool scheduler_enabled = true; 12 | QDateTime start_download_at; 13 | QDateTime stop_download_at; 14 | }; 15 | 16 | #endif // SCHEDULER_SETTINGS_H 17 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/unpack_settings.cpp: -------------------------------------------------------------------------------- 1 | #include "unpack_settings.h" 2 | 3 | QString unpack_settings::validate() const 4 | { 5 | if(unpack_passwords_size_error) 6 | return "UnpackPasswords not readed. Size must be from 0 to 20"; 7 | 8 | return ""; 9 | } 10 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/unpack_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef UNPACK_SETTINGS_H 2 | #define UNPACK_SETTINGS_H 3 | 4 | #include 5 | 6 | class unpack_settings 7 | { 8 | public: 9 | QString validate() const; 10 | 11 | bool unpack_after_download = true; 12 | bool pause_download_before_unpack = false; 13 | bool delete_archive_files_after_unpack = true; 14 | QString unrar_binary; 15 | QString seven_zip_binary; 16 | QStringList passwords; 17 | bool unpack_passwords_size_error = false; 18 | }; 19 | 20 | #endif // UNPACK_SETTINGS_H 21 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/unpacklog_settings.cpp: -------------------------------------------------------------------------------- 1 | #include "unpacklog_settings.h" 2 | 3 | QString unpacklog_settings::validate() const 4 | { 5 | if(log_to_file_enabled) 6 | { 7 | int min = 256; 8 | int max = 512000; 9 | if(log_max_rotate_kb < min || log_max_rotate_kb > max) 10 | return "log_max_rotate_kb must be: from " + QString::number(min) + " to " + QString::number(max); 11 | 12 | min = 1; 13 | max = 9; 14 | if(log_max_archive_files < min || log_max_archive_files > max) 15 | return "log_max_archive_files must be: from " + QString::number(min) + " to " + QString::number(max); 16 | } 17 | 18 | return ""; 19 | } 20 | 21 | void unpacklog_settings::correct_dirs() 22 | { 23 | if(log_directory.isEmpty()) 24 | log_directory = "."; 25 | } 26 | -------------------------------------------------------------------------------- /src/zdownloader/src/settings/unpacklog_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef UNPACKLOG_SETTINGS_H 2 | #define UNPACKLOG_SETTINGS_H 3 | 4 | #include 5 | 6 | class unpacklog_settings 7 | { 8 | public: 9 | QString validate() const; 10 | void correct_dirs(); 11 | 12 | bool log_to_file_enabled = true; 13 | QString log_directory; 14 | QString timestamp_format; 15 | int log_max_rotate_kb = 512; 16 | int log_max_archive_files = 2; 17 | }; 18 | 19 | #endif // UNPACKLOG_SETTINGS_H 20 | -------------------------------------------------------------------------------- /src/zdownloader/src/unix_sigwatch.cpp: -------------------------------------------------------------------------------- 1 | #include "unix_sigwatch.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int unix_sigwatch::sockpair[]; 10 | 11 | unix_sigwatch::unix_sigwatch(QObject *parent) 12 | :QObject(parent) 13 | { 14 | if(::socketpair(AF_UNIX, SOCK_STREAM, 0, sockpair)) 15 | { 16 | qDebug() << "unix_sigwatch: socketpair: " << ::strerror(errno); 17 | return; 18 | } 19 | 20 | notifier = new QSocketNotifier(sockpair[1], QSocketNotifier::Read, this); 21 | QObject::connect(notifier, &QSocketNotifier::activated, this, &unix_sigwatch::socket_notifier_activated); 22 | notifier->setEnabled(true); 23 | } 24 | 25 | void unix_sigwatch::watch_for_signal(int signal) 26 | { 27 | if(watched_signals.contains(signal)) 28 | { 29 | qDebug() << "Already watching for signal" << signal; 30 | return; 31 | } 32 | 33 | struct sigaction sigact; 34 | sigact.sa_handler = unix_sigwatch::signal_handler; 35 | sigact.sa_flags = 0; 36 | sigemptyset(&sigact.sa_mask); 37 | sigact.sa_flags |= SA_RESTART; 38 | if(::sigaction(signal, &sigact, nullptr)) 39 | { 40 | qDebug() << "unix_sigwatch - sigaction: " << ::strerror(errno); 41 | return; 42 | } 43 | 44 | watched_signals.append(signal); 45 | } 46 | 47 | void unix_sigwatch::signal_handler(int signal) 48 | { 49 | ::write(sockpair[0], &signal, sizeof(signal)); 50 | } 51 | 52 | void unix_sigwatch::socket_notifier_activated(int socket) 53 | { 54 | int signal; 55 | ::read(socket, &signal, sizeof(signal)); 56 | qDebug() << "Caught signal:" << ::strsignal(signal); 57 | emit unix_signal(signal); 58 | } 59 | -------------------------------------------------------------------------------- /src/zdownloader/src/unix_sigwatch.h: -------------------------------------------------------------------------------- 1 | #ifndef SIGWATCH_H 2 | #define SIGWATCH_H 3 | 4 | #include 5 | #include 6 | 7 | class QSocketNotifier; 8 | 9 | class unix_sigwatch : public QObject 10 | { 11 | Q_OBJECT 12 | public: 13 | unix_sigwatch(QObject * parent = nullptr); 14 | void watch_for_signal(int signal); 15 | 16 | signals: 17 | void unix_signal(int signal); 18 | 19 | private: 20 | static void signal_handler(int signal); 21 | void socket_notifier_activated(int socket); 22 | 23 | static int sockpair[2]; 24 | QSocketNotifier * notifier; 25 | QList watched_signals; 26 | }; 27 | 28 | #endif // SIGWATCH_H 29 | -------------------------------------------------------------------------------- /src/zdownloader/src/win_sigwatch.cpp: -------------------------------------------------------------------------------- 1 | #include "win_sigwatch.h" 2 | #include 3 | 4 | win_sigwatch * win_sigwatch::myobj = nullptr; 5 | 6 | win_sigwatch::win_sigwatch(QObject *parent) 7 | :QObject(parent) 8 | { 9 | win_sigwatch::myobj = this; 10 | } 11 | 12 | void win_sigwatch::watch_for_signals() 13 | { 14 | SetConsoleCtrlHandler(&win_sigwatch::CtrlHandler, TRUE); 15 | } 16 | 17 | BOOL WINAPI win_sigwatch::CtrlHandler(DWORD fdwCtrlType) 18 | { 19 | switch (fdwCtrlType) 20 | { 21 | // Handle the CTRL-C signal. 22 | case CTRL_C_EVENT: 23 | case CTRL_CLOSE_EVENT: 24 | case CTRL_LOGOFF_EVENT: 25 | case CTRL_SHUTDOWN_EVENT: 26 | meta_object_ext::invoke_async(myobj, &win_sigwatch::signal_received); 27 | Sleep(10000); 28 | return TRUE; 29 | 30 | default: 31 | return FALSE; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/zdownloader/src/win_sigwatch.h: -------------------------------------------------------------------------------- 1 | #ifndef WIN_SIGWATCH_H 2 | #define WIN_SIGWATCH_H 3 | 4 | #include 5 | #include 6 | 7 | class win_sigwatch : public QObject 8 | { 9 | Q_OBJECT 10 | public: 11 | win_sigwatch(QObject * parent = nullptr); 12 | void watch_for_signals(); 13 | 14 | signals: 15 | void signal_received(); 16 | 17 | private: 18 | static BOOL WINAPI CtrlHandler(DWORD fdwCtrlType); 19 | static win_sigwatch * myobj; 20 | }; 21 | 22 | #endif // WIN_SIGWATCH_H 23 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/empty_cookie_jar.cpp: -------------------------------------------------------------------------------- 1 | #include "empty_cookie_jar.h" 2 | #include 3 | 4 | empty_cookie_jar::empty_cookie_jar(QObject * parent) 5 | :QNetworkCookieJar(parent) 6 | { 7 | } 8 | 9 | bool empty_cookie_jar::insertCookie(const QNetworkCookie & /*cookie*/) 10 | { 11 | return true; 12 | } 13 | 14 | bool empty_cookie_jar::updateCookie(const QNetworkCookie & /*cookie*/) 15 | { 16 | return true; 17 | } 18 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/empty_cookie_jar.h: -------------------------------------------------------------------------------- 1 | #ifndef EMPTY_COOKIE_JAR_H 2 | #define EMPTY_COOKIE_JAR_H 3 | 4 | #include 5 | 6 | class empty_cookie_jar : public QNetworkCookieJar 7 | { 8 | public: 9 | empty_cookie_jar(QObject * parent = nullptr); 10 | 11 | bool insertCookie(const QNetworkCookie & cookie) final; 12 | bool updateCookie(const QNetworkCookie & cookie) final; 13 | }; 14 | 15 | #endif // EMPTY_COOKIE_JAR_H 16 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/abstract_get_request.cpp: -------------------------------------------------------------------------------- 1 | #include "abstract_get_request.h" 2 | #include 3 | 4 | abstract_get_request::abstract_get_request(QNetworkAccessManager * global_nam, QObject * parent) 5 | :abstract_http_request(global_nam, parent) 6 | { 7 | } 8 | 9 | abstract_get_request::~abstract_get_request() 10 | { 11 | } 12 | 13 | void abstract_get_request::start_download() 14 | { 15 | if(is_working) 16 | { 17 | qDebug() << "HTTP request already running for url:" << url << ". No action taken."; 18 | return; 19 | } 20 | 21 | is_working = true; 22 | download(); 23 | } 24 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/abstract_get_request.h: -------------------------------------------------------------------------------- 1 | #ifndef ABSTRACT_GET_REQUEST_H 2 | #define ABSTRACT_GET_REQUEST_H 3 | 4 | #include "../zdownloader_net_lib_global.h" 5 | #include "abstract_http_request.h" 6 | 7 | class ZD_NET_LIBSHARED_EXPORT abstract_get_request : public abstract_http_request 8 | { 9 | Q_OBJECT 10 | public: 11 | abstract_get_request(QNetworkAccessManager * global_nam = nullptr, QObject * parent = nullptr); 12 | virtual ~abstract_get_request(); 13 | 14 | void start_download(); 15 | 16 | private: 17 | virtual void download() = 0; 18 | }; 19 | 20 | #endif // ABSTRACT_GET_REQUEST_H 21 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/abstract_http_request.h: -------------------------------------------------------------------------------- 1 | #ifndef ABSTRACT_HTTP_REQUEST_H 2 | #define ABSTRACT_HTTP_REQUEST_H 3 | 4 | #include "../zdownloader_net_lib_global.h" 5 | #include 6 | #include 7 | #include 8 | 9 | class QNetworkAccessManager; 10 | class QTimer; 11 | 12 | class ZD_NET_LIBSHARED_EXPORT abstract_http_request : public QObject 13 | { 14 | Q_OBJECT 15 | public: 16 | abstract_http_request(QNetworkAccessManager * global_nam = nullptr, QObject * parent = nullptr); 17 | virtual ~abstract_http_request(); 18 | 19 | static void set_user_agent(const QString & user_agent); 20 | static void set_max_seconds_before_abort_inactive_connection(int seconds); 21 | void set_url(const QUrl & url_input); 22 | QString get_url_as_string() const; 23 | void abort_operation(bool disconnect_netreply_signals = true, bool delete_netreply = true); 24 | void set_redirects_enabled(bool enabled); 25 | void set_request_cookies(const QByteArray & cookies); 26 | QString get_reply_header_value(const QString & header_name) const; 27 | void set_request_headers(const QList & request_headers); 28 | void add_request_header(const QNetworkReply::RawHeaderPair & request_header); 29 | 30 | bool is_busy() const; 31 | void enable_redirects_logging(); 32 | 33 | protected: 34 | static QString http_user_agent; 35 | static int conn_state_interval_ms; 36 | QNetworkAccessManager * nam; 37 | QNetworkReply * net_reply; 38 | QUrl url; 39 | QTimer * conn_state; // check if connection stuck 40 | bool is_working; 41 | bool redirects_enabled; 42 | QList reply_headers; 43 | QByteArray req_cookies; 44 | QList req_headers; 45 | 46 | private: 47 | virtual void operation_finished() = 0; 48 | void check_connection(); 49 | 50 | void log_redirect(const QUrl & redir_url); 51 | }; 52 | 53 | #endif // ABSTRACT_HTTP_REQUEST_H 54 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/abstract_post_request.cpp: -------------------------------------------------------------------------------- 1 | #include "abstract_post_request.h" 2 | #include 3 | 4 | abstract_post_request::abstract_post_request(QNetworkAccessManager * global_nam, QObject * parent) 5 | :abstract_http_request(global_nam, parent) 6 | { 7 | } 8 | 9 | abstract_post_request::~abstract_post_request() 10 | { 11 | } 12 | 13 | void abstract_post_request::start_post() 14 | { 15 | if(is_working) 16 | { 17 | qDebug() << "HTTP post already running for url:" << url << ". No action taken."; 18 | return; 19 | } 20 | 21 | is_working = true; 22 | post(); 23 | } 24 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/abstract_post_request.h: -------------------------------------------------------------------------------- 1 | #ifndef ABSTRACT_POST_REQUEST_H 2 | #define ABSTRACT_POST_REQUEST_H 3 | 4 | #include "../zdownloader_net_lib_global.h" 5 | #include "abstract_http_request.h" 6 | 7 | class ZD_NET_LIBSHARED_EXPORT abstract_post_request : public abstract_http_request 8 | { 9 | Q_OBJECT 10 | public: 11 | abstract_post_request(QNetworkAccessManager * global_nam = nullptr, QObject * parent = nullptr); 12 | virtual ~abstract_post_request(); 13 | 14 | void start_post(); 15 | 16 | private: 17 | virtual void post() = 0; 18 | }; 19 | 20 | #endif // ABSTRACT_POST_REQUEST_H 21 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/del_request.cpp: -------------------------------------------------------------------------------- 1 | #include "del_request.h" 2 | 3 | del_request::del_request(QNetworkAccessManager * global_nam, QObject * parent) 4 | :get_request(global_nam, parent) 5 | { 6 | set_operate_as_delete_req(true); 7 | } 8 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/del_request.h: -------------------------------------------------------------------------------- 1 | #ifndef DEL_REQUEST_H 2 | #define DEL_REQUEST_H 3 | 4 | #include "get_request.h" 5 | 6 | class del_request : public get_request 7 | { 8 | Q_OBJECT 9 | public: 10 | del_request(QNetworkAccessManager * global_nam = nullptr, QObject * parent = nullptr); 11 | }; 12 | 13 | #endif // DEL_REQUEST_H 14 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/dl_item_downloader.cpp: -------------------------------------------------------------------------------- 1 | #include "dl_item_downloader.h" 2 | #include "../model/download_item.h" 3 | 4 | dl_item_downloader::dl_item_downloader(QNetworkAccessManager * global_nam, QObject * parent) 5 | :segmented_file_downloader(global_nam, parent) 6 | { 7 | connect(this, &segmented_file_downloader::download_finished, this, &dl_item_downloader::file_download_finished); 8 | } 9 | 10 | void dl_item_downloader::start_download_item(download_item * item, int max_seg, int min_seg_size_bytes, 11 | int seg_network_read_buffer_bytes, int seg_write_buffer_size_bytes) 12 | { 13 | current_item = item; 14 | set_max_download_segments(max_seg); 15 | set_min_segment_size(min_seg_size_bytes); 16 | set_segment_network_read_buffer_size(seg_network_read_buffer_bytes); 17 | set_segment_write_buffer_size(seg_write_buffer_size_bytes); 18 | start_download(item); 19 | } 20 | 21 | void dl_item_downloader::file_download_finished(const QString & error_text, const QString & /*url*/) 22 | { 23 | QString err_txt; 24 | if(current_item->get_status() != download_item::download_status_finished && current_item->get_status() != download_item::download_status_pending) 25 | err_txt = ""; 26 | else 27 | err_txt = error_text; 28 | 29 | emit item_download_finished(this, err_txt, current_item); 30 | } 31 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/dl_item_downloader.h: -------------------------------------------------------------------------------- 1 | #ifndef DL_ITEM_DOWNLOADER_H 2 | #define DL_ITEM_DOWNLOADER_H 3 | 4 | #include "segmented_file_downloader.h" 5 | 6 | class download_item; 7 | 8 | class dl_item_downloader : public segmented_file_downloader 9 | { 10 | Q_OBJECT 11 | public: 12 | dl_item_downloader(QNetworkAccessManager * global_nam = nullptr, QObject * parent = nullptr); 13 | void start_download_item(download_item * item, int max_seg, int min_seg_size_bytes, 14 | int seg_network_read_buffer_bytes, int seg_write_buffer_size_bytes); 15 | 16 | signals: 17 | void item_download_finished(dl_item_downloader * sender, const QString & error_text, download_item * item); 18 | 19 | private: 20 | void file_download_finished(const QString & error_text, const QString & url); 21 | 22 | download_item * current_item; 23 | }; 24 | 25 | #endif // DL_ITEM_DOWNLOADER_H 26 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/download_item_updater.h: -------------------------------------------------------------------------------- 1 | #ifndef DOWNLOAD_ITEM_UPDATER_H 2 | #define DOWNLOAD_ITEM_UPDATER_H 3 | 4 | #include "service.h" 5 | #include 6 | 7 | class QNetworkAccessManager; 8 | class multi_link_checker; 9 | class download_item; 10 | 11 | class download_item_updater : public QObject 12 | { 13 | Q_OBJECT 14 | public: 15 | download_item_updater(int max_ms_before_check_link_again_on_error, QNetworkAccessManager * global_nam, QObject * parent = nullptr); 16 | void start_update(download_item * item); 17 | download_item * get_updatable_item() const; 18 | 19 | signals: 20 | void update_finished(download_item_updater * sender, download_item * updated_item); 21 | 22 | private: 23 | void download_links_info_finished(const QList & infos); 24 | 25 | multi_link_checker * link_checker; 26 | download_item * updatable_item; 27 | }; 28 | 29 | #endif // DOWNLOAD_ITEM_UPDATER_H 30 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/gdrive/gdrive_file.cpp: -------------------------------------------------------------------------------- 1 | #include "gdrive_file.h" 2 | 3 | gdrive_file::gdrive_file(const QString & file_name, const QString & file_id, qint64 size_bytes) 4 | :name(file_name), 5 | id(file_id), 6 | size(size_bytes) 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/gdrive/gdrive_file.h: -------------------------------------------------------------------------------- 1 | #ifndef GDRIVE_FILE_H 2 | #define GDRIVE_FILE_H 3 | 4 | #include 5 | 6 | class gdrive_file 7 | { 8 | public: 9 | gdrive_file(const QString & file_name, const QString & file_id, qint64 size_bytes = -1); 10 | 11 | QString name; 12 | QString id; 13 | qint64 size; 14 | }; 15 | 16 | #endif // GDRIVE_FILE_H 17 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/get_request.h: -------------------------------------------------------------------------------- 1 | #ifndef GET_REQUEST_H 2 | #define GET_REQUEST_H 3 | 4 | #include "abstract_get_request.h" 5 | 6 | class get_request : public abstract_get_request 7 | { 8 | Q_OBJECT 9 | public: 10 | get_request(QNetworkAccessManager * global_nam = nullptr, QObject * parent = nullptr); 11 | 12 | void set_url_query(const QUrlQuery & query); 13 | 14 | signals: 15 | void success(get_request * sender, const QByteArray & response); 16 | void error_occured(get_request * sender, QNetworkReply::NetworkError error); 17 | 18 | protected: 19 | void set_operate_as_delete_req(bool set_as_delete_req); 20 | 21 | private: 22 | void download() final; 23 | void operation_finished() final; 24 | 25 | QString req_verb; 26 | bool operate_as_delete_req; 27 | }; 28 | 29 | #endif // GET_REQUEST_H 30 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/head_downloader.h: -------------------------------------------------------------------------------- 1 | #ifndef HEAD_DOWNLOADER_H 2 | #define HEAD_DOWNLOADER_H 3 | 4 | #include "abstract_get_request.h" 5 | 6 | class head_downloader : public abstract_get_request 7 | { 8 | Q_OBJECT 9 | public: 10 | head_downloader(QNetworkAccessManager * global_nam = nullptr, QObject * parent = nullptr); 11 | void set_use_get_method(bool enabled); 12 | 13 | signals: 14 | void success(head_downloader * sender); 15 | void error_occured(head_downloader * sender, QNetworkReply::NetworkError error_code, const QString & err_text = ""); 16 | 17 | private: 18 | void download() final; 19 | void metadata_changed(); 20 | void operation_finished() final; 21 | void get_operation_finished(); 22 | 23 | bool use_get_method; 24 | }; 25 | 26 | #endif // HEAD_DOWNLOADER_H 27 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/html_downloader.h: -------------------------------------------------------------------------------- 1 | #ifndef HTML_DOWNLOADER_H 2 | #define HTML_DOWNLOADER_H 3 | 4 | #include "abstract_get_request.h" 5 | 6 | class html_downloader : public abstract_get_request 7 | { 8 | Q_OBJECT 9 | public: 10 | html_downloader(QNetworkAccessManager * global_nam = nullptr, QObject * parent = nullptr); 11 | 12 | signals: 13 | void success(html_downloader * sender, const QString & html); 14 | void error_occured(html_downloader * sender, QNetworkReply::NetworkError err_code, const QString & err_text = ""); 15 | 16 | private: 17 | void download() final; 18 | void operation_finished() final; 19 | }; 20 | 21 | #endif // HTML_DOWNLOADER_H 22 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/megaup/megaup_link_extractor.cpp: -------------------------------------------------------------------------------- 1 | #include "megaup_link_extractor.h" 2 | #include 3 | #include 4 | #include 5 | 6 | megaup_link_extractor::megaup_link_extractor() 7 | :last_error(unknown_error) 8 | { 9 | } 10 | 11 | const QString & megaup_link_extractor::get_extracted_link() const 12 | { 13 | return dest_link; 14 | } 15 | 16 | megaup_link_extractor::parse_error megaup_link_extractor::get_last_error() const 17 | { 18 | return last_error; 19 | } 20 | 21 | bool megaup_link_extractor::parse_html(const QString & html) 22 | { 23 | last_error = unknown_error; 24 | 25 | QString middle_link = string_utils::pull_string(html, "('.download-timer').html", "'>"); 26 | if(middle_link.isEmpty()) 27 | return false; 28 | 29 | middle_link = string_utils::pull_string(middle_link, "href='"); 30 | 31 | if(middle_link.isEmpty()) 32 | return false; 33 | 34 | dest_link = middle_link; 35 | 36 | return validate_link(); 37 | } 38 | 39 | bool megaup_link_extractor::validate_link() 40 | { 41 | const QUrl url(dest_link, QUrl::StrictMode); 42 | 43 | if(url.isValid() && url.scheme() == "https" && url.host().endsWith("megaup.net")) 44 | return true; 45 | 46 | last_error = extracted_link_invalid; 47 | return false; 48 | } 49 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/megaup/megaup_link_extractor.h: -------------------------------------------------------------------------------- 1 | #ifndef MEGAUP_LINK_EXTRACTOR_H 2 | #define MEGAUP_LINK_EXTRACTOR_H 3 | 4 | #include 5 | 6 | class megaup_link_extractor 7 | { 8 | public: 9 | enum parse_error { 10 | file_does_not_exists, 11 | extracted_link_invalid, 12 | unknown_error 13 | }; 14 | 15 | megaup_link_extractor(); 16 | 17 | const QString & get_extracted_link() const; 18 | parse_error get_last_error() const; 19 | bool parse_html(const QString & html); 20 | 21 | private: 22 | bool validate_link(); 23 | 24 | QString dest_link; 25 | parse_error last_error; 26 | }; 27 | 28 | #endif // MEGAUP_LINK_EXTRACTOR_H 29 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/megaup/megaup_service.h: -------------------------------------------------------------------------------- 1 | #ifndef MEGAUP_SERVICE_H 2 | #define MEGAUP_SERVICE_H 3 | 4 | #include "../service.h" 5 | #include "../../model/download_item.h" 6 | #include 7 | 8 | class html_downloader; 9 | class head_downloader; 10 | class megaup_link_extractor; 11 | class QTimer; 12 | 13 | class megaup_service : public service 14 | { 15 | public: 16 | megaup_service(QNetworkAccessManager * global_nam, QObject * parent = nullptr); 17 | ~megaup_service() final; 18 | void abort_operation() const final; 19 | 20 | protected: 21 | void fetch_info() final; 22 | 23 | private: 24 | void get_main_html(const QString & url); 25 | void get_main_html_success(html_downloader * sender, const QString & html); 26 | void get_main_html_error(html_downloader * sender, QNetworkReply::NetworkError err_code, const QString & err_text); 27 | 28 | void get_head(const QString & extracted_link, const QString & cookies); 29 | void get_head_success(head_downloader * sender); 30 | void get_head_error_occured(head_downloader * sender, QNetworkReply::NetworkError err_code, const QString & err_text); 31 | 32 | void get_head_on_file_url(const QString & file_url); 33 | void get_head_on_file_url_success(head_downloader * sender); 34 | void get_head_on_file_url_error_occured(head_downloader * sender, QNetworkReply::NetworkError err_code, const QString & err_text); 35 | 36 | // returns error string 37 | QString validate_location(const QUrl & location) const; 38 | 39 | html_downloader * html_dl; 40 | head_downloader * head_dl; 41 | megaup_link_extractor * link_extractor; 42 | QTimer * wait_timer; 43 | 44 | download_item dl_item; 45 | }; 46 | 47 | #endif // MEGAUP_SERVICE_H 48 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/multi_link_checker.h: -------------------------------------------------------------------------------- 1 | #ifndef MULTI_LINK_CHECKER_H 2 | #define MULTI_LINK_CHECKER_H 3 | 4 | #include "../model/download_item.h" 5 | #include "../model/links_queue.h" 6 | #include "service.h" 7 | #include 8 | #include 9 | 10 | class QNetworkAccessManager; 11 | class html_downloader; 12 | class QTimer; 13 | 14 | class multi_link_checker : public QObject 15 | { 16 | Q_OBJECT 17 | public: 18 | multi_link_checker(QNetworkAccessManager * global_nam, QObject * parent = nullptr); 19 | ~multi_link_checker(); 20 | 21 | void download_links_info(const QStringList & src_links); 22 | void set_zippyshare_fetch_file_size(bool enabled); 23 | void set_use_gdrive_api(bool gdrive_api_enabled); 24 | void set_max_parallel_link_checks(int max); 25 | void set_max_ms_before_check_link_again_on_error(int ms); 26 | 27 | signals: 28 | void download_links_info_finished(const QList & infos); 29 | 30 | private: 31 | void download_next_link_info(); 32 | void download_next_link_info_success(const download_item & info, service * sender); 33 | void download_next_link_info_error(const QString & error, service::fetch_error error_code, service * sender); 34 | void set_dl_item_status(download_item * item, service::fetch_error fetch_err) const; 35 | 36 | QNetworkAccessManager * nam; 37 | QList download_items; 38 | links_queue queue; 39 | 40 | int max_parallel_link_checks; 41 | int max_ms_before_check_link_again_on_error; 42 | int download_connections; 43 | QTimer * download_restart_timer; 44 | 45 | QSet services; 46 | bool zippyshare_fetch_file_size; 47 | bool use_gdrive_api; 48 | }; 49 | 50 | #endif // MULTI_LINK_CHECKER_H 51 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/options_downloader.h: -------------------------------------------------------------------------------- 1 | #ifndef OPTIONS_DOWNLOADER_H 2 | #define OPTIONS_DOWNLOADER_H 3 | 4 | #include "abstract_get_request.h" 5 | 6 | class options_downloader : public abstract_get_request 7 | { 8 | Q_OBJECT 9 | public: 10 | options_downloader(QNetworkAccessManager * global_nam = nullptr, QObject * parent = nullptr); 11 | 12 | signals: 13 | void success(options_downloader * sender); 14 | void error_occured(options_downloader * sender, QNetworkReply::NetworkError error_code, const QString & err_text = ""); 15 | 16 | private: 17 | void download() final; 18 | void operation_finished() final; 19 | }; 20 | 21 | #endif // OPTIONS_DOWNLOADER_H 22 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/post_request.h: -------------------------------------------------------------------------------- 1 | #ifndef POST_REQUEST_H 2 | #define POST_REQUEST_H 3 | 4 | #include "abstract_post_request.h" 5 | 6 | class post_request : public abstract_post_request 7 | { 8 | Q_OBJECT 9 | public: 10 | post_request(QNetworkAccessManager * global_nam = nullptr, QObject * parent = nullptr); 11 | 12 | void set_post_body(const QByteArray & body); 13 | void set_content_type(const QString & conent_type); 14 | 15 | signals: 16 | void success(post_request * sender, const QByteArray & response); 17 | void error_occured(post_request * sender, QNetworkReply::NetworkError error); 18 | 19 | private: 20 | void post() final; 21 | void operation_finished() final; 22 | 23 | QByteArray post_body; 24 | QString post_content_type; 25 | }; 26 | 27 | #endif // POST_REQUEST_H 28 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/pre_post_job.h: -------------------------------------------------------------------------------- 1 | #ifndef PRE_POST_JOB_H 2 | #define PRE_POST_JOB_H 3 | 4 | #include 5 | 6 | class download_item; 7 | class gdrive_api; 8 | class gdrive_file; 9 | class jwt; 10 | 11 | class pre_post_job : public QObject 12 | { 13 | Q_OBJECT 14 | public: 15 | pre_post_job(QObject * parent = nullptr); 16 | ~pre_post_job(); 17 | void abort_all_connections(); 18 | void start_pre_job(download_item * item); 19 | void start_post_job(download_item * item); 20 | void set_jwt_header(const jwt & header); 21 | bool reset_in_use(download_item * item); 22 | void set_access_token(download_item * item); 23 | 24 | signals: 25 | void pre_job_finished(download_item * item, bool success, bool should_pause_item); 26 | void post_job_finished(download_item * item); 27 | 28 | private: 29 | void request_access_token_finished(const QString & access_token); 30 | void remove_gdrive_files(); 31 | void list_files_finished(bool success, const QList & files); 32 | void remove_file_finished(bool success); 33 | void copy_file_finished(const QString & dup_file_id); 34 | void end_pre_job_with_error(); 35 | 36 | void post_job_remove_file(); 37 | void post_job_remove_file_finished(bool success); 38 | 39 | bool is_gdrive_url(const QUrl & url) const; 40 | 41 | gdrive_api * gapi; 42 | bool in_use; 43 | download_item * dl_item; 44 | void (pre_post_job::*access_token_success_func)(void); 45 | int remaining_files; 46 | QString shared_file_id; 47 | QString src_file_id; 48 | }; 49 | 50 | #endif // PRE_POST_JOB_H 51 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/segment_calculator.cpp: -------------------------------------------------------------------------------- 1 | #include "segment_calculator.h" 2 | 3 | void segment_calculator::compute(qint64 file_size_bytes, int min_segment_size_bytes, int max_segments) 4 | { 5 | int segment_count = max_segments ? max_segments : 1; 6 | qint64 segment_size_bytes = file_size_bytes / segment_count; 7 | if(segment_size_bytes < min_segment_size_bytes) 8 | { 9 | segment_count = static_cast(file_size_bytes / min_segment_size_bytes); 10 | if(segment_count <= 1) 11 | { 12 | segment_count = 1; 13 | segment_size_bytes = file_size_bytes; 14 | } 15 | else 16 | { 17 | segment_size_bytes = min_segment_size_bytes; 18 | } 19 | } 20 | 21 | seg_metadata_list.clear(); 22 | seg_metadata_list.reserve(segment_count); 23 | // first segment 24 | qint64 pos = segment_size_bytes - 1; 25 | seg_metadata_list.append(segment_metadata(0, pos)); 26 | // middle segments 27 | const int almost_segments = segment_count - 1; 28 | for(int i = 1; i < almost_segments; ++i) 29 | { 30 | segment_metadata meta; 31 | meta.start_pos = pos + 1; 32 | pos += segment_size_bytes; 33 | meta.end_pos = pos; 34 | seg_metadata_list.append(meta); 35 | } 36 | // last segment 37 | if(segment_count > 1) 38 | { 39 | seg_metadata_list.append(segment_metadata(++pos, file_size_bytes - 1)); 40 | } 41 | } 42 | 43 | const QList & segment_calculator::get_segment_metadata_list() 44 | { 45 | return seg_metadata_list; 46 | } 47 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/segment_calculator.h: -------------------------------------------------------------------------------- 1 | #ifndef SEGMENT_CALCULATOR_H 2 | #define SEGMENT_CALCULATOR_H 3 | 4 | #include "../model/segment_metadata.h" 5 | #include 6 | 7 | class segment_calculator 8 | { 9 | public: 10 | void compute(qint64 file_size_bytes, int min_segment_size_bytes, int max_segments); 11 | const QList & get_segment_metadata_list(); 12 | 13 | private: 14 | QList seg_metadata_list; 15 | }; 16 | 17 | #endif // SEGMENT_CALCULATOR_H 18 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/service.cpp: -------------------------------------------------------------------------------- 1 | #include "service.h" 2 | 3 | service::service(QObject * parent) 4 | :QObject(parent) 5 | { 6 | } 7 | 8 | void service::fetch_download_info(const QString & url) 9 | { 10 | base_url = url; 11 | fetch_info(); 12 | } 13 | 14 | const QString & service::get_base_url() const 15 | { 16 | return base_url; 17 | } 18 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/service.h: -------------------------------------------------------------------------------- 1 | #ifndef SERVICE_H 2 | #define SERVICE_H 3 | 4 | #include 5 | 6 | class QNetworkAccessManager; 7 | class download_item; 8 | 9 | class service : public QObject 10 | { 11 | Q_OBJECT 12 | public: 13 | enum fetch_error { 14 | file_does_not_exists, 15 | network_error, 16 | unknown_error, 17 | not_found_404_error 18 | }; 19 | 20 | service(QObject * parent = nullptr); 21 | 22 | void fetch_download_info(const QString & url); 23 | const QString & get_base_url() const; 24 | virtual void abort_operation() const = 0; 25 | 26 | signals: 27 | void fetch_download_info_success(const download_item & info, service * sender); 28 | void fetch_download_info_error(const QString & error, service::fetch_error error_code, service * sender); 29 | 30 | protected: 31 | virtual void fetch_info() = 0; 32 | 33 | QString base_url; 34 | }; 35 | 36 | #endif // SERVICE_H 37 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/web_config.cpp: -------------------------------------------------------------------------------- 1 | #include "web_config.h" 2 | 3 | web_config & web_config::inst() 4 | { 5 | static web_config instance; 6 | return instance; 7 | } 8 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/web_config.h: -------------------------------------------------------------------------------- 1 | #ifndef WEB_CONFIG_H 2 | #define WEB_CONFIG_H 3 | 4 | #include 5 | 6 | class QObject; 7 | 8 | class web_config 9 | { 10 | public: 11 | static web_config & inst(); 12 | 13 | // HTTP User-Agent header 14 | // "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36" 15 | const QString http_user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"; 16 | const QString http_x_www_form_urlencoded = "application/x-www-form-urlencoded"; 17 | 18 | private: 19 | web_config() {} 20 | ~web_config() {} 21 | web_config(web_config const &); 22 | void operator=(web_config const &); 23 | }; 24 | 25 | #endif // WEB_CONFIG_H 26 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/zippyshare/zippy_link_extractor.h: -------------------------------------------------------------------------------- 1 | #ifndef ZIPPY_LINK_EXTRACTOR_H 2 | #define ZIPPY_LINK_EXTRACTOR_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class QScriptEngine; 9 | class QScriptValue; 10 | class QTimer; 11 | 12 | class zippy_link_extractor : public QObject 13 | { 14 | Q_OBJECT 15 | public: 16 | enum parse_error { 17 | file_does_not_exists, 18 | unknown_error 19 | }; 20 | 21 | zippy_link_extractor(); 22 | 23 | const QString & get_extracted_link() const; 24 | QString get_extracted_filename() const; 25 | parse_error get_last_error() const; 26 | bool parse_html(const QString & html, const QString & src_link); 27 | 28 | private: 29 | void check_file_existence(const QString & html); 30 | QString prepare_script_from_html(const QString & html); 31 | bool eval_javascript(const QString & script); 32 | void schedule_abort_javascript_eval(); 33 | void abort_javascript_eval(); 34 | QString check_for_eval_errors(const QScriptValue & val) const; 35 | 36 | QStringList js_get_chained_methods_args(const QString & js_src, const QStringList & methods); 37 | QStringList js_find_next_chained_methods_args(const QStringRef & src, const QStringList & methods, QStringRef * js_fragment); 38 | QString html_get_attribute_val(const QString & html, const QString & id_name, const QString & attr_name); 39 | 40 | static std::unique_ptr script_engine; 41 | QString source_link; 42 | QString dest_link; 43 | parse_error last_error; 44 | QTimer * abort_js_timer; 45 | }; 46 | 47 | #endif // ZIPPY_LINK_EXTRACTOR_H 48 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/http/zippyshare/zippy_service.h: -------------------------------------------------------------------------------- 1 | #ifndef ZIPPY_SERVICE_H 2 | #define ZIPPY_SERVICE_H 3 | 4 | #include "../service.h" 5 | #include "../../model/download_item.h" 6 | #include 7 | 8 | class html_downloader; 9 | class head_downloader; 10 | class zippy_link_extractor; 11 | 12 | class zippy_service : public service 13 | { 14 | Q_OBJECT 15 | public: 16 | zippy_service(QNetworkAccessManager * global_nam, bool fetch_file_size = true, QObject * parent = nullptr); 17 | ~zippy_service(); 18 | void abort_operation() const final; 19 | 20 | protected: 21 | void fetch_info() final; 22 | 23 | private: 24 | void get_main_html(const QString & url); 25 | void get_main_html_success(html_downloader * sender, const QString & html); 26 | void get_main_html_error(html_downloader * sender, QNetworkReply::NetworkError err_code, const QString & err_text); 27 | 28 | void get_head(const QString & link); 29 | void get_head_success(head_downloader * sender); 30 | void get_head_error_occured(head_downloader * sender, QNetworkReply::NetworkError err_code, const QString & err_text); 31 | 32 | html_downloader * html_dl; 33 | head_downloader * head_dl; 34 | zippy_link_extractor * link_extractor; 35 | download_item dl_item; 36 | bool fetch_file_size_enabled; 37 | }; 38 | 39 | #endif // ZIPPY_SERVICE_H 40 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/logged_nam.cpp: -------------------------------------------------------------------------------- 1 | #include "logged_nam.h" 2 | #include "empty_cookie_jar.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | logged_nam::logged_nam(QObject * parent) 9 | :QNetworkAccessManager(parent) 10 | { 11 | connect(this, &QNetworkAccessManager::sslErrors, this, &logged_nam::ssl_errors); 12 | //connect(this, &QNetworkAccessManager::finished, this, &logged_nam::network_finished); 13 | 14 | setCookieJar(new empty_cookie_jar); 15 | } 16 | 17 | //void logged_nam::network_finished(QNetworkReply * reply) 18 | //{ 19 | // if(reply->error() != QNetworkReply::NoError) 20 | // { 21 | // qDebug() << "HTTP INFO:" << reply->errorString() << "for url:" << reply->url().toString(); 22 | // } 23 | //} 24 | 25 | void logged_nam::ssl_errors(QNetworkReply * reply, const QList & errors) 26 | { 27 | qDebug() << reply->url() << "ssl errors:" << errors; 28 | } 29 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/logged_nam.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGGED_NAM_H 2 | #define LOGGED_NAM_H 3 | 4 | #include 5 | #include 6 | 7 | class logged_nam : public QNetworkAccessManager 8 | { 9 | public: 10 | logged_nam(QObject * parent = nullptr); 11 | 12 | private: 13 | //void network_finished(QNetworkReply * reply); 14 | void ssl_errors(QNetworkReply * reply, const QList & errors); 15 | }; 16 | 17 | #endif // LOGGED_NAM_H 18 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/model/links_queue.cpp: -------------------------------------------------------------------------------- 1 | #include "links_queue.h" 2 | #include 3 | 4 | void links_queue::add(const QString & item) 5 | { 6 | if(link_map.contains(item)) 7 | { 8 | qDebug() << "Item not added. Link" << item << "already exists in link_map."; 9 | return; 10 | } 11 | 12 | pending_items.enqueue(item); 13 | link_map.insert(item); 14 | } 15 | 16 | void links_queue::add(const QList & items) 17 | { 18 | for(const auto & item : items) 19 | { 20 | add(item); 21 | } 22 | } 23 | 24 | void links_queue::clear() 25 | { 26 | pending_items.clear(); 27 | working_items.clear(); 28 | link_map.clear(); 29 | } 30 | 31 | bool links_queue::has_pending_items() const 32 | { 33 | return pending_items.isEmpty() == false; 34 | } 35 | 36 | bool links_queue::has_working_items() const 37 | { 38 | return working_items.isEmpty() == false; 39 | } 40 | 41 | const QString & links_queue::get_next() 42 | { 43 | const QString item = pending_items.dequeue(); 44 | working_items.append(item); 45 | 46 | return working_items.last(); 47 | } 48 | 49 | void links_queue::finish(const QString & item) 50 | { 51 | remove_working_item(item); 52 | } 53 | 54 | void links_queue::stop(const QString & item) 55 | { 56 | if(remove_working_item(item)) 57 | { 58 | pending_items.prepend(item); 59 | } 60 | } 61 | 62 | bool links_queue::contains_link(const QString & item) const 63 | { 64 | return link_map.contains(item); 65 | } 66 | 67 | bool links_queue::remove_working_item(const QString & item) 68 | { 69 | const bool removed = working_items.removeOne(item); 70 | if(removed == false) 71 | { 72 | qDebug() << "Could not remove item:" << item; 73 | return false; 74 | } 75 | 76 | return true; 77 | } 78 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/model/links_queue.h: -------------------------------------------------------------------------------- 1 | #ifndef LINKS_QUEUE_H 2 | #define LINKS_QUEUE_H 3 | 4 | #include 5 | #include 6 | 7 | class links_queue 8 | { 9 | public: 10 | void add(const QString & item); 11 | void add(const QList & items); 12 | void clear(); 13 | bool has_pending_items() const; 14 | bool has_working_items() const; 15 | const QString & get_next(); 16 | void finish(const QString & item); 17 | void stop(const QString & item); 18 | bool contains_link(const QString & item) const; 19 | 20 | private: 21 | bool remove_working_item(const QString & item); 22 | 23 | QQueue pending_items; 24 | QList working_items; 25 | 26 | QSet link_map; 27 | }; 28 | 29 | #endif // LINKS_QUEUE_H 30 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/model/segment_metadata.cpp: -------------------------------------------------------------------------------- 1 | #include "segment_metadata.h" 2 | 3 | segment_metadata::segment_metadata() 4 | :start_pos(0), 5 | end_pos(0), 6 | segment_finished(false) 7 | { 8 | } 9 | 10 | segment_metadata::segment_metadata(qint64 seg_start_pos, qint64 seg_end_pos) 11 | :start_pos(seg_start_pos), 12 | end_pos(seg_end_pos), 13 | segment_finished(false) 14 | { 15 | } 16 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/model/segment_metadata.h: -------------------------------------------------------------------------------- 1 | #ifndef SEGMENT_METADATA_H 2 | #define SEGMENT_METADATA_H 3 | 4 | #include 5 | 6 | class segment_metadata 7 | { 8 | public: 9 | segment_metadata(); 10 | segment_metadata(qint64 seg_start_pos, qint64 seg_end_pos); 11 | 12 | qint64 start_pos; 13 | qint64 end_pos; 14 | bool segment_finished; 15 | }; 16 | 17 | #endif // SEGMENT_METADATA_H 18 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/net_thread.cpp: -------------------------------------------------------------------------------- 1 | #include "net_thread.h" 2 | #include "logged_nam.h" 3 | #include "http/download_manager.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | net_thread::net_thread(QObject * parent) 11 | :QThread(parent), 12 | http_download_manager(nullptr) 13 | //global_nam(nullptr) 14 | { 15 | } 16 | 17 | net_thread::~net_thread() 18 | { 19 | if(isRunning()) 20 | { 21 | quit(); 22 | wait(); 23 | } 24 | } 25 | 26 | download_manager * net_thread::get_dl_mgr() 27 | { 28 | rw_locker.lockForRead(); 29 | download_manager * dl = http_download_manager; 30 | rw_locker.unlock(); 31 | return dl; 32 | } 33 | 34 | void net_thread::run() 35 | { 36 | //global_nam = new logged_nam(); 37 | preload_network(); 38 | 39 | rw_locker.lockForWrite(); 40 | http_download_manager = new download_manager(nullptr, nullptr); 41 | rw_locker.unlock(); 42 | 43 | emit init_finished(); 44 | exec(); 45 | QCoreApplication::processEvents(); 46 | 47 | rw_locker.lockForWrite(); 48 | delete http_download_manager; 49 | http_download_manager = nullptr; 50 | rw_locker.unlock(); 51 | //delete global_nam; 52 | } 53 | 54 | void net_thread::preload_network() const 55 | { 56 | set_global_ssl_configuration(); 57 | 58 | // QNetworkRequest req; 59 | // QNetworkReply * reply = global_nam->get(req); 60 | // reply->abort(); 61 | // delete reply; 62 | } 63 | 64 | void net_thread::set_global_ssl_configuration() const 65 | { 66 | QSslConfiguration ssl_conf = QSslConfiguration::defaultConfiguration(); 67 | 68 | #if defined(ZD_DEBUG) || defined(DEBUG_PROXY) 69 | qDebug() << "WARNING: NO CERT VERIFY MODE"; 70 | ssl_conf.setPeerVerifyMode(QSslSocket::VerifyNone); 71 | #endif 72 | 73 | QSslConfiguration::setDefaultConfiguration(ssl_conf); 74 | } 75 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/net_thread.h: -------------------------------------------------------------------------------- 1 | #ifndef NET_THREAD_H 2 | #define NET_THREAD_H 3 | 4 | #include "zdownloader_net_lib_global.h" 5 | #include 6 | #include 7 | 8 | class download_manager; 9 | class logged_nam; 10 | 11 | class ZD_NET_LIBSHARED_EXPORT net_thread : public QThread 12 | { 13 | Q_OBJECT 14 | public: 15 | net_thread(QObject * parent = nullptr); 16 | ~net_thread(); 17 | 18 | download_manager * get_dl_mgr(); 19 | 20 | signals: 21 | void init_finished(); 22 | 23 | protected: 24 | void run() final; 25 | 26 | private: 27 | void preload_network() const; 28 | void set_global_ssl_configuration() const; 29 | 30 | download_manager * http_download_manager; 31 | QReadWriteLock rw_locker; 32 | 33 | //logged_nam * global_nam; 34 | }; 35 | 36 | #endif // NET_THREAD_H 37 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/settings/finished_downloads_settings.cpp: -------------------------------------------------------------------------------- 1 | #include "finished_downloads_settings.h" 2 | 3 | 4 | QString finished_downloads_settings::validate() const 5 | { 6 | int min = 256; 7 | int max = 512000; 8 | if(log_max_rotate_kb < min || log_max_rotate_kb > max) 9 | return "log_max_rotate_kb must be: from " + QString::number(min) + " to " + QString::number(max); 10 | 11 | min = 1; 12 | max = 9; 13 | if(log_max_archive_files < min || log_max_archive_files > max) 14 | return "log_max_archive_files must be: from " + QString::number(min) + " to " + QString::number(max); 15 | 16 | return ""; 17 | } 18 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/settings/finished_downloads_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef FINISHED_DOWNLOADS_SETTINGS_H 2 | #define FINISHED_DOWNLOADS_SETTINGS_H 3 | 4 | #include "../zdownloader_net_lib_global.h" 5 | #include 6 | 7 | class ZD_NET_LIBSHARED_EXPORT finished_downloads_settings 8 | { 9 | public: 10 | QString validate() const; 11 | 12 | bool log_to_file_enabled = true; 13 | QString timestamp_format; 14 | int log_max_rotate_kb = 4096; 15 | int log_max_archive_files = 3; 16 | }; 17 | 18 | #endif // FINISHED_DOWNLOADS_SETTINGS_H 19 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/settings/gdrive_settings.cpp: -------------------------------------------------------------------------------- 1 | #include "gdrive_settings.h" 2 | 3 | QString gdrive_settings::validate() const 4 | { 5 | if(use_gdrive_api) 6 | { 7 | if(google_service_account_json_file.isEmpty()) 8 | return "google_service_account_json_file is empty"; 9 | 10 | if(json_file_error.isEmpty() == false) 11 | return json_file_error; 12 | 13 | if(client_email.isEmpty()) 14 | return "client_email from json file is empty"; 15 | 16 | if(private_key.isEmpty()) 17 | return "private_key from json file is empty"; 18 | } 19 | 20 | return ""; 21 | } 22 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/settings/gdrive_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef GDRIVE_SETTINGS_H 2 | #define GDRIVE_SETTINGS_H 3 | 4 | #include "../zdownloader_net_lib_global.h" 5 | #include 6 | 7 | class ZD_NET_LIBSHARED_EXPORT gdrive_settings 8 | { 9 | public: 10 | QString validate() const; 11 | 12 | bool use_gdrive_api = false; 13 | QString google_service_account_json_file; 14 | QString client_email; 15 | QString private_key; 16 | QString json_file_error; 17 | }; 18 | 19 | #endif // GDRIVE_SETTINGS_H 20 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/unit_tests/http/gdrive/gdrive_api_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef GDRIVE_API_TESTS_H 2 | #define GDRIVE_API_TESTS_H 3 | 4 | #include "../../../http/gdrive/gdrive_api.h" 5 | #include "../../../utils/jwt.h" 6 | #include "../../../http/gdrive/gdrive_file.h" 7 | #include 8 | #include 9 | 10 | class gdrive_api_tests : public QObject 11 | { 12 | Q_OBJECT 13 | private slots: 14 | void request_access_token_test() 15 | { 16 | jwt jwt_header; 17 | jwt_header.set_aud("https://oauth2.googleapis.com/token"); 18 | jwt_header.set_scope("https://www.googleapis.com/auth/drive"); 19 | 20 | jwt_header.set_iss("somesome-acc@drapiproj.iam.gserviceaccount.com"); 21 | jwt_header.set_private_key_pem("-----BEGIN PRIVATE KEY-----\nMII... CUTTED LOL"); 22 | 23 | QSslConfiguration ssl_conf = QSslConfiguration::defaultConfiguration(); 24 | ssl_conf.setPeerVerifyMode(QSslSocket::VerifyNone); 25 | QSslConfiguration::setDefaultConfiguration(ssl_conf); 26 | QNetworkProxy proxy(QNetworkProxy::Socks5Proxy, "127.0.0.1", 8889); 27 | QNetworkProxy::setApplicationProxy(proxy); 28 | 29 | gdrive_api gapi; 30 | gapi.set_jwt_header(jwt_header); 31 | connect(&gapi, &gdrive_api::request_access_token_finished, [&](const QString & /*acc_token*/) { 32 | connect(&gapi, &gdrive_api::file_info_finished, [&](QNetworkReply::NetworkError , const gdrive_file & /*info*/) { 33 | //gapi.remove_file("0B1MVW1mFO2zmZHVRWEQ3Rkc3SVE"); 34 | // for(auto & f : files) 35 | // { 36 | // qDebug() << "FILE:" << f.name << "ID:" << f.id; 37 | // } 38 | }); 39 | 40 | gapi.file_info("0B1MVW1mFO2zmZHVRWEQ3Rkc3SVE"); 41 | }); 42 | 43 | gapi.request_access_token(); 44 | 45 | //gapi.share_file("0B1MVW1mFO2zmZHVRWEQ3Rkc3SVE"); 46 | 47 | 48 | 49 | QEventLoop loop; 50 | //connect(this, &net_thread::init_finished, &loop, &QEventLoop::quit, Qt::QueuedConnection); 51 | 52 | loop.exec(); 53 | } 54 | }; 55 | 56 | #endif // GDRIVE_API_TESTS_H 57 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/unit_tests/http/link_manager_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef LINK_MANAGER_TESTS_H 2 | #define LINK_MANAGER_TESTS_H 3 | 4 | #include "../../http/link_manager.h" 5 | #include 6 | 7 | class link_manager_tests : public QObject 8 | { 9 | Q_OBJECT 10 | private slots: 11 | // void load_links_from_file_returns_true() 12 | // { 13 | // link_manager lnk_mgr(nullptr); 14 | 15 | // bool result = lnk_mgr.load_links_from_file(); 16 | 17 | // QCOMPARE(result, true); 18 | // } 19 | }; 20 | 21 | #endif // LINK_MANAGER_TESTS_H 22 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/unit_tests/main_unit_tests.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "model/downloadable_items_tests.h" 3 | #include "http/zippy_link_extractor_tests.h" 4 | #include "http/link_manager_tests.h" 5 | #include "http/segment_calculator_tests.h" 6 | #include "utils/jwt_tests.h" 7 | #include "utils/archive_filename_comparator_tests.h" 8 | #include "http/gdrive/gdrive_api_tests.h" 9 | #include "http/gdrive/gdrive_service_tests.h" 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication app(argc, argv); 14 | 15 | int status = 0; 16 | { 17 | downloadable_items_tests tc; 18 | status |= QTest::qExec(&tc, argc, argv); 19 | } 20 | 21 | { 22 | zippy_link_extractor_tests tc; 23 | status |= QTest::qExec(&tc, argc, argv); 24 | } 25 | 26 | // { 27 | // link_manager_tests tc; 28 | // status |= QTest::qExec(&tc, argc, argv); 29 | // } 30 | 31 | { 32 | segment_calculator_tests tc; 33 | status |= QTest::qExec(&tc, argc, argv); 34 | } 35 | 36 | // { 37 | // jwt_tests tc; 38 | // status |= QTest::qExec(&tc, argc, argv); 39 | // } 40 | 41 | // { 42 | // gdrive_api_tests tc; 43 | // status |= QTest::qExec(&tc, argc, argv); 44 | // } 45 | 46 | { 47 | gdrive_service_tests tc; 48 | status |= QTest::qExec(&tc, argc, argv); 49 | } 50 | 51 | { 52 | archive_filename_comparator_tests tc; 53 | status |= QTest::qExec(&tc, argc, argv); 54 | } 55 | 56 | return status; 57 | } 58 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/unit_tests/utils/archive_filename_comparator_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCHIVE_FILENAME_COMPARATOR_TESTS_H 2 | #define ARCHIVE_FILENAME_COMPARATOR_TESTS_H 3 | 4 | #include "../../utils/archive_filename_comparator.h" 5 | #include 6 | 7 | class archive_filename_comparator_tests : public QObject 8 | { 9 | Q_OBJECT 10 | private slots: 11 | void compare_returns_true() 12 | { 13 | QString f1 = "Game.Overlay.Renderer64.part01.rar"; 14 | QString f2 = "Game.Overlay.Renderer64.part02.rar"; 15 | 16 | archive_filename_comparator afc; 17 | bool ret = afc.compare(f1, f2); 18 | 19 | QCOMPARE(ret, true); 20 | } 21 | 22 | void compare_returns_true2() 23 | { 24 | QString f1 = "Game.Overlay.Renderer64.7z.001"; 25 | QString f2 = "Game.Overlay.Renderer64.7z.002"; 26 | 27 | archive_filename_comparator afc; 28 | bool ret = afc.compare(f1, f2); 29 | 30 | QCOMPARE(ret, true); 31 | } 32 | 33 | void compare_returns_false() 34 | { 35 | QString f1 = "Game.Overlay.Renderer64.part01.rar"; 36 | QString f2 = "Game.Overlay.Renderer64.rar"; 37 | 38 | archive_filename_comparator afc; 39 | bool ret = afc.compare(f1, f2); 40 | 41 | QCOMPARE(ret, false); 42 | } 43 | 44 | void compare_returns_false2() 45 | { 46 | QString f1 = "Renderer64.7z.001"; 47 | QString f2 = "Renderer64.7z"; 48 | 49 | archive_filename_comparator afc; 50 | bool ret = afc.compare(f1, f2); 51 | 52 | QCOMPARE(ret, false); 53 | } 54 | }; 55 | 56 | #endif // ARCHIVE_FILENAME_COMPARATOR_TESTS_H 57 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/unit_tests/utils/jwt_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef JWT_TESTS_H 2 | #define JWT_TESTS_H 3 | 4 | #include "../../utils/jwt.h" 5 | #include 6 | #include 7 | 8 | class jwt_tests : public QObject 9 | { 10 | Q_OBJECT 11 | private slots: 12 | void compose_returns_correct_val() 13 | { 14 | jwt j; 15 | j.set_iss("761326798069-r5mljlln1rd4lrbhg75efgigp36m78j5@developer.gserviceaccount.com"); 16 | j.set_scope("https://www.googleapis.com/auth/devstorage.readonly"); 17 | j.set_aud("https://oauth2.googleapis.com/token"); 18 | QByteArray c = j.compose(); 19 | //int y = 4; 20 | } 21 | }; 22 | 23 | #endif // JWT_TESTS_H 24 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/utils/archive_filename_comparator.cpp: -------------------------------------------------------------------------------- 1 | #include "archive_filename_comparator.h" 2 | #include 3 | 4 | bool archive_filename_comparator::compare(const QString & prev_filename, const QString & curr_filename) const 5 | { 6 | const QFileInfo prev_fi(prev_filename); 7 | const QFileInfo curr_fi(curr_filename); 8 | const QString prev_ext = prev_fi.suffix(); 9 | const QString curr_ext = curr_fi.suffix(); 10 | const QFileInfo prev_without_ext = prev_fi.completeBaseName(); 11 | const QFileInfo curr_without_ext = curr_fi.completeBaseName(); 12 | const QString prev_subsuffix = prev_without_ext.suffix(); 13 | const QString curr_subsuffix = curr_without_ext.suffix(); 14 | 15 | if(prev_ext == "rar" && curr_ext == "rar" 16 | && prev_subsuffix.startsWith("part") && curr_subsuffix.startsWith("part") 17 | && prev_without_ext.completeBaseName() == curr_without_ext.completeBaseName()) 18 | { 19 | return true; 20 | } 21 | 22 | if(prev_subsuffix == "7z" && curr_subsuffix == "7z" 23 | && prev_without_ext.completeBaseName() == curr_without_ext.completeBaseName()) 24 | { 25 | return true; 26 | } 27 | 28 | if(prev_filename == curr_filename) 29 | return true; 30 | 31 | return false; 32 | } 33 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/utils/archive_filename_comparator.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCHIVE_FILENAME_COMPARATOR_H 2 | #define ARCHIVE_FILENAME_COMPARATOR_H 3 | 4 | #include 5 | 6 | class archive_filename_comparator 7 | { 8 | public: 9 | bool compare(const QString & prev_filename, const QString & curr_filename) const; 10 | }; 11 | 12 | #endif // ARCHIVE_FILENAME_COMPARATOR_H 13 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/utils/jwt.cpp: -------------------------------------------------------------------------------- 1 | #include "jwt.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | jwt::jwt() 9 | { 10 | 11 | } 12 | 13 | void jwt::set_iss(const QString & value) 14 | { 15 | iss = value; 16 | } 17 | 18 | void jwt::set_scope(const QString & value) 19 | { 20 | scope = value; 21 | } 22 | 23 | void jwt::set_aud(const QString & value) 24 | { 25 | aud = value; 26 | } 27 | 28 | void jwt::set_private_key_pem(const QString & pem) 29 | { 30 | priv_key_pem = pem; 31 | priv_key_pem.remove('\n'); 32 | } 33 | 34 | QByteArray jwt::compose() const 35 | { 36 | const qint64 cur_secs = QDateTime::currentDateTimeUtc().currentSecsSinceEpoch(); 37 | const QByteArray header_b64 = QByteArray("{\"alg\":\"RS256\",\"typ\":\"JWT\"}").toBase64(QByteArray::Base64UrlEncoding); 38 | QJsonObject jo; 39 | jo.insert("iss", iss); 40 | jo.insert("scope", scope); 41 | jo.insert("aud", aud); 42 | jo.insert("exp", cur_secs + 3500); 43 | jo.insert("iat", cur_secs); 44 | const auto json = QJsonDocument(jo).toJson(QJsonDocument::Compact); 45 | //QByteArray json = "{\"aud\":\"https://oauth2.googleapis.com/token\",\"exp\":1238167,\"iat\":1234567,\"iss\":\"761326798069-r5mljlln1rd4lrbhg75efgigp36m78j5@developer.gserviceaccount.com\",\"scope\":\"https://www.googleapis.com/auth/devstorage.readonly\"}"; 46 | //qDebug().noquote() << json; 47 | QByteArray ret = header_b64 + "." + json.toBase64(QByteArray::Base64UrlEncoding); 48 | 49 | botan_wrapper bw; 50 | QByteArray sign_b64; 51 | bw.rsa_sign(ret, priv_key_pem, &sign_b64); 52 | ret += "." + sign_b64; 53 | 54 | return ret; 55 | } 56 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/utils/jwt.h: -------------------------------------------------------------------------------- 1 | #ifndef JWT_H 2 | #define JWT_H 3 | 4 | #include 5 | 6 | class jwt 7 | { 8 | public: 9 | jwt(); 10 | void set_iss(const QString & value); 11 | void set_scope(const QString & value); 12 | void set_aud(const QString & value); 13 | void set_private_key_pem(const QString & pem); 14 | QByteArray compose() const; 15 | 16 | private: 17 | QString iss; 18 | QString scope; 19 | QString aud; 20 | QString priv_key_pem; 21 | }; 22 | 23 | #endif // JWT_H 24 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/zdownloader_net_lib.cpp: -------------------------------------------------------------------------------- 1 | #include "zdownloader_net_lib.h" 2 | #include 3 | #include 4 | 5 | zdownloader_net_lib::zdownloader_net_lib(bool start_and_init, QObject * parent) 6 | :net_thread(parent), 7 | has_init_finished(false) 8 | { 9 | connect(this, &net_thread::init_finished, this, &zdownloader_net_lib::set_init_finished, Qt::QueuedConnection); 10 | if(start_and_init) 11 | { 12 | QEventLoop loop; 13 | connect(this, &net_thread::init_finished, &loop, &QEventLoop::quit, Qt::QueuedConnection); 14 | start(); 15 | loop.exec(); 16 | } 17 | } 18 | 19 | zdownloader_net_lib::~zdownloader_net_lib() 20 | { 21 | qDebug() << "destructor net_lib"; 22 | } 23 | 24 | void zdownloader_net_lib::set_init_finished() 25 | { 26 | has_init_finished = true; 27 | } 28 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/zdownloader_net_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef ZD_NET_LIB_H 2 | #define ZD_NET_LIB_H 3 | 4 | #include "zdownloader_net_lib_global.h" 5 | #include "net_thread.h" 6 | #include "http/download_manager.h" 7 | 8 | class ZD_NET_LIBSHARED_EXPORT zdownloader_net_lib : public net_thread 9 | { 10 | Q_OBJECT 11 | public: 12 | zdownloader_net_lib(bool start_and_init = true, QObject * parent = nullptr); 13 | virtual ~zdownloader_net_lib(); 14 | 15 | private: 16 | void set_init_finished(); 17 | 18 | bool has_init_finished; 19 | }; 20 | 21 | #endif // ZD_NET_LIB_H 22 | -------------------------------------------------------------------------------- /src/zdownloader_net_lib/src/zdownloader_net_lib_global.h: -------------------------------------------------------------------------------- 1 | #ifndef zdownloader_net_lib_global_H 2 | #define zdownloader_net_lib_global_H 3 | 4 | #include 5 | 6 | #ifndef ZD_STATIC_LINKAGE 7 | #if defined(UNIT_TEST) && defined(ZDOWNLOADER_NET_LIB) 8 | #define ZD_NET_LIBSHARED_EXPORT 9 | #else 10 | #ifdef ZDOWNLOADER_NET_LIB 11 | #define ZD_NET_LIBSHARED_EXPORT Q_DECL_EXPORT 12 | #else 13 | #define ZD_NET_LIBSHARED_EXPORT Q_DECL_IMPORT 14 | #endif 15 | #endif 16 | #else 17 | #define ZD_NET_LIBSHARED_EXPORT 18 | #endif 19 | 20 | #endif // zdownloader_net_lib_global_H 21 | --------------------------------------------------------------------------------