Skip to content

Commit

Permalink
should be working, unless log limit
Browse files Browse the repository at this point in the history
  • Loading branch information
jie committed Oct 1, 2023
1 parent f9c3040 commit 715e59a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CA/ca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func testGenerateKeypairs(t *testing.T) {

}

func TestREV(t *testing.T) {
func testREV(t *testing.T) {
ctx := InitializeCAContext("testFiles/ca_testconfig/1/CA_public_config.json", "testFiles/ca_testconfig/1/CA_private_config.json", "testFiles/ca_testconfig/1/CA_crypto_config.json")
// get current period
period := GetCurrentPeriod()
Expand All @@ -142,7 +142,8 @@ func TestREV(t *testing.T) {

}

func testTask(t *testing.T) {
func TestTask(t *testing.T) {
ctx := InitializeCAContext("testFiles/ca_testconfig/1/CA_public_config.json", "testFiles/ca_testconfig/1/CA_private_config.json", "testFiles/ca_testconfig/1/CA_crypto_config.json")
ctx.RevocationRatio = 0.01
StartCA(ctx)
}
19 changes: 19 additions & 0 deletions CA/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,26 @@ func PeriodicTask(ctx *CAContext) {
}
//mass revoke for the first period
if ctx.OnlineDuration == 0 {
fmt.Println(ctx.RevocationRatio)
var prebinary []byte
var postbinary []byte

// Serialize the CRV_current before mass revocation
prebinary, _ = ctx.CRV.CRV_current.MarshalBinary()
compressed_binary, _ := util.CompressData(prebinary)
prelen := len(compressed_binary)

// Perform mass revocation
ctx.CRV.MassRevoke(ctx.RevocationRatio)

// Serialize the CRV_current after mass revocation
postbinary, _ = ctx.CRV.CRV_current.MarshalBinary()
compressed_binary2, _ := util.CompressData(postbinary)
postlen := len(compressed_binary2)

fmt.Println("CRV size before and after mass revocation: ", prelen, postlen)
}

//fmt.Println(certlist)
// get current period
period := GetCurrentPeriod()
Expand All @@ -305,6 +323,7 @@ func PeriodicTask(ctx *CAContext) {
}
period = strconv.Itoa(periodnum)
rev := Generate_Revocation(ctx, period, 0)
//fmt.Println(rev)
fake_rev := Generate_Revocation(ctx, period, 1)
// update CRV
ctx.CRV.CRV_pre_update = ctx.CRV.CRV_current
Expand Down

0 comments on commit 715e59a

Please sign in to comment.