def test_verify_no_co_initcode(self): # {"manufacturer": {"organizationName":, "codeAccessStart":, "cvcAccessStart":}, # "co-signer":{"organizationName":, "codeAccessStart":, "cvcAccessStart":}} # Format: YYYYMMDDHH[MM[SS[.fff]]]Z print "\n===================================================" print "Begin to test no co-signer information in initcode..." print "===================================================" # Case 1. Normal Case initcode = { "manufacturer": { "organizationName": "cisco", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" } } test = CFV(initcode, self.rootca) # Verify MFR CVC at first rst = test.verify_cvc(self.mfr_cvc, True) print "manufacturer CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return # Verify MSO CVC rst = test.verify_cvc(self.mso_cvc, False) print "mso CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return
def test_verify_mso_miss_cvc(self): print "\n===================================================" print "Begin to test Mso CVC is missing..." print "===================================================" initcode = { "manufacturer": { "organizationName": "cisco", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" }, "co-signer": { "organizationName": "comcast", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" } } test = CFV(initcode, self.rootca) # Verify MSO CVC rst = test.verify_cvc("", False) print "mso CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return
def test_verify_mso_no_exkey(self): print "\n===================================================" print "Begin to test MSO's extended key usage is missing or incorrect..." print "===================================================" initcode = { "manufacturer": { "organizationName": "cisco", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" }, "co-signer": { "organizationName": "Comcast", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" } } test = CFV(initcode, self.rootca) # Verify MFR CVC at first rst = test.verify_cvc(self.mfr_cvc, True) print "manufacturer CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return # Verify MSO CVC rst = test.verify_cvc(self.wrong_mso_cvc, False) print "mso CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return
def test_verify_mfr_bad_chain(self): print "\n===================================================" print "Begin to test MFR CVC is not chained to root CA..." print "===================================================" initcode = { "manufacturer": { "organizationName": "cisco", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" }, "co-signer": { "organizationName": "comcast", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" } } test = CFV(initcode, self.wrong_rootca) # Verify MFR CVC at first rst = test.verify_cvc(self.mfr_cvc, True) print "manufacturer CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return
def test_verify_mfr_no_issuer(self): print "\n===================================================" print "Begin to test MFR's issuer CA is missing or incorrect..." print "===================================================" # Case 1. Normal Case initcode = { "manufacturer": { "organizationName": "cisco", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" }, "co-signer": { "organizationName": "comcast", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" } } test = CFV(initcode, self.rootca) # Verify MFR CVC at first rst = test.verify_cvc(self.single_mfr_cvc, True) print "manufacturer CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return
def test_verify_mso_less_starttime(self): print "\n===================================================" print "Begin to test MSO's validity start time in CVC is less than RPD..." print "===================================================" # Case 1. Normal Case initcode = { "manufacturer": { "organizationName": "cisco", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" }, "co-signer": { "organizationName": "comcast", "codeAccessStart": "20160911122430Z", "cvcAccessStart": "20160911122430Z" } } test = CFV(initcode, self.rootca) # Verify MFR CVC at first rst = test.verify_cvc(self.mfr_cvc, True) print "manufacturer CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return # Verify MSO CVC rst = test.verify_cvc(self.mso_cvc, False) print "mso CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return
def test_verify_negative(self): print "\n===================================================" print "Begin to test the negative value verify....." print "===================================================" initcode = { "manufacturer": { "organizationName": "cisco", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" }, "co-signer": { "organizationName": "comcast", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" } } test = CFV(initcode, self.rootca) rst = test.verify_cvc('0000000000000000000000000000000', True) print "manufacturer CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] rst = test.verify_file('000000000000000000000000000000') print "codefile verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]]
def test_verify_invalid_period_in_codefile(self): # {"manufacturer": {"organizationName":, "codeAccessStart":, "cvcAccessStart":}, # "co-signer":{"organizationName":, "codeAccessStart":, "cvcAccessStart":}} # Format: YYYYMMDDHH[MM[SS[.fff]]]Z print "\n===================================================" print "Begin to test invalid period in codefile MFR CVC....." print "===================================================" # Case 1. Normal Case initcode = { "manufacturer": { "organizationName": "cisco", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" }, "co-signer": { "organizationName": "comcast", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" } } test = CFV(initcode, self.rootca) # Verify MFR CVC at first rst = test.verify_cvc(self.mfr_cvc, True) print "manufacturer CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return # Verify MSO CVC rst = test.verify_cvc(self.mso_cvc, False) print "mso CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return # Get the new parameters print "\nGet the new initcode:" initcode = test.get_initcode() print initcode # Reset the linux date save_date = datetime.datetime.now().date() os.system("date -s 2011-08-03") # Test codefile rst = test.verify_file(self.codefile) print "codefile verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] # recover the date os.system("date -s " + str(save_date)) if rst[0] == False: return
def test_verify_mfr_bad_chain(self): # {"manufacturer": {"organizationName":, "codeAccessStart":, "cvcAccessStart":}, # "co-signer":{"organizationName":, "codeAccessStart":, "cvcAccessStart":}} # Format: YYYYMMDDHH[MM[SS[.fff]]]Z print "\n===================================================" print "Begin to test MFR's cert in codefile is not chained to the root CA.." print "===================================================" # Case 1. Normal Case initcode = { "manufacturer": { "organizationName": "cisco", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" }, "co-signer": { "organizationName": "comcast", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" } } test = CFV(initcode, self.rootca) # Verify MFR CVC at first rst = test.verify_cvc(self.mfr_cvc, True) print "manufacturer CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return # Verify MSO CVC rst = test.verify_cvc(self.mso_cvc, False) print "mso CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return # Get the new parameters print "\nGet the new initcode:" initcode = test.get_initcode() print initcode # Reconfig the bad root CA test.set_rootca(self.wrong_rootca) rst = test.verify_file(self.codefile) print "codefile verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return
def test_verify_sha1_sign(self): # {"manufacturer": {"organizationName":, "codeAccessStart":, "cvcAccessStart":}, # "co-signer":{"organizationName":, "codeAccessStart":, "cvcAccessStart":}} # Format: YYYYMMDDHH[MM[SS[.fff]]]Z print "\n===================================================" print "Begin to test the wrong sha1 signature....." print "===================================================" # Case 1. Normal Case initcode = { "manufacturer": { "organizationName": "cisco", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" }, "co-signer": { "organizationName": "comcast", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" } } test = CFV(initcode, self.rootca) # Verify MFR CVC at first rst = test.verify_cvc(self.mfr_cvc, True) print "manufacturer CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return # Test codefile rst = test.verify_file(self.sha1_codefile) print "codefile verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return
def test_verify_mfr_name_mismatch(self): print "\n===================================================" print "Begin to test Manufacture's name mismatch in GCP CVC....." print "===================================================" # Case 1. Normal Case initcode = { "manufacturer": { "organizationName": "cisco2", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" }, "co-signer": { "organizationName": "comcast", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" } } test = CFV(initcode, self.rootca) # Verify MFR CVC at first rst = test.verify_cvc(self.mfr_cvc, True) print "manufacturer CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]]
def test_verify_mso_signing_time_cvc(self): # {"manufacturer": {"organizationName":, "codeAccessStart":, "cvcAccessStart":}, # "co-signer":{"organizationName":, "codeAccessStart":, "cvcAccessStart":}} # Format: YYYYMMDDHH[MM[SS[.fff]]]Z print "\n===================================================" print "Begin to test MSO's Signing time in codefile is less than CVC.." print "===================================================" # Case 1. Normal Case initcode = { "manufacturer": { "organizationName": "cisco", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" }, "co-signer": { "organizationName": "comcast", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" } } test = CFV(initcode, self.rootca) # Verify MFR CVC at first rst = test.verify_cvc(self.mfr_cvc, True) print "manufacturer CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return # Verify MSO CVC rst = test.verify_cvc(self.mso_cvc, False) print "mso CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return # Get the new parameters print "\nGet the new initcode:" initcode = test.get_initcode() print initcode # re-configure the wrong initcode initcode = { "manufacturer": { "organizationName": "cisco", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" }, "co-signer": { "organizationName": "comcast", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160911122430Z" } } # Test codefile test.set_initcode(initcode) rst = test.verify_file(self.codefile) print "codefile verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return
def test_verify(self): # {"manufacturer": {"organizationName":, "codeAccessStart":, "cvcAccessStart":}, # "co-signer":{"organizationName":, "codeAccessStart":, "cvcAccessStart":}} # Format: YYYYMMDDHH[MM[SS[.fff]]]Z print "\n===================================================" print "Begin to test the normal verification process....." print "===================================================" # Case 1. Normal Case initcode = { "manufacturer": { "organizationName": "cisco", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" }, "co-signer": { "organizationName": "comcast", "codeAccessStart": "20160311122430Z", "cvcAccessStart": "20160311122430Z" } } test = CFV(initcode, self.rootca) # Verify MFR CVC at first rst = test.verify_cvc(self.mfr_cvc, True) print "manufacturer CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return # Verify MSO CVC rst = test.verify_cvc(self.mso_cvc, False) print "mso CVC verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return # Get the new parameters print "\nGet the new initcode:" initcode = test.get_initcode() print initcode # Test codefile rst = test.verify_file(self.codefile) print "codefile verification result: " + str( rst[0]) + ", " + RST.ssdErrorMessage[rst[1]] if rst[0] == False: return # Get the new parameters print "\nGet the new initcode:" initcode = test.get_initcode() print initcode # Get the image ret = test.get_image('/tmp/testsvae', self.codefile) self.assertTrue(ret) ret = test.get_image('/tmp/', self.codefile) self.assertFalse(ret)