Class

GcrParser

Description [src]

class Gcr.Parser : GObject.Object {
  parent: GObject
}

A parser for parsing various types of files or data.

A GcrParser can parse various certificate and key files such as OpenSSL PEM files, DER encoded certifictes, PKCS#8 keys and so on. Each various format is identified by a value in the GcrDataFormat enumeration.

In order to parse data, a new parser is created with gcr_parser_new() and then the GcrParser::authenticate and GcrParser::parsed signals should be connected to. Data is then fed to the parser via gcr_parser_parse_data() or gcr_parser_parse_stream().

During the GcrParser::parsed signal the attributes that make up the currently parsed item can be retrieved using the gcr_parser_get_parsed_attributes() function.

Ancestors

Constructors

gcr_parser_new

Create a new GcrParser.

Instance methods

gcr_parser_add_password

Add a password to the set of passwords to try when parsing locked or encrypted items. This is usually called from the GcrParser::authenticate signal.

gcr_parser_format_disable

Disable parsing of the given format. Use GCR_FORMAT_ALL to disable all the formats.

gcr_parser_format_enable

Enable parsing of the given format. Use GCR_FORMAT_ALL to enable all the formats.

gcr_parser_format_supported

Check whether the given format is supported by the parser.

gcr_parser_get_filename

Get the filename of the parser item.

gcr_parser_get_parsed

Get the currently parsed item.

gcr_parser_get_parsed_attributes

Get the attributes which make up the currently parsed item. This is generally only valid during the GcrParser::parsed signal.

gcr_parser_get_parsed_block

Get the raw data block that represents this parsed object. This is only valid during the GcrParser::parsed signal.

gcr_parser_get_parsed_bytes

Get the raw data block that represents this parsed object. This is only valid during the GcrParser::parsed signal.

gcr_parser_get_parsed_description

Get a description for the type of the currently parsed item. This is generally only valid during the GcrParser::parsed signal.

gcr_parser_get_parsed_format

Get the format of the raw data block that represents this parsed object. This corresponds with the data returned from gcr_parser_get_parsed_block().

gcr_parser_get_parsed_label

Get the label of the currently parsed item. This is generally only valid during the GcrParser::parsed signal.

gcr_parser_parse_bytes

Parse the data. The GcrParser::parsed and GcrParser::authenticate signals may fire during the parsing.

gcr_parser_parse_data

Parse the data. The GcrParser::parsed and GcrParser::authenticate signals may fire during the parsing.

gcr_parser_parse_stream

Parse items from the data in a GInputStream. This function may block while reading from the input stream. Use gcr_parser_parse_stream_async() for a non-blocking variant.

gcr_parser_parse_stream_async

Parse items from the data in a GInputStream. This function completes asyncronously and doesn’t block.

gcr_parser_parse_stream_finish

Complete an operation to parse a stream.

gcr_parser_set_filename

Sets the filename of the parser item.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Gcr.Parser:parsed-attributes

Get the attributes that make up the currently parsed item. This is generally only valid during a GcrParser::parsed signal.

Gcr.Parser:parsed-description

The description of the type of the currently parsed item. This is generally only valid during a GcrParser::parsed signal.

Gcr.Parser:parsed-label

The label of the currently parsed item. This is generally only valid during a GcrParser::parsed signal.

Signals

Gcr.Parser::authenticate

This signal is emitted when an item needs to be unlocked or decrypted before it can be parsed. The count argument specifies the number of times the signal has been emitted for a given item. This can be used to display a message saying the previous password was incorrect.

Gcr.Parser::parsed

This signal is emitted when an item is sucessfully parsed. To access the information about the item use the gcr_parser_get_parsed_label(), gcr_parser_get_parsed_attributes() and gcr_parser_get_parsed_description() functions.

Signals inherited from GObject (1)
GObject.Object::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GcrParserClass {
  GObjectClass parent_class;
  gboolean (* authenticate) (
    GcrParser* self,
    gint count
  );
  void (* parsed) (
    GcrParser* self
  );
  
}
Class members
parent_class
GObjectClass
 

The parent class.

authenticate
gboolean (* authenticate) (
    GcrParser* self,
    gint count
  )
  No description available.
parsed
void (* parsed) (
    GcrParser* self
  )
  No description available.

Virtual methods

Gcr.ParserClass.authenticate
No description available.
Gcr.ParserClass.parsed
No description available.