nvflare.fuel.hci.security module

class IdentityKey[source]

Bases: object

NAME = 'common_name'
ORG = 'organization'
ROLE = 'role'
get_certificate_common_name(cert: dict)[source]

Gets the common name of the provided certificate.

Parameters:

cert – certificate

Returns: common name of provided cert

get_certificate_identity(cert: dict) dict[source]

Gets the identity info of the provided certificate.

Parameters:

cert – certificate

Returns: identity info in a dict with following keys: name, org, role

get_identity_info(cert: dict)[source]

Gets the identity information from the provided certificate.

Parameters:

cert – certificate

Returns: if the cert is None, returning None.

if the cert is a dictinary, returning a dictionary containing three keys, common_name, organization and role.

hash_password(password)[source]

Hash a password for storing.

Parameters:

password – password to hash

Returns: hashed password

make_session_token()[source]

Makes a new session token.

Returns: created session token

verify_password(stored_password, provided_password)[source]

Verify a stored password against one provided by user.

Parameters:
  • stored_password – stored password

  • provided_password – password provided by user

Returns: True if the stored password equals the provided password, otherwise False