diff --git a/CTng/gossip/accusation_validation.go b/CTng/gossip/accusation_validation.go index 107113a..d36acd9 100644 --- a/CTng/gossip/accusation_validation.go +++ b/CTng/gossip/accusation_validation.go @@ -9,10 +9,11 @@ type Accusation_POM struct { Signature_TH crypto.ThresholdSig } +//Written By Jie //verification for PoM due to enough number of accusations happens during the PoM generation //we are not sending the entire PoM generated by enough number of accusations as gossip object //therefore, we will verify the combined parital signature at the local level - +//This function will be invoked in the Process_accusation function in accusations.go when the number of accusations accumulated after receiving a new one exceeds the threshold func generate_accusation_pom_from_accused_entity(Ea EntityAccusations, c *crypto.CryptoConfig) *Accusation_POM { pom_sig, _ := c.ThresholdAggregate(Ea.Partial_sigs) new_Pom02 := new(Accusation_POM) @@ -21,6 +22,8 @@ func generate_accusation_pom_from_accused_entity(Ea EntityAccusations, c *crypto return new_Pom02 } +//Written by Jie +//This function is invoked in Process_accusation function in accusations.go after invoking generate_accusation_pom_from_accused_entity to check the validity of the new generated PoM func verify_accusation_pom(candidatepom Accusation_POM, c *crypto.CryptoConfig) error { //generate the msg and verify the signature return c.ThresholdVerify(candidatepom.Entity_URL, candidatepom.Signature_TH) diff --git a/CTng/gossip/accusations.go b/CTng/gossip/accusations.go index 5a7e22f..4062fa1 100644 --- a/CTng/gossip/accusations.go +++ b/CTng/gossip/accusations.go @@ -6,10 +6,11 @@ import ( "fmt" ) -/*This file mainly deals with Proof of Misbehavior generated after receiving threshold number of accusations (as part of the process accusations). -This file also contains the process accusations function for the gossiper to invoke. -*/ - +//Written by Jie, reviewed and edited by Finn +//This function is invoked when the gossiper receives an accusation +//It will store all the non-duplicate accusations +//it will deal with PoM generation due to threshold number of accusations by invoking generate_accusation_pom_from_accused_entity from accusation_validation.go +//if a PoM due to threshold number of accusations is generated, the PoM will be returned as a gossip_object to be sent to the monitor func Process_Accusation(new_acc Gossip_object, accs *AccusationDB, c *crypto.CryptoConfig) (*Gossip_object, bool, error) { // Convert signature string p_sig, err := crypto.SigFragmentFromString(new_acc.Signature[0]) diff --git a/CTng/monitor/monitor.go b/CTng/monitor/monitor.go index f5c1660..c7b3bde 100644 --- a/CTng/monitor/monitor.go +++ b/CTng/monitor/monitor.go @@ -86,8 +86,10 @@ func QueryAuthorities(c *MonitorContext) { } +//Written by Jie +//This function accuses the entity if the damain name is provided +//It is called when the gossip object received is not valid, or the monitor didn't get response when querying the logger or the CA //Accused = Domain name of the accused entity (logger etc.) -//should be a monitor functionality func AccuseEntity(c *MonitorContext, Accused string) { // this should be a method for the monitor // verify we havent accused during this MMD @@ -119,6 +121,8 @@ func AccuseEntity(c *MonitorContext, Accused string) { Send_to_gossiper(c, accusation) } +//Written by Jie +//Send the input gossip object to its gossiper func Send_to_gossiper(c *MonitorContext, g gossip.Gossip_object) { // Convert gossip object to JSON msg, err := json.Marshal(g) diff --git a/CTng/monitor/monitor_process.go b/CTng/monitor/monitor_process.go index 51afe81..be9534e 100644 --- a/CTng/monitor/monitor_process.go +++ b/CTng/monitor/monitor_process.go @@ -7,7 +7,9 @@ import ( "time" ) -//Need to discuss about this ****************************************************** +//Written by Jie, reviewed by Finn +//This function is called by handle_gossip in monitor_server.go under the server folder +//It will be called if the gossip object is validated func Process_valid_object(c *MonitorContext, g gossip.Gossip_object) { //if the valid object is from the logger in the monitor config logger URL list //This handles the STHS diff --git a/CTng/server/Monitor_server.go b/CTng/server/Monitor_server.go index 729b102..51e4203 100644 --- a/CTng/server/Monitor_server.go +++ b/CTng/server/Monitor_server.go @@ -133,6 +133,10 @@ func getPOM(c *monitor.MonitorContext, w http.ResponseWriter, r *http.Request) { // if POM found, send to requester } +//Written by Jie +//This function handles gossip object received by the monitor +//Note: This function does not handle inactive loggers/CAs +//see monitor folder for handling inactive loggers/CAs func handle_gossip(c *monitor.MonitorContext, w http.ResponseWriter, r *http.Request) { // Parse sent object. // Converts JSON passed in the body of a POST to a Gossip_object. diff --git a/CTng/util/IO.go b/CTng/util/IO.go index 327d177..17db6ad 100644 --- a/CTng/util/IO.go +++ b/CTng/util/IO.go @@ -7,6 +7,7 @@ import ( "strings" ) +//Written By Jie //This read function reads from a Json file as a byte array and returns it. //This function will be called for all the reading from json functions