Chromium Code Reviews| Index: client/cros/ownership.py |
| diff --git a/client/cros/ownership.py b/client/cros/ownership.py |
| index 008f5319bdc498ff1ba93eed0915c9d9ce08df5e..88b1d6b4605e5c39e8cc96d2ba81083a8bb173de 100644 |
| --- a/client/cros/ownership.py |
| +++ b/client/cros/ownership.py |
| @@ -77,6 +77,21 @@ def connect_to_session_manager(): |
| return dbus.Interface(proxy, 'org.chromium.SessionManagerInterface') |
| +def listen_to_session_manager_signal(callback, signal): |
| + """Create and return a DBus connection to session_manager. |
| + |
| + Connects to the session manager over the DBus system bus. Returns |
| + appropriately configured DBus interface object. |
| + """ |
| + bus = dbus.SystemBus() |
| + bus.add_signal_receiver( |
| + handler_function=callback, |
| + signal_name=signal, |
| + dbus_interface='org.chromium.Chromium', |
| + bus_name=None, |
| + path='/') |
| + |
| + |
| NSSDB = constants.CRYPTOHOME_MOUNT_PT + '/.pki/nssdb' |
| PK12UTIL = 'nsspk12util' |
| OPENSSLP12 = 'openssl pkcs12' |
| @@ -86,6 +101,34 @@ OPENSSLREQ = 'openssl req' |
| OPENSSLCRYPTO = 'openssl sha1' |
| +def use_known_ownerkeys(): |
|
petkov
2011/04/28 22:16:25
where is this routine used?
Chris Masone
2011/04/28 22:43:51
login_OwnershipApi.py
petkov
2011/04/28 22:48:47
So you rely on these test running in a specific se
|
| + """Sets the system up to use a well-known keypair for owner operations. |
| + |
| + Assuming the appropriate cryptohome is already mounted, configures the |
| + device to accept policies signed with the checked-in 'mock' owner key. |
| + """ |
| + dirname = os.path.dirname(__file__) |
| + mock_keyfile = os.path.join(dirname, 'mock_owner_private.key') |
| + mock_certfile = os.path.join(dirname, 'mock_owner_cert.pem') |
| + push_to_nss(mock_keyfile, mock_certfile, NSSDB) |
| + utils.open_write_close(constants.OWNER_KEY_FILE, |
| + cert_extract_pubkey_der(mock_certfile)) |
| + |
| + |
| +def known_privkey(): |
| + """Returns the mock owner private key in PEM format. |
| + """ |
| + dirname = os.path.dirname(__file__) |
| + return utils.read_file(os.path.join(dirname, 'mock_owner_private.key')) |
|
petkov
2011/04/28 22:16:25
mock_owner_private.key used in a couple of place -
Chris Masone
2011/04/28 22:43:51
Done.
|
| + |
| + |
| +def known_pubkey(): |
| + """Returns the mock owner public key in DER format. |
| + """ |
| + dirname = os.path.dirname(__file__) |
| + return cert_extract_pubkey_der(os.path.join(dirname, 'mock_owner_cert.pem')) |
|
petkov
2011/04/28 22:16:25
mock_owner_cert.pem in a constant?
Chris Masone
2011/04/28 22:43:51
Done.
|
| + |
| + |
| def pairgen(): |
| """Generate a self-signed cert and associated private key. |