self._CheckBintool(p11_kit)
p11_kit_config = configparser.ConfigParser()
- out = tools.run('p11-kit', 'print-config')
+ out = p11_kit.run_cmd('print-config')
p11_kit_config.read_string(out)
softhsm2_lib = p11_kit_config.get('softhsm2', 'module',
fallback=None)
with unittest.mock.patch.dict('os.environ',
{'SOFTHSM2_CONF': softhsm2_conf,
'PKCS11_MODULE_PATH': softhsm2_lib}):
- tools.run('softhsm2-util', '--init-token', '--free', '--label',
- 'U-Boot token', '--pin', '1111', '--so-pin',
- '222222')
- tools.run('pkcs11-tool', '--module', softhsm2_lib,
- '--write-object', cert_file, '--pin', '1111',
- '--type', 'cert', '--id', '999999', '--label',
- 'test_cert', '--login')
- tools.run('softhsm2-util', '--import', private_key, '--token',
- 'U-Boot token', '--label', 'test_key', '--id', '999999',
- '--pin', '1111')
+ softhsm2_util.run_cmd('--init-token', '--free', '--label',
+ 'U-Boot token', '--pin', '1111',
+ '--so-pin', '222222')
+ pkcs11_tool.run_cmd('--module', softhsm2_lib,
+ '--write-object', cert_file, '--pin', '1111',
+ '--type', 'cert', '--id', '999999', '--label',
+ 'test_cert', '--login')
+ softhsm2_util.run_cmd('--import', private_key, '--token',
+ 'U-Boot token', '--label', 'test_key',
+ '--id', '999999', '--pin', '1111')
data = self._DoReadFile('capsule/signed_pkcs11.dts')
self._CheckCapsule(data, signed_capsule=True)
with unittest.mock.patch.dict('os.environ',
{'SOFTHSM2_CONF': softhsm2_conf}):
- tools.run('softhsm2-util', '--init-token', '--free', '--label',
- 'U-Boot token', '--pin', '1111', '--so-pin',
- '222222')
- tools.run('softhsm2-util', '--import', private_key, '--token',
- 'U-Boot token', '--label', 'test_key', '--id', '999999',
- '--pin', '1111')
+ softhsm2_util.run_cmd('--init-token', '--free', '--label',
+ 'U-Boot token', '--pin', '1111',
+ '--so-pin', '222222')
+ softhsm2_util.run_cmd('--import', private_key, '--token',
+ 'U-Boot token', '--label', 'test_key',
+ '--id', '999999', '--pin', '1111')
# Make sure the private key can only be accessed through the engine
os.remove(private_key)
with unittest.mock.patch.dict('os.environ',
{'SOFTHSM2_CONF': softhsm2_conf}):
- tools.run('softhsm2-util', '--init-token', '--free', '--label',
- 'U-Boot prod token', '--pin', '1234', '--so-pin',
- '222222')
- tools.run('softhsm2-util', '--import', private_key, '--token',
- 'U-Boot prod token', '--label', 'prod', '--id', '999999',
- '--pin', '1234')
+ softhsm2_util.run_cmd('--init-token', '--free', '--label',
+ 'U-Boot prod token', '--pin', '1234',
+ '--so-pin', '222222')
+ softhsm2_util.run_cmd('--import', private_key, '--token',
+ 'U-Boot prod token', '--label', 'prod',
+ '--id', '999999', '--pin', '1234')
# Make sure the private key can only be accessed through the engine
os.remove(private_key)