Exemple #1
0
    def runTest(self):
        logging.info(
            '  -- Test PAT06a: create PMP import file for CA root certificate')
        certificate_file = os.path.abspath(
            'testdata/PAT/06/StartComCa_root.pem')
        pmpinput_file = make_dirs(
            os.path.abspath('work/PAT/06/StartComCa_root.json'))  # output
        cliClient = CliPatool([
            '-v', 'caCert', '--certfile', certificate_file, '--pvprole', 'IDP',
            pmpinput_file
        ])
        PAtool.run_me(cliClient)
        assertNoDiff(os.path.basename(pmpinput_file), subdir='PAT/06')

        logging.info(
            '  -- Test PAT06b: create PMP import file for CA intermediate certificate'
        )
        certificate_file = os.path.abspath(
            'testdata/PAT/06/StartComCa_intermed.pem')
        pmpinput_file = os.path.abspath(
            'work/PAT/06/StartComCa_intermed.json')  # output
        cliClient = CliPatool([
            '-v', 'caCert', '--certfile', certificate_file, '--pvprole', 'IDP',
            pmpinput_file
        ])
        PAtool.run_me(cliClient)
        assertNoDiff(os.path.basename(pmpinput_file), subdir='PAT/06')
Exemple #2
0
    def runTest(self):
        logging.info(
            '  -- Test PAT03a: sign EntityDescriptor with invalid SAML schema (OK with xmllint, failing with xerces)'
        )
        entitydescriptor_file = os.path.abspath(
            'testdata/PAT/03/gondorWienGvAt_invalidXsd.xml')
        output_dir = make_dirs(os.path.abspath('work/PAT/03/'), dir=True)
        cliClient = CliPatool(
            ['-v', 'signED', '-o', output_dir, entitydescriptor_file])
        with self.assertRaises(InvalidSamlXmlSchemaError) as context:
            PAtool.run_me(cliClient)

        logging.info('  -- Test PAT03b: root is not md:EntityDescriptor')
        entitydescriptor_file = os.path.abspath(
            'testdata/PAT/03/gondorMagwienGvAt_enveloping_sig.xml')
        cliClient = CliPatool(
            ['-v', 'signED', '-o', output_dir, entitydescriptor_file])
        with self.assertRaises(InputValueError) as context:
            PAtool.run_me(cliClient)

        logging.info(
            '  -- Test PAT03c: EntityDescriptor not root (enveloping signature)'
        )
        entitydescriptor_file = os.path.abspath(
            'testdata/PAT/03/gondorWienGvAt_invalidXml.xml')
        cliClient = CliPatool(
            ['-v', 'signED', '-o', output_dir, entitydescriptor_file])
        with self.assertRaises(lxml.etree.XMLSyntaxError) as context:
            PAtool.run_me(cliClient)
        sys.tracebacklimit = 1000
Exemple #3
0
def run_me(testrunnerInvocation=None):
    if sys.version_info < (3, 4):
        raise "must use python 3.4 or greater"
    if testrunnerInvocation:
        invocation = testrunnerInvocation
    else:
        invocation = CliPatool()

    patool = PAtool(invocation.args)
    if (invocation.args.subcommand == 'createED'):
        patool.createED()
    elif (invocation.args.subcommand == 'signED'):
        patool.signED(invocation.args.input_fn)
    #elif (invocation.args.subcommand == 'extractED'):
    #    patool.extractED()
    elif (invocation.args.subcommand == 'deleteED'):
        patool.deleteED()
    elif (invocation.args.subcommand == 'revokeCert'):
        patool.revokeCert()
    elif (invocation.args.subcommand == 'caCert'):
        patool.caCert()
    elif (invocation.args.subcommand == 'adminCert'):
        patool.adminCert()
    elif (invocation.args.subcommand == 'exportCerts'):
        patool.export_certs_idp()
Exemple #4
0
 def runTest(self):
     logging.info(
         '  -- Test PAT07: create PMP import file for admin certificate (challenge)'
     )
     pmpinput_file = make_dirs(
         os.path.abspath('work/PAT/07/add_admincert.json'))  # output
     cliClient = CliPatool(
         ['-v', 'adminCert', '--orgid', '4711', pmpinput_file])
     PAtool.run_me(cliClient)
Exemple #5
0
    def runTest(self):
        logging.info(
            '  -- Test PAT02a: sign EntityDescriptor w/o xml header to default output'
        )
        entitydescriptor_file = os.path.abspath(
            'testdata/PAT/02/redmineIdentineticsOrg_ed.xml')
        output_dir = make_dirs(os.path.abspath('work/PAT/02/'), dir=True)
        cliClient = CliPatool(
            ['-v', 'signED', '-o', output_dir, entitydescriptor_file])
        PAtool.run_me(cliClient)

        logging.info(
            '  -- Test PAT02b: sign EntityDescriptor with xml header to specified output'
        )
        entitydescriptor_file = os.path.abspath(
            'testdata/PAT/02/idpExampleCom_unsigned.xml')
        entitydescriptor_sig_file = os.path.abspath(
            'work/PAT/02/idpExampleCom.xml')
        cliClient = CliPatool(
            ['-v', 'signED', '-o', output_dir, entitydescriptor_file])
        PAtool.run_me(cliClient)
Exemple #6
0
    def runTest(self):
        logging.info(
            '  -- Test PAT08a: create PMP import file for admin certificate (import)'
        )
        certificate_file = os.path.abspath('testdata/PAT/08/ecard_qcert.pem')
        pmpinput_file = make_dirs(
            os.path.abspath('work/PAT/08/add_admincert-a.json'))  # output
        cliClient = CliPatool([
            '-v', 'adminCert', '--orgid', 'L10', '--certfile',
            certificate_file, pmpinput_file
        ])
        PAtool.run_me(cliClient)

        logging.info(
            '  -- Test PAT08b: create PMP import file for admin certificate (import)'
        )
        certificate_file = os.path.abspath(
            'testdata/PAT/08/ecard_qcert_multiline.b64')
        pmpinput_file = make_dirs(
            os.path.abspath('work/PAT/08/add_admincert-b.json'))  # output
        cliClient = CliPatool([
            '-v', 'adminCert', '--orgid', 'L10', '--certfile',
            certificate_file, pmpinput_file
        ])
        PAtool.run_me(cliClient)

        logging.info(
            '  -- Test PAT08c: create PMP import file for admin certificate (import)'
        )
        certificate_file = os.path.abspath(
            'testdata/PAT/08/ecard_qcert_multiline.b64')
        pmpinput_file = make_dirs(
            os.path.abspath('work/PAT/08/add_admincert-c.json'))  # output
        cliClient = CliPatool([
            '-v', 'adminCert', '--orgid', 'L10', '--certfile',
            certificate_file, pmpinput_file
        ])
        PAtool.run_me(cliClient)
Exemple #7
0
 def runTest(self):
     logging.info(
         '  -- Test PAT01: create EntitDescriptor from certificate (pvzd:pvptype="R-Profile")'
     )
     certificate_file = os.path.abspath(
         'testdata/PAT/01/redmineIdentineticsCom-cer.pem')
     entitydescriptor_file = 'redmineIdentineticsCom_idpXml.unsigned.xml'
     output_dir = make_dirs(os.path.abspath('work/PAT/01/'), dir=True)
     cliClient = CliPatool([
         '-v', 'createED', '-e', 'https://redmine.identinetics.com/idp.xml',
         '-r', 'IDP', '-o', output_dir, certificate_file
     ])
     PAtool.run_me(cliClient)
     assertNoDiff(os.path.basename(entitydescriptor_file), subdir='PAT/01')
Exemple #8
0
 def runTest(self):
     logging.info(
         '  -- Test PAT04: create request to delete EntityDescriptor from metadata'
     )
     entitydescriptor_file = os.path.abspath(
         'work/PAT/04/redmineIdentineticsOrg_IdpXml.xml')
     output_dir = make_dirs(os.path.abspath('work/PAT/04/'), dir=True)
     cliClient = CliPatool([
         '-v', 'deleteED', '--entityid',
         'https://redmine.identinetics.com/idp.xml', '--outputdir',
         output_dir
     ])
     PAtool.run_me(cliClient)
     os.path.exists(entitydescriptor_file)
Exemple #9
0
 def runTest(self):
     logging.info(
         '  -- Test PAT05: create PMP import file to revoke a certificate')
     certificate_file = os.path.abspath(
         'testdata/PAT/05/gondorMagwienGvAt_2011-cer.pem')
     pmpinput_file = make_dirs(
         os.path.abspath(
             'work/PAT/05/gondorMagwienGvAt_2011-cer_revoke.json')
     )  # output
     cliClient = CliPatool([
         '-v', 'revokeCert', '--certfile', certificate_file, '--reason',
         'testing revocation', pmpinput_file
     ])
     PAtool.run_me(cliClient)
     assertNoDiff(os.path.basename(pmpinput_file), subdir='PAT/05')