Gcr.Certificate¶
- Implementations:
Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
Description of object being rendered |
||
r |
Certificate expiry date |
||
r |
Common name of issuer |
||
r |
Certificate label |
||
r |
Common name of subject |
Signals¶
None
Fields¶
None
Class Details¶
- class Gcr.Certificate¶
- Bases:
- Structure:
An interface that represents an X.509 certificate.
Objects can implement this interface to make a certificate usable with the GCR library.
Various methods are available to parse out relevant bits of the certificate. However no verification of the validity of a certificate is done here. Use your favorite crypto library to do this.
You can use [class`SimpleCertificate`] to simply load a certificate for which you already have the raw certificate data.
The
Gcr.Certificate
interface has several properties that must be implemented. You can use a mixin to implement these properties if desired. See the gcr_certificate_mixin_class_init() and gcr_certificate_mixin_get_property() functions.- get_basic_constraints()[source]¶
- Returns:
whether basic constraints are present or not
- is_ca:
location to place a
True
if is an authority- path_len:
location to place the max path length
- Return type:
Get the basic constraints for the certificate if present. If
False
is returned then no basic constraints are present and the is_ca and path_len arguments are not changed.
- get_der_data()[source]¶
- Returns:
raw DER data of the X.509 certificate
- Return type:
Gets the raw DER data for an X.509 certificate.
- get_expiry_date()[source]¶
- Returns:
An expiry date of this certificate.
- Return type:
Get the expiry date of this certificate.
- get_fingerprint(type)[source]¶
- Parameters:
type (
GLib.ChecksumType
) – the type of algorithm for the fingerprint.- Returns:
the raw binary fingerprint
- Return type:
Calculate the fingerprint for this certificate.
The caller should free the returned data using
GLib.free
() when it is no longer required.
- get_fingerprint_hex(type)[source]¶
- Parameters:
type (
GLib.ChecksumType
) – the type of algorithm for the fingerprint.- Returns:
an allocated hex string which contains the fingerprint.
- Return type:
Calculate the fingerprint for this certificate, and return it as a hex string.
The caller should free the returned data using
GLib.free
() when it is no longer required.
- get_interface_elements()[source]¶
- Returns:
- Return type:
Get the list of sections from the certificate that can be shown to the user interface.
- get_issued_date()[source]¶
- Returns:
A issued date of this certificate.
- Return type:
Get the issued date of this certificate.
- get_issuer_cn()[source]¶
-
Get the common name of the issuer of this certificate.
The string returned should be freed by the caller when no longer required.
- get_issuer_dn()[source]¶
-
Get the full issuer DN of the certificate as a (mostly) readable string.
The string returned should be freed by the caller when no longer required.
- get_issuer_name()[source]¶
-
Get a name to represent the issuer of this certificate.
This will try to lookup the common name, orianizational unit, organization in that order.
- get_issuer_part(part)[source]¶
- Parameters:
part (
str
) – a DN type string or OID.- Returns:
the allocated part of the issuer DN, or
None
if no such part is present- Return type:
Get a part of the DN of the issuer of this certificate.
Examples of a part might be the ‘OU’ (organizational unit) or the ‘CN’ (common name). Only the value of that part of the DN is returned.
The string returned should be freed by the caller when no longer required.
- get_issuer_raw()[source]¶
-
Get the raw DER data for the issuer DN of the certificate.
The data should be freed by using
GLib.free
() when no longer required.
- get_key_size()[source]¶
- Returns:
The key size of the certificate.
- Return type:
Get the key size in bits of the public key represented by this certificate.
- get_serial_number()[source]¶
-
Get the raw binary serial number of the certificate.
The caller should free the returned data using
GLib.free
() when it is no longer required.
- get_serial_number_hex()[source]¶
-
Get the serial number of the certificate as a hex string.
The caller should free the returned data using
GLib.free
() when it is no longer required.
- get_subject_cn()[source]¶
-
Get the common name of the subject of this certificate.
The string returned should be freed by the caller when no longer required.
- get_subject_dn()[source]¶
-
Get the full subject DN of the certificate as a (mostly) readable string.
The string returned should be freed by the caller when no longer required.
- get_subject_name()[source]¶
-
Get a name to represent the subject of this certificate.
This will try to lookup the common name, orianizational unit, organization in that order.
- get_subject_part(part)[source]¶
- Parameters:
part (
str
) – a DN type string or OID.- Returns:
the allocated part of the subject DN, or
None
if no such part is present.- Return type:
Get a part of the DN of the subject of this certificate.
Examples of a part might be the ‘OU’ (organizational unit) or the ‘CN’ (common name). Only the value of that part of the DN is returned.
The string returned should be freed by the caller when no longer required.
- get_subject_raw()[source]¶
-
Get the raw DER data for the subject DN of the certificate.
The data should be freed by using
GLib.free
() when no longer required.
- is_issuer(issuer)[source]¶
- Parameters:
issuer (
Gcr.Certificate
) – a possible issuerGcr.Certificate
- Returns:
whether issuer could be the issuer of the certificate.
- Return type:
Check if issuer could be the issuer of this certificate. This is done by comparing the relevant subject and issuer fields. No signature check is done. Proper verification of certificates must be done via a crypto library.
- mixin_emit_notify()[source]¶
Implementers of the
Gcr.Certificate
mixin should call this function to notify when the certificate has changed to emit notifications on the various properties.
Property Details¶
- Gcr.Certificate.props.description¶
-
A readable description for this certificate
- Gcr.Certificate.props.expiry_date¶
- Name:
expiry-date
- Type:
- Default Value:
- Flags:
The expiry date of the certificate
- Gcr.Certificate.props.issuer_name¶
-
Common name part of the certificate issuer
- Gcr.Certificate.props.label¶
-
A readable label for this certificate.