Importer#
- class Importer(*args, **kwargs)#
An interface which allows importing of certificates and keys. Each importer is registered with a set of PKCS#11 attributes to match stuff that it can import.
An importer gets passed a Parser
and accesses the currently parsed
item. To create a set of importers that can import the currently parsed
item in a parser, use create_for_parsed
. The list of
importers returned has the parsed item queued for import.
To queue additional items with a importer use
queue_for_parsed
. In addition you can try and queue an
additional item with a set of importers using the
queue_and_filter_for_parsed
.
To start the import, use import_async
.
Methods#
- class Importer
- create_for_parsed(parsed: Parsed) list[Importer] #
Create a set of importers which can import this parsed item. The parsed item is represented by the state of the GcrParser at the time of calling this method.
- Parameters:
parsed – a parser with a parsed item to import
- get_interaction() TlsInteraction | None #
Get the interaction used to prompt the user when needed by this importer.
- import_async(cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None #
Import the queued items in the importer. This function returns immediately and completes asynchronously.
- Parameters:
cancellable – a
Cancellable
, orNone
callback – called when the operation completes
user_data – data to be passed to the callback
- import_finish(result: AsyncResult) bool #
Complete an asynchronous operation to import queued items.
- Parameters:
result – an asynchronous result
- queue_and_filter_for_parsed(importers: list[Importer], parsed: Parsed) list[Importer] #
Queues an additional item to be imported in all compattible importers in the set. The parsed item is represented by the state of the
Parser
at the time of calling this method.If the parsed item is incompatible with an importer, then that the item will not be queued on that importer.
- Parameters:
importers – a set of importers
parsed – a parsed item
- queue_for_parsed(parsed: Parsed) bool #
Queues an additional item to be imported. The parsed item is represented by the state of the
Parser
at the time of calling this method.If the parsed item is incompatible with the importer, then this will fail and the item will not be queued.
- Parameters:
parsed – a parsed item to import
- register(importer_type: type, attrs: Attributes) None #
Register an importer to handle parsed items that match the given attributes.
- Parameters:
importer_type – the GType of the importer being registered
attrs – the attributes that this importer is compatible with
- set_interaction(interaction: TlsInteraction) None #
Set the interaction used to prompt the user when needed by this importer.
- Parameters:
interaction – the interaction used by the importer
Properties#
Virtual Methods#
- class Importer
- do_import_async(cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None #
Import the queued items in the importer. This function returns immediately and completes asynchronously.
- Parameters:
cancellable – a
Cancellable
, orNone
callback – called when the operation completes
user_data – data to be passed to the callback
- do_import_finish(result: AsyncResult) bool #
Complete an asynchronous operation to import queued items.
- Parameters:
result – an asynchronous result
- do_queue_for_parsed(parsed: Parsed) bool #
Queues an additional item to be imported. The parsed item is represented by the state of the
Parser
at the time of calling this method.If the parsed item is incompatible with the importer, then this will fail and the item will not be queued.
- Parameters:
parsed – a parsed item to import