Esempio n. 1
0
def test_write_new_locked_object():
    with pytest.raises(ValueError):
        with open(
                os.path.join(pytest.test_dir,
                             'fixtures/test-ec-ecdsa-cert.pem'), 'rb') as f:
            wr_bytes = f.read()

        cert.write_new(wr_bytes, certid=ObjectId.IFX_CERT)
Esempio n. 2
0
def test_write_new_faulty_objid():
    with pytest.raises(TypeError):
        with open(
                os.path.join(pytest.test_dir,
                             'fixtures/test-ec-ecdsa-cert.pem'), 'rb') as f:
            wr_bytes = f.read()

        cert.write_new(wr_bytes, certid=0xE0E0)
Esempio n. 3
0
def test_write_new_faulty_objid():
    LOGGER.info('Write new certificate in a fault Certificate Slot')
    with pytest.raises(TypeError):
        with open(
                os.path.join(pytest.test_dir,
                             'fixtures/test-ec-ecdsa-cert.pem'), 'rb') as f:
            wr_bytes = f.read()

        cert.write_new(wr_bytes, certid=0xE0E0)
Esempio n. 4
0
def test_write_new_faulty_cert():
    with pytest.raises(ValueError):
        with open(
                os.path.join(pytest.test_dir,
                             'fixtures/test-ec-ecdsa-faulty-cert.pem'),
                'rb') as f:
            wr_bytes = f.read()

        cert.write_new(wr_bytes, certid=ObjectId.USER_CERT_1)
Esempio n. 5
0
def test_write_new_faulty_cert():
    LOGGER.info('Try to write an false formated certificate')
    with pytest.raises(ValueError):
        with open(
                os.path.join(pytest.test_dir,
                             'fixtures/test-ec-ecdsa-faulty-cert.pem'),
                'rb') as f:
            wr_bytes = f.read()

        cert.write_new(wr_bytes, certid=ObjectId.USER_CERT_1)
Esempio n. 6
0
def test_write_new_specific():
    LOGGER.info('Write new certificate in a specific slot')
    with open(os.path.join(pytest.test_dir, 'fixtures/test-ec-ecdsa-cert.pem'),
              'rb') as f:
        der_bytes = f.read()
    cert.write_new(der_bytes, certid=ObjectId.USER_CERT_1)
Esempio n. 7
0
def test_write_new_default():
    LOGGER.info('Write new certificate in a default slot')
    with open(os.path.join(pytest.test_dir, 'fixtures/test-ec-ecdsa-cert.pem'),
              'rb') as f:
        der_bytes = f.read()
    cert.write_new(der_bytes)
Esempio n. 8
0
def test_write_new_specific():
    with open(os.path.join(pytest.test_dir, 'fixtures/test-ec-ecdsa-cert.pem'),
              'rb') as f:
        der_bytes = f.read()
    cert.write_new(der_bytes, certid=ObjectId.USER_CERT_1)
Esempio n. 9
0
def test_write_new_default():
    with open(os.path.join(pytest.test_dir, 'fixtures/test-ec-ecdsa-cert.pem'),
              'rb') as f:
        der_bytes = f.read()
    cert.write_new(der_bytes)