Example #1
0
    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
Example #2
0
    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
Example #3
0
    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
Example #4
0
    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
Example #5
0
    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
Example #6
0
    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
Example #7
0
    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]]
Example #8
0
    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
Example #9
0
    def test_verify_mfr_bad_signature(self):
        # {"manufacturer": {"organizationName":, "codeAccessStart":, "cvcAccessStart":},
        # "co-signer":{"organizationName":, "codeAccessStart":, "cvcAccessStart":}}
        # Format: YYYYMMDDHH[MM[SS[.fff]]]Z
        print "\n==================================================="
        print "Begin to test MFR's bad signature in codefile.."
        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

        rst = test.verify_file(self.codefile + "abcd")
        print "codefile verification result: " + str(
            rst[0]) + ", " + RST.ssdErrorMessage[rst[1]]

        if rst[0] == False:
            return
Example #10
0
    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
Example #11
0
    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]]
Example #12
0
    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)