コード例 #1
0
ファイル: test_ssd_verify.py プロジェクト: hujiangyi/or
    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]]
コード例 #2
0
ファイル: test_ssd_verify.py プロジェクト: hujiangyi/or
    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
コード例 #3
0
ファイル: test_ssd_verify.py プロジェクト: hujiangyi/or
    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
コード例 #4
0
ファイル: test_ssd_verify.py プロジェクト: hujiangyi/or
    def test_verify_wrong_codefile(self):
        # {"manufacturer": {"organizationName":, "codeAccessStart":, "cvcAccessStart":},
        # "co-signer":{"organizationName":, "codeAccessStart":, "cvcAccessStart":}}
        # Format: YYYYMMDDHH[MM[SS[.fff]]]Z
        print "\n==================================================="
        print "Begin to test wrong 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

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

        if rst[0] == False:
            return
コード例 #5
0
ファイル: test_ssd_verify.py プロジェクト: hujiangyi/or
    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
コード例 #6
0
ファイル: test_ssd_verify.py プロジェクト: hujiangyi/or
    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)