virgil-crypto 2.3.0 → 3.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/.gitmodules +0 -0
- data/.travis.yml +13 -0
- data/Gemfile +0 -0
- data/README.md +113 -9
- data/Rakefile +0 -0
- data/ext/native/src/.clang-format +37 -0
- data/ext/native/src/.gitignore +3 -0
- data/ext/native/src/.travis.yml +2 -1
- data/ext/native/src/CMakeLists.txt +66 -63
- data/ext/native/src/ChangeLog +114 -2
- data/ext/native/src/Dockerfile_Golang +29 -8
- data/ext/native/src/Jenkinsfile +61 -50
- data/ext/native/src/LICENSE +0 -0
- data/ext/native/src/README.md +137 -167
- data/ext/native/src/VERSION +1 -1
- data/ext/native/src/benchmark.md +140 -0
- data/ext/native/src/benchmark/CMakeLists.txt +0 -0
- data/ext/native/src/benchmark/benchmark_cipher.cxx +0 -0
- data/ext/native/src/benchmark/benchmark_hash.cxx +0 -0
- data/ext/native/src/benchmark/benchmark_keys.cxx +0 -0
- data/ext/native/src/benchmark/benchmark_pythia.cxx +61 -0
- data/ext/native/src/benchmark/benchmark_random.cxx +0 -0
- data/ext/native/src/benchmark/benchmark_signer.cxx +0 -0
- data/ext/native/src/ci/install-dependencies.sh +8 -12
- data/ext/native/src/ci/publish-docs.sh +107 -22
- data/ext/native/src/ci/travis-deployment-key.enc +0 -0
- data/ext/native/src/cmake/TransitiveArgs.cmake +78 -0
- data/ext/native/src/cmake/TransitiveToolchainArgs.cmake +105 -0
- data/ext/native/src/cmake/add_mono_metadata.cmake +103 -0
- data/ext/native/src/cmake/apple.cmake +56 -11
- data/ext/native/src/cmake/aux_source_directory_to_file.cmake +0 -0
- data/ext/native/src/cmake/check_pointer_size.cmake +0 -0
- data/ext/native/src/cmake/copy_all_files.cmake +0 -0
- data/ext/native/src/cmake/file_regex_replace.cmake +0 -0
- data/ext/native/src/cmake/find_host_utils.cmake +0 -0
- data/ext/native/src/cmake/uppercase_first_char.cmake +0 -0
- data/ext/native/src/cmake/uppercase_namespaces.cmake +3 -0
- data/ext/native/src/cmake/virgil_depends.cmake +0 -0
- data/ext/native/src/cmake/virgil_depends_local.cmake +2 -0
- data/ext/native/src/docs/.gitignore +0 -0
- data/ext/native/src/lib/CMakeLists.txt +59 -1
- data/ext/native/src/lib/Doxyfile.in +1 -1
- data/ext/native/src/lib/Info.plist.in +0 -0
- data/ext/native/src/lib/cmake/config.cmake.in +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilByteArrayUtils.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilChunkCipher.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilCipherBase.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilContentInfo.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilCrypto.h +13 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilCryptoError.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilCustomParams.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilKeyPair.h +30 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilSignerBase.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilStreamCipher.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilStreamSigner.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilTinyCipher.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilVersion.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilAsymmetricCipher.h +17 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilHKDF.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilPBKDF.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilSystemCryptoError.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/asn1/VirgilAsn1Compatible.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSContent.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSContentInfo.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSEncryptedContent.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSEnvelopedData.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSKeyTransRecipient.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSPasswordRecipient.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFS.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSEncryptedMessage.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSInitiatorPrivateInfo.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSInitiatorPublicInfo.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSPrivateKey.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSPublicKey.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSResponderPrivateInfo.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSResponderPublicInfo.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSSession.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationCipher.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationDH.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationHash.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationKDF.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationRandom.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythia.h +181 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaBlindResult.h +89 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaContext.h +72 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaError.h +161 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaProveResult.h +89 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaTransformResult.h +91 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaTransformationKeyPair.h +87 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/virgil_pythia_c.h +203 -0
- data/ext/native/src/lib/include/virgil/crypto/stream/VirgilBytesDataSink.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/stream/VirgilBytesDataSource.h +0 -0
- data/ext/native/src/lib/mainpage.dox +6 -0
- data/ext/native/src/lib/module.modulemap +7 -0
- data/ext/native/src/lib/src/VirgilAsn1Alg.cxx +0 -0
- data/ext/native/src/lib/src/VirgilAsn1Alg.h +0 -0
- data/ext/native/src/lib/src/VirgilAsn1Compatible.cxx +0 -0
- data/ext/native/src/lib/src/VirgilAsymmetricCipher.cxx +82 -0
- data/ext/native/src/lib/src/VirgilByteArrayUtils.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCMSContent.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCMSContentInfo.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCMSEncryptedContent.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCMSEnvelopedData.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCMSKeyTransRecipient.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCMSPasswordRecipient.cxx +0 -0
- data/ext/native/src/lib/src/VirgilChunkCipher.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCipherBase.cxx +0 -0
- data/ext/native/src/lib/src/VirgilConfig.cxx +51 -0
- data/ext/native/src/lib/src/VirgilConfig.h.in +43 -1
- data/ext/native/src/lib/src/VirgilContentInfo.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCryptoError.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCustomParams.cxx +0 -0
- data/ext/native/src/lib/src/VirgilDataSink.cxx +0 -0
- data/ext/native/src/lib/src/VirgilHKDF.cxx +0 -0
- data/ext/native/src/lib/src/VirgilKeyPair.cxx +19 -0
- data/ext/native/src/lib/src/VirgilOID.h +0 -0
- data/ext/native/src/lib/src/VirgilPBKDF.cxx +0 -0
- data/ext/native/src/lib/src/VirgilSignerBase.cxx +0 -0
- data/ext/native/src/lib/src/VirgilStreamCipher.cxx +0 -0
- data/ext/native/src/lib/src/VirgilStreamSigner.cxx +0 -0
- data/ext/native/src/lib/src/VirgilSystemCryptoError.cxx +0 -0
- data/ext/native/src/lib/src/VirgilTagFilter.cxx +0 -0
- data/ext/native/src/lib/src/VirgilTagFilter.h +0 -0
- data/ext/native/src/lib/src/VirgilTinyCipher.cxx +0 -0
- data/ext/native/src/lib/src/VirgilVersion.cxx.in +0 -0
- data/ext/native/src/lib/src/mbedtls_context.h +0 -0
- data/ext/native/src/lib/src/mbedtls_context_policy_spec.h +0 -0
- data/ext/native/src/lib/src/mbedtls_type_utils.h +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFS.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSEncryptedMessage.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSInitiatorPrivateInfo.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSInitiatorPublicInfo.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSPrivateKey.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSPublicKey.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSResponderPrivateInfo.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSResponderPublicInfo.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSSession.cxx +0 -0
- data/ext/native/src/lib/src/primitive/VirgilOperationCipher.cxx +0 -0
- data/ext/native/src/lib/src/primitive/VirgilOperationDH.cxx +0 -0
- data/ext/native/src/lib/src/primitive/VirgilOperationHash.cxx +0 -0
- data/ext/native/src/lib/src/primitive/VirgilOperationKDF.cxx +0 -0
- data/ext/native/src/lib/src/primitive/VirgilOperationRandom.cxx +0 -0
- data/ext/native/src/lib/src/pythia/VirgilPythia.cxx +202 -0
- data/ext/native/src/lib/src/pythia/VirgilPythiaContext.cxx +116 -0
- data/ext/native/src/lib/src/pythia/VirgilPythiaError.cxx +58 -0
- data/ext/native/src/lib/src/pythia/virgil_pythia_c.cxx +129 -0
- data/ext/native/src/lib/src/stream/VirgilBytesDataSink.cxx +0 -0
- data/ext/native/src/lib/src/stream/VirgilBytesDataSource.cxx +0 -0
- data/ext/native/src/lib/src/utils.h +3 -2
- data/ext/native/src/libs_ext/mbedtls/configs/config.h +0 -0
- data/ext/native/src/libs_ext/mbedtls/configs/config_desktop.h +0 -0
- data/ext/native/src/libs_ext/mbedtls/mbedtls.cmake +0 -0
- data/ext/native/src/{cmake/cmake_args.cmake → libs_ext/pythia/pythia.cmake} +24 -28
- data/ext/native/src/libs_ext/rapidjson/rapidjson.cmake +0 -0
- data/ext/native/src/libs_ext/tinyformat/cmake/config.cmake.in +0 -0
- data/ext/native/src/libs_ext/tinyformat/tinyformat.cmake +0 -0
- data/ext/native/src/migration-2.0.md +0 -0
- data/ext/native/src/tests/CMakeLists.txt +0 -0
- data/ext/native/src/tests/catch.hpp +0 -0
- data/ext/native/src/tests/data/test_data_pfs_with_otc.json +0 -0
- data/ext/native/src/tests/data/test_data_pfs_without_otc.json +0 -0
- data/ext/native/src/tests/deterministic_keys.h +293 -0
- data/ext/native/src/tests/rsa_keys.h +229 -123
- data/ext/native/src/tests/test_asn1_writer.cxx +0 -0
- data/ext/native/src/tests/test_asymmetric_cipher.cxx +65 -0
- data/ext/native/src/tests/test_base64.cxx +0 -0
- data/ext/native/src/tests/test_byte_array_utils.cxx +0 -0
- data/ext/native/src/tests/test_chunk_cipher.cxx +0 -0
- data/ext/native/src/tests/test_cipher.cxx +8 -4
- data/ext/native/src/tests/test_cipher_base.cxx +0 -0
- data/ext/native/src/tests/test_contract_copy_move.cxx +4 -1
- data/ext/native/src/tests/test_data_pfs.h +0 -0
- data/ext/native/src/tests/test_hash.cxx +0 -0
- data/ext/native/src/tests/test_hkdf.cxx +0 -0
- data/ext/native/src/tests/test_key_pair.cxx +65 -3
- data/ext/native/src/tests/test_pbe.cxx +0 -0
- data/ext/native/src/tests/test_pbkdf.cxx +0 -0
- data/ext/native/src/tests/test_pfs.cxx +0 -0
- data/ext/native/src/tests/test_pythia.cxx +157 -0
- data/ext/native/src/tests/test_random.cxx +0 -0
- data/ext/native/src/tests/test_runner.cxx +0 -0
- data/ext/native/src/tests/test_signer.cxx +0 -0
- data/ext/native/src/tests/test_stream_cipher.cxx +0 -0
- data/ext/native/src/tests/test_stream_data_source.cxx +0 -0
- data/ext/native/src/tests/test_symmetric_cipher.cxx +0 -0
- data/ext/native/src/tests/test_tag_filter.cxx +0 -0
- data/ext/native/src/tests/test_tiny_cipher.cxx +0 -0
- data/ext/native/src/utils/build.bat +0 -0
- data/ext/native/src/utils/build.sh +238 -68
- data/ext/native/src/utils/zip.vbs +0 -0
- data/ext/native/src/virgil-crypto.sublime-project +15 -0
- data/ext/native/src/wrappers/asmjs/CMakeLists.txt +0 -8
- data/ext/native/src/wrappers/emsdk/CMakeLists.txt +2 -2
- data/ext/native/src/wrappers/emsdk/error.js +0 -0
- data/ext/native/src/wrappers/emsdk/example.html +152 -31
- data/ext/native/src/wrappers/emsdk/helpers.js +140 -135
- data/ext/native/src/wrappers/emsdk/patch_embind.pl +0 -0
- data/ext/native/src/wrappers/emsdk/wrapper.cxx +55 -0
- data/ext/native/src/wrappers/go/CMakeLists.txt +6 -5
- data/ext/native/src/wrappers/java/CMakeLists.txt +27 -4
- data/ext/native/src/wrappers/java/src/JniLoader.java +167 -0
- data/ext/native/src/wrappers/java/src/VirgilStreamDataSink.java +0 -0
- data/ext/native/src/wrappers/java/src/VirgilStreamDataSource.java +0 -0
- data/ext/native/src/wrappers/net/CMakeLists.txt +41 -8
- data/ext/native/src/wrappers/net/cmake/UseCSharp.cmake +5 -5
- data/ext/native/src/wrappers/net/src/VirgilStreamDataSink.cs +0 -0
- data/ext/native/src/wrappers/net/src/VirgilStreamDataSource.cs +0 -0
- data/ext/native/src/wrappers/nodejs/checksum.txt +66 -0
- data/ext/native/src/wrappers/php/CMakeLists.txt +2 -5
- data/ext/native/src/wrappers/php/tests/CMakeLists.txt +6 -0
- data/ext/native/src/wrappers/php/tests/VirgilChunkCipher_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilCustomParams_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilKDF_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilPBE_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilPBKDF_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilPythia_Test.php.in +87 -0
- data/ext/native/src/wrappers/php/tests/VirgilStreamCipher_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilStreamSigner_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilVersion_Test.php.in +0 -0
- data/ext/native/src/wrappers/python/CMakeLists.txt +4 -1
- data/ext/native/src/wrappers/ruby/CMakeLists.txt +4 -1
- data/ext/native/src/wrappers/swig/common.i +0 -0
- data/ext/native/src/wrappers/swig/csharp/FixedArray.i +0 -0
- data/ext/native/src/wrappers/swig/csharp/VirgilByteArray.i +0 -0
- data/ext/native/src/wrappers/swig/csharp/common.i +0 -0
- data/ext/native/src/wrappers/swig/csharp/csharphead.swg.in +0 -0
- data/ext/native/src/wrappers/swig/go/common.i.in +7 -0
- data/ext/native/src/wrappers/swig/java/VirgilByteArray.i +0 -0
- data/ext/native/src/wrappers/swig/java/common.i +6 -0
- data/ext/native/src/wrappers/swig/php/common.i +0 -0
- data/ext/native/src/wrappers/swig/php/php7/VirgilByteArray.i +0 -0
- data/ext/native/src/wrappers/swig/util.i +0 -0
- data/ext/native/src/wrappers/swig/wrapper.i.in +18 -7
- data/ext/native/src/wrappers/webasm/CMakeLists.txt +0 -8
- data/ext/rakefile.rb +77 -56
- data/lib/virgil/crypto.rb +53 -9
- data/lib/virgil/crypto/access_token_signer.rb +79 -0
- data/lib/virgil/crypto/bytes.rb +81 -17
- data/lib/virgil/crypto/card_crypto.rb +115 -0
- data/lib/virgil/crypto/crypto_exception.rb +40 -0
- data/lib/virgil/crypto/hash_algorithm.rb +82 -0
- data/lib/virgil/crypto/key_pair.rb +41 -0
- data/lib/virgil/crypto/key_pair_type.rb +98 -0
- data/lib/virgil/crypto/private_key.rb +40 -0
- data/lib/virgil/crypto/private_key_exporter.rb +67 -0
- data/lib/virgil/crypto/public_key.rb +40 -0
- data/lib/virgil/crypto/{virgil_stream_data_sink.rb → stream_data_sink.rb} +12 -12
- data/lib/virgil/crypto/{virgil_stream_data_source.rb → stream_data_source.rb} +12 -12
- data/lib/virgil/crypto/validation.rb +59 -0
- data/lib/virgil/crypto/version.rb +35 -1
- data/lib/virgil/crypto/virgil_crypto.rb +595 -0
- data/lib/virgil/native_crypto.rb +80 -60
- data/lib/virgil/os.rb +40 -6
- data/secrets.tar.enc +0 -0
- data/virgil-crypto.gemspec +6 -7
- metadata +62 -12
- data/ext/native/src/cmake/android.toolchain.cmake +0 -1697
File without changes
|
@@ -78,6 +78,7 @@
|
|
78
78
|
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
|
79
79
|
|
80
80
|
include (CMakeParseArguments)
|
81
|
+
include (TransitiveArgs)
|
81
82
|
|
82
83
|
function (virgil_depends_log_error)
|
83
84
|
message ("")
|
@@ -233,6 +234,7 @@ function (virgil_depends)
|
|
233
234
|
"-G${CMAKE_GENERATOR}"
|
234
235
|
"-C${VIRGIL_DEPENDS_CACHE_FILE}"
|
235
236
|
"-C${VIRGIL_DEPENDS_ARGS_FILE}"
|
237
|
+
"-C${TRANSITIVE_ARGS_FILE}"
|
236
238
|
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
|
237
239
|
"-DCMAKE_INSTALL_PREFIX=${VIRGIL_DEPENDS_PREFIX}"
|
238
240
|
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
|
File without changes
|
@@ -60,6 +60,7 @@ aux_source_directory ("src/internal" src)
|
|
60
60
|
aux_source_directory ("src/primitive" src)
|
61
61
|
aux_source_directory ("src/pfs" src)
|
62
62
|
aux_source_directory ("src/stream" src)
|
63
|
+
aux_source_directory ("src/pythia" src)
|
63
64
|
|
64
65
|
aux_source_directory("${CMAKE_CURRENT_BINARY_DIR}/src" src)
|
65
66
|
|
@@ -90,15 +91,29 @@ target_include_directories (${PROJECT_NAME}
|
|
90
91
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
|
91
92
|
"$<INSTALL_INTERFACE:include>"
|
92
93
|
)
|
93
|
-
|
94
|
+
|
95
|
+
target_link_libraries (${PROJECT_NAME} PUBLIC mbedtls::mbedcrypto mbedtls::ed25519)
|
96
|
+
|
94
97
|
target_compile_definitions (${PROJECT_NAME}
|
95
98
|
PUBLIC
|
96
99
|
"VIRGIL_CRYPTO_FEATURE_STREAM_IMPL=$<BOOL:${VIRGIL_CRYPTO_FEATURE_STREAM_IMPL}>"
|
100
|
+
"VIRGIL_CRYPTO_FEATURE_PYTHIA=$<BOOL:${VIRGIL_CRYPTO_FEATURE_PYTHIA}>"
|
97
101
|
"UCLIBC=$<BOOL:${UCLIBC}>"
|
98
102
|
PRIVATE
|
99
103
|
"FMT_HEADER_ONLY"
|
100
104
|
)
|
101
105
|
|
106
|
+
if (VIRGIL_CRYPTO_FEATURE_PYTHIA)
|
107
|
+
target_link_libraries (${PROJECT_NAME} PUBLIC pythia)
|
108
|
+
|
109
|
+
get_target_property (include_directories pythia INTERFACE_INCLUDE_DIRECTORIES)
|
110
|
+
|
111
|
+
foreach(include_dir ${include_directories})
|
112
|
+
target_include_directories (${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${include_dir}/pythia>")
|
113
|
+
endforeach(include_dir)
|
114
|
+
endif ()
|
115
|
+
|
116
|
+
|
102
117
|
# ---------------------------------------------------------------------------
|
103
118
|
# Apple specifc library configuration
|
104
119
|
# ---------------------------------------------------------------------------
|
@@ -123,10 +138,43 @@ if (BUILD_LIBRARY_FRAMEWORK)
|
|
123
138
|
)
|
124
139
|
endforeach ()
|
125
140
|
|
141
|
+
if (VIRGIL_CRYPTO_FEATURE_PYTHIA)
|
142
|
+
find_file (pythia_buf_header_file_path
|
143
|
+
NAMES "pythia_buf.h" PATHS ${include_directories} PATH_SUFFIXES pythia
|
144
|
+
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
145
|
+
|
146
|
+
find_file (pythia_buf_sizes_header_file_path
|
147
|
+
NAMES "pythia_buf_sizes.h" PATHS ${include_directories} PATH_SUFFIXES pythia
|
148
|
+
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
149
|
+
|
150
|
+
if (NOT pythia_buf_header_file_path)
|
151
|
+
message (FATAL_ERROR "Header file 'pythia_buf.h' is not found within paths $${include_directories}")
|
152
|
+
endif ()
|
153
|
+
|
154
|
+
if (NOT pythia_buf_sizes_header_file_path)
|
155
|
+
message (FATAL_ERROR "Header file 'pythia_buf_sizes.h' is not found within paths $${include_directories}")
|
156
|
+
endif ()
|
157
|
+
|
158
|
+
target_sources (${PROJECT_NAME} PRIVATE "${pythia_buf_header_file_path}" "${pythia_buf_sizes_header_file_path}")
|
159
|
+
|
160
|
+
set_property (
|
161
|
+
SOURCE ${pythia_buf_header_file_path}
|
162
|
+
PROPERTY MACOSX_PACKAGE_LOCATION "Headers/pythia"
|
163
|
+
)
|
164
|
+
|
165
|
+
set_property (
|
166
|
+
SOURCE ${pythia_buf_sizes_header_file_path}
|
167
|
+
PROPERTY MACOSX_PACKAGE_LOCATION "Headers/pythia"
|
168
|
+
)
|
169
|
+
|
170
|
+
|
171
|
+
endif ()
|
172
|
+
|
126
173
|
# Convert target to framework
|
127
174
|
target_apple_framework (${PROJECT_NAME}
|
128
175
|
NAME "VSCCrypto"
|
129
176
|
IDENTIFIER "com.virgilsecurity.VSCCrypto"
|
177
|
+
MODULE_MAP "${CMAKE_CURRENT_LIST_DIR}/module.modulemap"
|
130
178
|
)
|
131
179
|
|
132
180
|
endif ()
|
@@ -178,6 +226,16 @@ if (INSTALL_CORE_LIBS)
|
|
178
226
|
)
|
179
227
|
endif ()
|
180
228
|
|
229
|
+
if (VIRGIL_CRYPTO_FEATURE_PYTHIA)
|
230
|
+
get_target_property (PYTHIA_INCLUDE_DIRECTORIES pythia INTERFACE_INCLUDE_DIRECTORIES)
|
231
|
+
foreach(pythia_install_dir ${PYTHIA_INCLUDE_DIRECTORIES})
|
232
|
+
install (
|
233
|
+
DIRECTORY "${pythia_install_dir}/pythia" DESTINATION "${INSTALL_INC_DIR_NAME}/virgil/crypto"
|
234
|
+
FILES_MATCHING PATTERN "*buf*"
|
235
|
+
)
|
236
|
+
endforeach()
|
237
|
+
endif ()
|
238
|
+
|
181
239
|
if (INSTALL_EXT_LIBS)
|
182
240
|
install (DIRECTORY "${VIRGIL_DEPENDS_PREFIX}/lib/" DESTINATION "${INSTALL_LIB_DIR_NAME}")
|
183
241
|
endif (INSTALL_EXT_LIBS)
|
@@ -38,7 +38,7 @@ PROJECT_NAME = "Virgil Security Crypto library"
|
|
38
38
|
# could be handy for archiving the generated documentation or if some version
|
39
39
|
# control system is used.
|
40
40
|
|
41
|
-
PROJECT_NUMBER = @
|
41
|
+
PROJECT_NUMBER = @VIRGIL_VERSION_FULL_NAME@
|
42
42
|
|
43
43
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
44
44
|
# for a project that appears at the top of each page and should give viewer a
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -99,3 +99,16 @@
|
|
99
99
|
#include "stream/VirgilStreamDataSink.h"
|
100
100
|
#include "stream/VirgilStreamDataSource.h"
|
101
101
|
#endif /* VIRGIL_CRYPTO_FEATURE_STREAM_IMPL */
|
102
|
+
|
103
|
+
#if VIRGIL_CRYPTO_FEATURE_PYTHIA
|
104
|
+
#include "pythia/pythia_buf.h"
|
105
|
+
#include "pythia/pythia_buf_sizes.h"
|
106
|
+
#include "pythia/virgil_pythia_c.h"
|
107
|
+
#include "pythia/VirgilPythia.h"
|
108
|
+
#include "pythia/VirgilPythiaBlindResult.h"
|
109
|
+
#include "pythia/VirgilPythiaContext.h"
|
110
|
+
#include "pythia/VirgilPythiaError.h"
|
111
|
+
#include "pythia/VirgilPythiaProveResult.h"
|
112
|
+
#include "pythia/VirgilPythiaTransformationKeyPair.h"
|
113
|
+
#include "pythia/VirgilPythiaTransformResult.h"
|
114
|
+
#endif /* VIRGIL_CRYPTO_FEATURE_PYTHIA */
|
File without changes
|
File without changes
|
@@ -130,6 +130,36 @@ public:
|
|
130
130
|
const VirgilByteArray& donorPrivateKeyPassword = VirgilByteArray(),
|
131
131
|
const VirgilByteArray& newKeyPairPassword = VirgilByteArray());
|
132
132
|
|
133
|
+
/**
|
134
|
+
* @brief Generates private and public keys from the given key material.
|
135
|
+
*
|
136
|
+
* This is a deterministic key generation algorithm that allows create private key
|
137
|
+
* from any secret data, i.e. password.
|
138
|
+
*
|
139
|
+
* @param type - private key type to be generated.
|
140
|
+
* @param keyMaterial - the only data to be used for key generation, must be strong enough.
|
141
|
+
* @param pwd - private key password.
|
142
|
+
*/
|
143
|
+
static VirgilKeyPair generateFromKeyMaterial(
|
144
|
+
VirgilKeyPair::Type type,
|
145
|
+
const VirgilByteArray& keyMaterial,
|
146
|
+
const VirgilByteArray& pwd = VirgilByteArray());
|
147
|
+
/**
|
148
|
+
* @brief Generates recommended private and public keys from the given key material.
|
149
|
+
*
|
150
|
+
* This is a deterministic key generation algorithm that allows create private key
|
151
|
+
* from any secret data, i.e. password.
|
152
|
+
*
|
153
|
+
* @param keyMaterial - the only data to be used for key generation, must be strong enough.
|
154
|
+
* @param pwd - private key password.
|
155
|
+
*
|
156
|
+
* @throw VirgilCryptoException with VirgilCryptoError::NotSecure,
|
157
|
+
* if Key Material is weak.
|
158
|
+
*/
|
159
|
+
static VirgilKeyPair generateRecommendedFromKeyMaterial(
|
160
|
+
const VirgilByteArray& keyMaterial,
|
161
|
+
const VirgilByteArray& pwd = VirgilByteArray());
|
162
|
+
|
133
163
|
/**
|
134
164
|
* @name Keys validation
|
135
165
|
*/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -190,6 +190,23 @@ public:
|
|
190
190
|
*/
|
191
191
|
void genKeyPairFrom(const VirgilAsymmetricCipher& other);
|
192
192
|
|
193
|
+
/**
|
194
|
+
* @brief Generates private and public keys from the given key material.
|
195
|
+
*
|
196
|
+
* This is a deterministic key generation algorithm that allows create private key
|
197
|
+
* from any secret data, i.e. password.
|
198
|
+
*
|
199
|
+
* @param type - keypair type.
|
200
|
+
* @param keyMaterial - the only data to be used for key generation, must be strong enough.
|
201
|
+
*
|
202
|
+
* @throw VirgilCryptoException with VirgilCryptoError::UnsupportedAlgorithm,
|
203
|
+
* if key pair can't be generated with given type.
|
204
|
+
*
|
205
|
+
* @throw VirgilCryptoException with VirgilCryptoError::NotSecure,
|
206
|
+
* if Key Material is weak.
|
207
|
+
*/
|
208
|
+
void genKeyPairFromKeyMaterial(VirgilKeyPair::Type type, const VirgilByteArray& keyMaterial);
|
209
|
+
|
193
210
|
/**
|
194
211
|
* @brief Compute shared secret key on a given contexts.
|
195
212
|
*
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,181 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (C) 2015-2018 Virgil Security Inc.
|
3
|
+
*
|
4
|
+
* All rights reserved.
|
5
|
+
*
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
7
|
+
* modification, are permitted provided that the following conditions are
|
8
|
+
* met:
|
9
|
+
*
|
10
|
+
* (1) Redistributions of source code must retain the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer.
|
12
|
+
*
|
13
|
+
* (2) Redistributions in binary form must reproduce the above copyright
|
14
|
+
* notice, this list of conditions and the following disclaimer in
|
15
|
+
* the documentation and/or other materials provided with the
|
16
|
+
* distribution.
|
17
|
+
*
|
18
|
+
* (3) Neither the name of the copyright holder nor the names of its
|
19
|
+
* contributors may be used to endorse or promote products derived from
|
20
|
+
* this software without specific prior written permission.
|
21
|
+
*
|
22
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
|
23
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
24
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
25
|
+
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
26
|
+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
27
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
28
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
29
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
30
|
+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
31
|
+
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
*
|
34
|
+
* Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
|
35
|
+
*/
|
36
|
+
|
37
|
+
#ifndef virgilPythiaH
|
38
|
+
#define virgilPythiaH
|
39
|
+
|
40
|
+
#include "../VirgilByteArray.h"
|
41
|
+
#include "VirgilPythiaBlindResult.h"
|
42
|
+
#include "VirgilPythiaContext.h"
|
43
|
+
#include "VirgilPythiaTransformationKeyPair.h"
|
44
|
+
#include "VirgilPythiaProveResult.h"
|
45
|
+
#include "VirgilPythiaTransformResult.h"
|
46
|
+
|
47
|
+
namespace virgil {
|
48
|
+
namespace crypto {
|
49
|
+
namespace pythia {
|
50
|
+
|
51
|
+
/**
|
52
|
+
* @brief This class provides PYTHIA cryptographic functions and primitives.
|
53
|
+
*
|
54
|
+
* PYTHIA is a verifiable, cryptographic protocol that hardens passwords
|
55
|
+
* with the help of a remote service.
|
56
|
+
*
|
57
|
+
* @ingroup pythia
|
58
|
+
*/
|
59
|
+
class VirgilPythia {
|
60
|
+
public:
|
61
|
+
|
62
|
+
/**
|
63
|
+
* @brief Blinds password.
|
64
|
+
*
|
65
|
+
* Turns password into a pseudo-random string.
|
66
|
+
* This step is necessary to prevent 3rd-parties from knowledge of end user's password.
|
67
|
+
*
|
68
|
+
* @param password - end user's password.
|
69
|
+
* @return VirgilPythiaBlindResult
|
70
|
+
*/
|
71
|
+
VirgilPythiaBlindResult blind(const VirgilByteArray& password);
|
72
|
+
|
73
|
+
/**
|
74
|
+
* @brief Deblinds transformedPassword value with previously returned blindingSecret from blind().
|
75
|
+
*
|
76
|
+
* @param transformedPassword - GT transformed password from transform().
|
77
|
+
* @param blindingSecret - BN value that was generated in blind().
|
78
|
+
*
|
79
|
+
* @return Deblinded transformedPassword value.
|
80
|
+
* This value is not equal to password and is zero-knowledge protected.
|
81
|
+
*/
|
82
|
+
VirgilByteArray
|
83
|
+
deblind(const VirgilByteArray& transformedPassword, const VirgilByteArray& blindingSecret);
|
84
|
+
|
85
|
+
/**
|
86
|
+
* @brief Computes transformation private and public key.
|
87
|
+
*
|
88
|
+
* @param transformationKeyID - ensemble key ID used to enclose operations in subsets.
|
89
|
+
* @param pythiaSecret - global common for all secret random Key.
|
90
|
+
* @param pythiaScopeSecret - ensemble secret generated and versioned transparently.
|
91
|
+
*
|
92
|
+
* @return VirgilPythiaTransformationKeyPair
|
93
|
+
*/
|
94
|
+
VirgilPythiaTransformationKeyPair
|
95
|
+
computeTransformationKeyPair(const VirgilByteArray& transformationKeyID, const VirgilByteArray& pythiaSecret,
|
96
|
+
const VirgilByteArray& pythiaScopeSecret);
|
97
|
+
|
98
|
+
/**
|
99
|
+
* @brief Transforms blinded password using the private key, generated from pythiaSecret + pythiaScopeSecret.
|
100
|
+
*
|
101
|
+
* @param blindedPassword - G1 password obfuscated into a pseudo-random string.
|
102
|
+
* @param tweak - some random value used to identify user
|
103
|
+
* @param transformationPrivateKey - BN transformation private key.
|
104
|
+
*
|
105
|
+
* @return VirgilPythiaTransformResult
|
106
|
+
*/
|
107
|
+
VirgilPythiaTransformResult transform(
|
108
|
+
const VirgilByteArray& blindedPassword, const VirgilByteArray& tweak,
|
109
|
+
const VirgilByteArray& transformationPrivateKey);
|
110
|
+
|
111
|
+
/**
|
112
|
+
* @brief Generates proof that server possesses secret values that were used to transform password.
|
113
|
+
*
|
114
|
+
* @param transformedPassword - GT transformed password from transform()
|
115
|
+
* @param blindedPassword - G1 blinded password from blind().
|
116
|
+
* @param transformedTweak - G2 transformed tweak from transform().
|
117
|
+
* @param transformationKeyPair - transformation key pair.
|
118
|
+
*
|
119
|
+
* @return VirgilPythiaProveResult
|
120
|
+
*/
|
121
|
+
VirgilPythiaProveResult
|
122
|
+
prove(const VirgilByteArray& transformedPassword, const VirgilByteArray& blindedPassword,
|
123
|
+
const VirgilByteArray& transformedTweak, const VirgilPythiaTransformationKeyPair& transformationKeyPair);
|
124
|
+
|
125
|
+
/**
|
126
|
+
* @brief Verifies the output of transform().
|
127
|
+
*
|
128
|
+
* This operation allows client to verify that the output of transform() is correct,
|
129
|
+
* assuming that client has previously stored tweak.
|
130
|
+
*
|
131
|
+
* @param transformedPassword - GT transformed password from transform()
|
132
|
+
* @param blindedPassword - G1 blinded password from blind().
|
133
|
+
* @param tweak - tweak from transform()
|
134
|
+
* @param transformationPublicKey - G1 transformation public key
|
135
|
+
* @param proofValueC - BN proof value C from prove()
|
136
|
+
* @param proofValueU - BN proof value U from prove()
|
137
|
+
*
|
138
|
+
* @return true if output of transform() is correct, false - otherwise.
|
139
|
+
*/
|
140
|
+
bool
|
141
|
+
verify(const VirgilByteArray& transformedPassword, const VirgilByteArray& blindedPassword,
|
142
|
+
const VirgilByteArray& tweak, const VirgilByteArray& transformationPublicKey,
|
143
|
+
const VirgilByteArray& proofValueC, const VirgilByteArray& proofValueU);
|
144
|
+
|
145
|
+
/**
|
146
|
+
* @brief Computes update token.
|
147
|
+
*
|
148
|
+
* Computes update token which allows update deblindedPassword when rotating transformation private key
|
149
|
+
* This action should increment version of pythiaScopeSecret.
|
150
|
+
*
|
151
|
+
* @param previousTransformationPrivateKey - transformation private key
|
152
|
+
* @param newTransformationPrivateKey - new transformation private key
|
153
|
+
*
|
154
|
+
* @return VirgilBteArray
|
155
|
+
*/
|
156
|
+
VirgilByteArray getPasswordUpdateToken(
|
157
|
+
const VirgilByteArray& previousTransformationPrivateKey,
|
158
|
+
const VirgilByteArray& newTransformationPrivateKey);
|
159
|
+
|
160
|
+
/**
|
161
|
+
* @brief Updates previously stored deblindedPassword with passwordUpdateToken.
|
162
|
+
*
|
163
|
+
* After this call, transform() called with new arguments will return corresponding values.
|
164
|
+
*
|
165
|
+
* @param deblindedPassword - GT previous deblinded password from deblind().
|
166
|
+
* @param passwordUpdateToken - BN password update token from getPasswordUpdateToken().
|
167
|
+
*
|
168
|
+
* @return New deblinded password.
|
169
|
+
*/
|
170
|
+
VirgilByteArray updateDeblindedWithToken(
|
171
|
+
const VirgilByteArray& deblindedPassword, const VirgilByteArray& passwordUpdateToken);
|
172
|
+
|
173
|
+
private:
|
174
|
+
VirgilPythiaContext pythiaContext;
|
175
|
+
};
|
176
|
+
|
177
|
+
} // namespace pythia
|
178
|
+
} // namespace crypto
|
179
|
+
} // namespace virgil
|
180
|
+
|
181
|
+
#endif /* virgilPythiaH */
|