@@ -20,10 +20,9 @@ import (
20
20
func TestHandler_ProposeAddDaRootCert (t * testing.T ) {
21
21
setup := utils .Setup (t )
22
22
23
- rootCertificate := utils .RootCertificate (setup .Trustee1 )
24
-
25
23
// propose DA root certificate
26
- proposeAddX509RootCert := utils .ProposeDaRootCertificate (setup , setup .Trustee1 , rootCertificate .PemCert )
24
+ rootCertificate := utils .RootDaCertificate (setup .Trustee1 )
25
+ proposeAddX509RootCert := utils .ProposeDaRootCertificate (setup , rootCertificate )
27
26
28
27
// Check state indexes
29
28
indexes := utils.TestIndexes {
@@ -53,8 +52,8 @@ func TestHandler_AddDaRootCert(t *testing.T) {
53
52
setup := utils .Setup (t )
54
53
55
54
// propose add x509 root certificate by trustee
56
- rootCertificate := utils .RootCertificate (setup .Trustee1 )
57
- utils .ProposeDaRootCertificate (setup , setup . Trustee1 , rootCertificate . PemCert )
55
+ rootCertificate := utils .RootDaCertificate (setup .Trustee1 )
56
+ utils .ProposeDaRootCertificate (setup , rootCertificate )
58
57
59
58
// approve by second trustee
60
59
utils .ApproveDaRootCertificate (setup , setup .Trustee2 , rootCertificate .Subject , rootCertificate .SubjectKeyId )
@@ -83,8 +82,8 @@ func TestHandler_AddDaRootCert_TwoThirdApprovalsNeeded(t *testing.T) {
83
82
setup := utils .Setup (t )
84
83
85
84
// propose x509 root certificate by account without trustee role
86
- rootCertificate := utils .RootCertificate (setup .Trustee1 )
87
- utils .ProposeDaRootCertificate (setup , setup . Trustee1 , rootCertificate . PemCert )
85
+ rootCertificate := utils .RootDaCertificate (setup .Trustee1 )
86
+ utils .ProposeDaRootCertificate (setup , rootCertificate )
88
87
89
88
// Create an array of trustee account from 1 to 50
90
89
trusteeAccounts , totalAdditionalTrustees := setup .CreateNTrusteeAccounts ()
@@ -160,8 +159,8 @@ func TestHandler_AddDaRootCert_FourApprovalsAreNeeded_FiveTrustees(t *testing.T)
160
159
setup .AddAccount (fifthTrustee , []dclauthtypes.AccountRole {dclauthtypes .Trustee }, 1 )
161
160
162
161
// propose x509 root certificate by account Trustee1
163
- rootCertificate := utils .RootCertificate (setup .Trustee1 )
164
- utils .ProposeDaRootCertificate (setup , setup . Trustee1 , rootCertificate . PemCert )
162
+ rootCertificate := utils .RootDaCertificate (setup .Trustee1 )
163
+ utils .ProposeDaRootCertificate (setup , rootCertificate )
165
164
166
165
// approve x509 root certificate by account Trustee2
167
166
utils .ApproveDaRootCertificate (setup , setup .Trustee2 , rootCertificate .Subject , rootCertificate .SubjectKeyId )
@@ -220,13 +219,13 @@ func TestHandler_ProposeAddX509RootCert_ForDifferentSerialNumber(t *testing.T) {
220
219
setup := utils .Setup (t )
221
220
222
221
// store root certificate with different serial number
223
- rootCertificate := utils .RootCertificate (setup .Trustee1 )
222
+ rootCertificate := utils .RootDaCertificate (setup .Trustee1 )
224
223
rootCertificate .SerialNumber = utils .SerialNumber
225
- utils .AddMokedDaCertificate (setup , rootCertificate , true )
224
+ utils .AddMokedDaCertificate (setup , rootCertificate )
226
225
227
226
// propose second root certificate
228
- testRootCertificate := utils .RootCertificate (setup .Trustee1 )
229
- utils .ProposeDaRootCertificate (setup , setup . Trustee1 , testRootCertificate . PemCert )
227
+ testRootCertificate := utils .RootDaCertificate (setup .Trustee1 )
228
+ utils .ProposeDaRootCertificate (setup , testRootCertificate )
230
229
231
230
// Check state indexes
232
231
indexes := utils.TestIndexes {
@@ -255,11 +254,11 @@ func TestHandler_AddDaRootCerts_SameSubjectKeyIdButDifferentSubject(t *testing.T
255
254
setup := utils .Setup (t )
256
255
257
256
// add Certificate1
258
- testRootCertificate := utils .PAACertWithSameSubjectID1 (setup .Trustee1 )
257
+ testRootCertificate := utils .RootDaCertWithSameSubjectKeyID1 (setup .Trustee1 )
259
258
utils .ProposeAndApproveRootCertificate (setup , setup .Trustee1 , testRootCertificate )
260
259
261
260
// add Certificate2
262
- testRootCertificate2 := utils .PAACertWithSameSubjectID2 (setup .Trustee1 )
261
+ testRootCertificate2 := utils .RootDaCertificateWithSameSubjectKeyID2 (setup .Trustee1 )
263
262
utils .ProposeAndApproveRootCertificate (setup , setup .Trustee1 , testRootCertificate2 )
264
263
265
264
// Check indexes by subject + subject key id
@@ -301,8 +300,8 @@ func TestHandler_RejectAddDaRootCert(t *testing.T) {
301
300
setup := utils .Setup (t )
302
301
303
302
// propose x509 root certificate by account Trustee1
304
- testRootCertificate := utils .RootCertificate (setup .Trustee1 )
305
- utils .ProposeDaRootCertificate (setup , setup . Trustee1 , testRootCertificate . PemCert )
303
+ testRootCertificate := utils .RootDaCertificate (setup .Trustee1 )
304
+ utils .ProposeDaRootCertificate (setup , testRootCertificate )
306
305
307
306
// reject x509 root certificate by account Trustee2
308
307
utils .RejectDaRootCertificate (setup , setup .Trustee2 , testRootCertificate .Subject , testRootCertificate .SubjectKeyId )
@@ -369,8 +368,8 @@ func TestHandler_ApproveX509RootCertAndRejectX509RootCert_FromTheSameTrustee(t *
369
368
setup := utils .Setup (t )
370
369
371
370
// propose add x509 root certificate
372
- rootCertificate := utils .RootCertificate (setup .Trustee1 )
373
- utils .ProposeDaRootCertificate (setup , setup . Trustee1 , rootCertificate . PemCert )
371
+ rootCertificate := utils .RootDaCertificate (setup .Trustee1 )
372
+ utils .ProposeDaRootCertificate (setup , rootCertificate )
374
373
375
374
for _ , role := range []dclauthtypes.AccountRole {
376
375
dclauthtypes .Trustee ,
@@ -404,8 +403,8 @@ func TestHandler_RejectX509RootCertAndApproveX509RootCert_FromTheSameTrustee(t *
404
403
setup := utils .Setup (t )
405
404
406
405
// propose add x509 root certificate
407
- rootCertificate := utils .RootCertificate (setup .Trustee1 )
408
- utils .ProposeDaRootCertificate (setup , setup . Trustee1 , rootCertificate . PemCert )
406
+ rootCertificate := utils .RootDaCertificate (setup .Trustee1 )
407
+ utils .ProposeDaRootCertificate (setup , rootCertificate )
409
408
410
409
for _ , role := range []dclauthtypes.AccountRole {
411
410
dclauthtypes .Trustee ,
@@ -450,8 +449,8 @@ func TestHandler_RejectX509RootCert_TwoRejectApprovalsAreNeeded_FiveTrustees(t *
450
449
setup .AddAccount (fifthTrustee , []dclauthtypes.AccountRole {dclauthtypes .Trustee }, 1 )
451
450
452
451
// propose x509 root certificate by account Trustee1
453
- rootCertificate := utils .RootCertificate (setup .Trustee1 )
454
- utils .ProposeDaRootCertificate (setup , setup . Trustee1 , rootCertificate . PemCert )
452
+ rootCertificate := utils .RootDaCertificate (setup .Trustee1 )
453
+ utils .ProposeDaRootCertificate (setup , rootCertificate )
455
454
456
455
// reject x509 root certificate by account Trustee2
457
456
utils .RejectDaRootCertificate (setup , setup .Trustee2 , rootCertificate .Subject , rootCertificate .SubjectKeyId )
@@ -502,8 +501,8 @@ func TestHandler_ProposeAddAndRejectX509RootCert_ByTrustee(t *testing.T) {
502
501
setup := utils .Setup (t )
503
502
504
503
// propose x509 root certificate
505
- rootCertificate := utils .RootCertificate (setup .Trustee1 )
506
- utils .ProposeDaRootCertificate (setup , setup . Trustee1 , rootCertificate . PemCert )
504
+ rootCertificate := utils .RootDaCertificate (setup .Trustee1 )
505
+ utils .ProposeDaRootCertificate (setup , rootCertificate )
507
506
508
507
// reject x509 root certificate
509
508
utils .RejectDaRootCertificate (setup , setup .Trustee1 , rootCertificate .Subject , rootCertificate .SubjectKeyId )
@@ -531,8 +530,8 @@ func TestHandler_ProposeAddAndRejectX509RootCert_ByAnotherTrustee(t *testing.T)
531
530
setup := utils .Setup (t )
532
531
533
532
// propose x509 root certificate
534
- rootCertificate := utils .RootCertificate (setup .Trustee1 )
535
- utils .ProposeDaRootCertificate (setup , setup . Trustee1 , rootCertificate . PemCert )
533
+ rootCertificate := utils .RootDaCertificate (setup .Trustee1 )
534
+ utils .ProposeDaRootCertificate (setup , rootCertificate )
536
535
537
536
// reject x509 root certificate
538
537
utils .RejectDaRootCertificate (setup , setup .Trustee2 , rootCertificate .Subject , rootCertificate .SubjectKeyId )
@@ -564,8 +563,8 @@ func TestHandler_ProposeAddAndRejectX509RootCertWithApproval_ByTrustee(t *testin
564
563
setup .CreateTrusteeAccount (1 )
565
564
566
565
// propose x509 root certificate
567
- rootCertificate := utils .RootCertificate (setup .Trustee1 )
568
- utils .ProposeDaRootCertificate (setup , setup . Trustee1 , rootCertificate . PemCert )
566
+ rootCertificate := utils .RootDaCertificate (setup .Trustee1 )
567
+ utils .ProposeDaRootCertificate (setup , rootCertificate )
569
568
570
569
// approve
571
570
utils .ApproveDaRootCertificate (setup , setup .Trustee2 , rootCertificate .Subject , rootCertificate .SubjectKeyId )
@@ -660,7 +659,7 @@ func TestHandler_ProposeAddX509RootCert_CertificateAlreadyExists(t *testing.T) {
660
659
setup := utils .Setup (t )
661
660
662
661
// store x509 root certificate
663
- rootCertificate := utils .RootCertificate (testconstants .Address1 )
662
+ rootCertificate := utils .RootDaCertificate (testconstants .Address1 )
664
663
setup .Keeper .SetUniqueCertificate (
665
664
setup .Ctx ,
666
665
utils .UniqueCertificate (rootCertificate .Subject , rootCertificate .SerialNumber ),
@@ -678,7 +677,7 @@ func TestHandler_ProposeAddX509RootCert_ForNocCertificate(t *testing.T) {
678
677
setup := utils .Setup (t )
679
678
680
679
// Store the NOC root certificate
681
- nocRootCertificate := utils .RootCertificate (setup .Vendor1 )
680
+ nocRootCertificate := utils .RootDaCertificate (setup .Vendor1 )
682
681
nocRootCertificate .SerialNumber = testconstants .TestSerialNumber
683
682
nocRootCertificate .CertificateType = types .CertificateType_OperationalPKI
684
683
nocRootCertificate .Approvals = nil
@@ -704,7 +703,7 @@ func TestHandler_ProposeAddX509RootCert_ForDifferentSerialNumberDifferentSigner(
704
703
setup := utils .Setup (t )
705
704
706
705
// store root certificate with different serial number
707
- rootCertificate := utils .RootCertificate (testconstants .Address1 )
706
+ rootCertificate := utils .RootDaCertificate (testconstants .Address1 )
708
707
rootCertificate .SerialNumber = utils .SerialNumber
709
708
setup .Keeper .SetUniqueCertificate (
710
709
setup .Ctx ,
0 commit comments