TlsPassword

Added in version 2.30.

class TlsPassword(**properties: Any)

Superclasses: Object

An abstract interface representing a password used in TLS. Often used in user interaction such as unlocking a key storage token.

Constructors

class TlsPassword
classmethod new(flags: TlsPasswordFlags, description: str) TlsPassword

Create a new TlsPassword object.

Parameters:
  • flags – the password flags

  • description – description of what the password is for

Methods

class TlsPassword
get_description() str

Get a description string about what the password will be used for.

Added in version 2.30.

get_flags() TlsPasswordFlags

Get flags about the password.

Added in version 2.30.

get_value() bytes

Get the password value. If length is not None then it will be filled in with the length of the password value. (Note that the password value is not nul-terminated, so you can only pass None for length in contexts where you know the password will have a certain fixed length.)

Added in version 2.30.

get_warning() str

Get a user readable translated warning. Usually this warning is a representation of the password flags returned from get_flags().

Added in version 2.30.

set_description(description: str) None

Set a description string about what the password will be used for.

Added in version 2.30.

Parameters:

description – The description of the password

set_flags(flags: TlsPasswordFlags) None

Set flags about the password.

Added in version 2.30.

Parameters:

flags – The flags about the password

set_value(value: Sequence[int]) None

Set the value for this password. The value will be copied by the password object.

Specify the length, for a non-nul-terminated password. Pass -1 as length if using a nul-terminated password, and length will be calculated automatically. (Note that the terminating nul is not considered part of the password in this case.)

Added in version 2.30.

Parameters:

value – the new password value

set_value_full(value: Sequence[int], destroy: Callable[[None], None] | None = None) None

Provide the value for this password.

The value will be owned by the password object, and later freed using the destroy function callback.

Specify the length, for a non-nul-terminated password. Pass -1 as length if using a nul-terminated password, and length will be calculated automatically. (Note that the terminating nul is not considered part of the password in this case.)

Added in version 2.30.

Parameters:
  • value – the value for the password

  • destroy – a function to use to free the password.

set_warning(warning: str) None

Set a user readable translated warning. Usually this warning is a representation of the password flags returned from get_flags().

Added in version 2.30.

Parameters:

warning – The user readable warning

Properties

class TlsPassword
props.description: str

Description of what the password is for.

Added in version 2.30.

props.flags: TlsPasswordFlags

Flags about the password.

Added in version 2.30.

props.warning: str

Warning about the password.

Added in version 2.30.

Virtual Methods

class TlsPassword
do_get_default_warning() str

virtual method for get_warning() if no value has been set using set_warning()

do_get_value() bytes

Get the password value. If length is not None then it will be filled in with the length of the password value. (Note that the password value is not nul-terminated, so you can only pass None for length in contexts where you know the password will have a certain fixed length.)

Added in version 2.30.

do_set_value(value: Sequence[int], destroy: Callable[[None], None] | None = None) None

Provide the value for this password.

The value will be owned by the password object, and later freed using the destroy function callback.

Specify the length, for a non-nul-terminated password. Pass -1 as length if using a nul-terminated password, and length will be calculated automatically. (Note that the terminating nul is not considered part of the password in this case.)

Added in version 2.30.

Parameters:
  • value – the value for the password

  • destroy – a function to use to free the password.

Fields

class TlsPassword
parent_instance
priv