fn get_key_states(
nethsm: &NetHsm,
admin_credentials: &AdminCredentials,
) -> Result<Vec<KeyState>, Error>
Expand description
Retrieves the state for all keys on a [NetHsm
] backend.
Collects each key, their [KeyType
] and list of [KeyMechanisms
][KeyMechanism
].
Also attempts to derive a [CryptographicKeyContext
] from the key certificate.
§Note
This function uses the nethsm
with the default
R-Administrator, but may switch to a
namespace-specific N-Administrator for individual operations.
If this function succeeds, the nethsm
is guaranteed to use the default
R-Administrator again.
If this function fails, the nethsm
may still use a namespace-specific N-Administrator.
§Errors
Returns an error if
- using the default R-Administrator for authentication against the backend fails,
- retrieving the names of all system-wide keys on the backend fails,
- retrieving information on a specific system-wide key on the backend fails,
- an N-Administrator in
admin_credentials
is not actually in a namespace, - using the credentials of an N-Administrator fails,
- retrieving the names of all namespaced keys on the backend fails,
- or retrieving information on a specific namespaced key on the backend fails.