Skip to content

Commit

Permalink
Created Main Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
tfn18001 committed Apr 25, 2022
1 parent b1b6651 commit 2101c7b
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 12 deletions.
4 changes: 2 additions & 2 deletions CTng/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*.code-workspace
# Cryptography details shouldn't be stored on the repo IMO.
**/*/*.crypto.json
# Test generated Cryptography details shouldn't be stored on the repo IMO.
**/*/*.test.json

__debug_bin
41 changes: 36 additions & 5 deletions CTng/Readme.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,47 @@
# Next Generation Certificate Transparency:

## Running the code
## Folders:

**`config`**: Contains the layout of private and public json configuration files used by Monitors and Gossipers. Also contains loaders for the object versions of these .json files.

**`crypto`**: Abstractions associated with CTng cryptographic implementations, and the cryptoconfig implementation.

**`gossip`**: Defines the Gossip object, the state object of the Gossiper, and many functions associated with running a gossiper.

**`GZip`**: Implements functions for reading arrays of bytes to a base-64 encoded, Gzip-compressed representation.

**`monitor`**: Defines the monitor server state and functions associated with monitor tasks, such as querying Loggers and CAs.

**`server`**: HTTP Server implementations for the Gossiper and Monitor. Should call functions from **`gossip`** or **`monitor`**, respectively.

**`util`**: a package that has no internal imports: helper functions and constants that are used throughout the codebase but prevents import cycles from occurring (import cycles are not allowed in go).


**`testData`**: Defines a configuration of CTng with 4 monitors, 4 gossipers, 3 CAs, and 3 Loggers. Also defines a fakeLogger and fakeCA HTTP client for testing.
___
## Files

**`ctng.go`**: A commandline interface for running a Monitor, Gossiper, fakeLogger, or fakeCA.

**`monitorTest.sh`**: run as `sh monitorTest.sh [N]`, where N is which monitor you want to run

# Running the code

Run `go install .` before continuing!

To run a single Monitor or gossiper, run
`go run . [gossiper|monitor|] [public_config_path] [private_config_path] [crypto_config_path]`

`go run . [gossiper|monitor|logger] [public_config_path] [private_config_path] [crypto_config_path]`.

E.X: `go run . gossiper ./public.json private.json crypto.json`

To run a fakeLogger or fakeCA, run
`go run . [logger|ca] [configPath]`

The `testData` folder contains configurations for testing, but configs can be generated using the functions in `config`.


## Function Documentation
___
# Function Documentation
Documentation + Function descriptions exist in each file/subfolder.

To view this this info + documentation in a formal documentation setting, utilize GoDoc.
To view this this info + documentation in a formal documentation setting, GoDoc could be utilized, but requires installing the repository locally as a package.
2 changes: 1 addition & 1 deletion CTng/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestLoadConfigs(t *testing.T) {
if err != nil {
t.Error(err)
}
gossiper_config, err := LoadGossiperConfig("test/gossiper_pub_config.json", "test/gossiper_priv_config.json", "test/localhost:8081.crypto.json")
gossiper_config, err := LoadGossiperConfig("test/gossiper_pub_config.json", "test/gossiper_priv_config.json", "test/localhost:8081.test.json")
if err != nil {
t.Error(err)
}
Expand Down
1 change: 0 additions & 1 deletion CTng/config/test/gossiper_priv_config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"Crypto_config_path": "config/test/localhost:8080.crypto.json",
"Connected_Gossipers": ["localhost:8082", "localhost:8083"],
"Owner_URL": "localhost:8080",
"Port": "8081"
Expand Down
1 change: 0 additions & 1 deletion CTng/config/test/monitor_priv_config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"Crypto_config_path": "config/test/localhost:8080.crypto.json",
"CA_URLs": ["192.168.1.1", "1.1.1.1", "255.255.255.255"],
"Logger_URLs": ["192.168.1.1", "1.1.1.1", "255.255.255.255"],
"Gossiper_URL": "localhost:8081",
Expand Down
2 changes: 1 addition & 1 deletion CTng/crypto/crypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func TestCryptoIO(T *testing.T) {
readConfigs := make([]*CryptoConfig, len(configs))
// Load the crypto files for each entity, sign a message, and verify the joint signature is valid.
for i := 0; i < len(entities); i++ {
c, err := ReadCryptoConfig("./testFiles/" + (string)(entities[i]) + ".crypto.json")
c, err := ReadCryptoConfig("./testFiles/" + (string)(entities[i]) + ".test.json")
confirmNil(T, err)
readConfigs[i] = c
}
Expand Down
2 changes: 1 addition & 1 deletion CTng/crypto/generate_crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func GenerateEntityCryptoConfigs(entityIDs []CTngID, threshold int) ([]CryptoCon
func SaveCryptoFiles(directory string, configs []CryptoConfig) error {
for _, config := range configs {
// fmt.Print(config)
file := fmt.Sprintf("%s/%s.crypto.json", directory, config.SelfID)
file := fmt.Sprintf("%s/%s.test.json", directory, config.SelfID)
err := util.WriteData(file, *NewStoredCryptoConfig(&config))
if err != nil {
return err
Expand Down

0 comments on commit 2101c7b

Please sign in to comment.