## Key Fingerprints

Key Fingerprints — Fingerprints for public and private keys

## Synopsis

    guchar *            gcr_fingerprint_from_attributes     (GckAttributes *attrs,
                                                             GChecksumType checksum_type,
                                                             gsize *n_fingerprint);
    guchar *            gcr_fingerprint_from_certificate_public_key
                                                            (GcrCertificate *certificate,
                                                             GChecksumType checksum_type,
                                                             gsize *n_fingerprint);
    guchar *            gcr_fingerprint_from_subject_public_key_info
                                                            (const guchar *key_info,
                                                             gsize n_key_info,
                                                             GChecksumType checksum_type,
                                                             gsize *n_fingerprint);

## Description

These functions generate key fingerprints for public keys, certificates and key data. The fingerprints are created so that they they will be identical for a key and its corresponding certificate.

Note that in the case of certificates these are not fingerprints of the actual certificate data, but rather of the public key contained in a certificate.

These fingerprints are created using the subjectPublicKeyInfo ASN.1 structure.

## Details

### gcr_fingerprint_from_attributes ()

    guchar *            gcr_fingerprint_from_attributes     (GckAttributes *attrs,
                                                             GChecksumType checksum_type,
                                                             gsize *n_fingerprint);

Create a key fingerprint for a certificate, public key or private key. Note that this is not a fingerprint of certificate data, which you would use `gcr_certificate_get_fingerprint()` for.

`attrs` : | attributes for key or certificate
`checksum_type` : | the type of fingerprint to create
`n_fingerprint` : | the length of fingerprint returned
Returns : | the fingerprint or `NULL` if the input was invalid. [transfer full][allow-none][array length=n_fingerprint]

### gcr_fingerprint_from_certificate_public_key ()

    guchar *            gcr_fingerprint_from_certificate_public_key
                                                            (GcrCertificate *certificate,
                                                             GChecksumType checksum_type,
                                                             gsize *n_fingerprint);

Create a key fingerprint for a certificate's public key. Note that this is not a fingerprint of certificate data, which you would use `gcr_certificate_get_fingerprint()` for.

`certificate` : | the certificate
`checksum_type` : | the type of fingerprint to create
`n_fingerprint` : | the length of fingerprint returned
Returns : | the fingerprint or `NULL` if the input was invalid. [transfer full][allow-none][array length=n_fingerprint]

### gcr_fingerprint_from_subject_public_key_info ()

    guchar *            gcr_fingerprint_from_subject_public_key_info
                                                            (const guchar *key_info,
                                                             gsize n_key_info,
                                                             GChecksumType checksum_type,
                                                             gsize *n_fingerprint);

Create a key fingerprint for a DER encoded subjectPublicKeyInfo.

`key_info` : | DER encoded subjectPublicKeyInfo structure. [array length=n_key_info]
`n_key_info` : | length of DER encoded structure
`checksum_type` : | the type of fingerprint to create
`n_fingerprint` : | the length of fingerprint returned
Returns : | the fingerprint or `NULL` if the input was invalid. [transfer full][allow-none][array length=n_fingerprint]