Skip to content

Commit

Permalink
Add key generation utility for Concord
Browse files Browse the repository at this point in the history
This commit adds a key generation utility for concord; it can be called
from the command line to generate all RSA and threshold signature keys
needed by a Concord deployment, which it outputs to keyfiles. A function
for reading the keyfiles back in is also included, as is a test of the
key generation utility and a README documenting how to use it.
Furthermore, this commit makes revisions to simpleTest so that it uses
keyfiles of the new format. The key generation utility is implemented in
the tools subdirectory. See tools/README.md for more information about
this utility.
  • Loading branch information
upshaw-alex authored and guyg8 committed Nov 27, 2018
1 parent ef4d526 commit ef43e67
Show file tree
Hide file tree
Showing 22 changed files with 3,416 additions and 310 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,5 @@ endif()
add_subdirectory(logging)
add_subdirectory(threshsign)
add_subdirectory(bftengine)
add_subdirectory(tools)
add_subdirectory(bftengine/tests)
4 changes: 2 additions & 2 deletions bftengine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
project (bftengine LANGUAGES CXX)

get_property(LOGGER_INC_DIR GLOBAL PROPERTY LoggerIncludeDir)

set(corebft_source_files
Expand Down Expand Up @@ -89,5 +91,3 @@ target_include_directories(corebft PUBLIC ${LOGGER_INC_DIR})

target_link_libraries(corebft PUBLIC threshsign)
target_link_libraries(corebft PUBLIC Threads::Threads)

add_subdirectory(tests)
13 changes: 12 additions & 1 deletion bftengine/tests/simpleTest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
set(simpleTest_client_source_files
client.cpp
config.cpp
${concord_bft_tools_SOURCE_DIR}/KeyfileIOUtils.cpp
)

set(simpleTest_replica_source_files
replica.cpp
config.cpp
${concord_bft_tools_SOURCE_DIR}/KeyfileIOUtils.cpp
)

add_executable(simpleTest_client
Expand All @@ -32,9 +34,18 @@ set_target_properties(simpleTest_server PROPERTIES OUTPUT_NAME server)
target_link_libraries(simpleTest_client PUBLIC corebft)
target_link_libraries(simpleTest_server PUBLIC corebft)

target_include_directories(simpleTest_client
PRIVATE
${concord_bft_tools_SOURCE_DIR}
${bftengine_SOURCE_DIR}/include)
target_include_directories(simpleTest_server
PRIVATE
${concord_bft_tools_SOURCE_DIR}
${bftengine_SOURCE_DIR}/include)

add_custom_target(copy_simple_test_scripts ALL COMMENT "Copying scripts of simpleTest")
add_custom_command(TARGET copy_simple_test_scripts
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:simpleTest_client>/scripts
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/scripts $<TARGET_FILE_DIR:simpleTest_client>/scripts)



22 changes: 10 additions & 12 deletions bftengine/tests/simpleTest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ state machine understands two events:

The state machine is defined in the `SimpleAppState` class in
`replica.cpp`. It exposes only an `execute` method, which is called
every time the replica receives an event. The `main` function simple
every time the replica receives an event. The `main` function simply
starts a Concord replica parameterized with this state machine.

The test code is defined in `client.cpp`. The client sends a number of
Expand All @@ -23,17 +23,15 @@ last written value.

In the `scripts` directory, you'll find:

* `private_replica_{0,1,2,3}`, which are the private config files
for each replica. The example is for four replicas, with supports
an F=1 environment. See `config.cpp` for documentation of the
format.
* `private_replica_{0,1,2,3}`, which are the key files for each
replica. The example is for four replicas, which supports an F=1
environment. The keyfile format used is the same as that output by
the `GenerateConcordKeys` tool in the `concord-bft/tools` folder;
see `concord-bft/tools/README.md` for more information on how
these keyfiles are generated and used.

* `public_replicas_data`, which is the public configuration shared
among all nodes. This is how public keys are shared among all
nodes. See `config.cpp` for documentation of the format.

* `testReplicasAndClient.sh`, which starts all four replicas, and
then runs the client test.
* `testReplicasAndClient.sh`, which generates fresh cryptographic
keys, starts all four replicas, and then runs the client test.

* `runReplias.sh`, which just starts all four replicas.

Expand Down Expand Up @@ -89,4 +87,4 @@ parallel: /home/bfink/builds/concord-bft/debug/bftengine/tests/simpleTest/script
parallel: /home/bfink/builds/concord-bft/debug/bftengine/tests/simpleTest/scripts/../server 1
Killing server processes named '/home/bfink/builds/concord-bft/debug/bftengine/tests/simpleTest/scripts/../server'
```
```
Loading

0 comments on commit ef43e67

Please sign in to comment.