Key Fingerprints: Gcr Library Reference Manual

## Key Fingerprints Key Fingerprints — Fingerprints for public and private keys |

## Functions

guchar * | gcr_fingerprint_from_attributes ()
guchar * | gcr_fingerprint_from_subject_public_key_info ()

## 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.

## Functions

### 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.

#### Parameters

attrs | attributes for key or certificate |
checksum_type | the type of fingerprint to create |
n_fingerprint | the length of fingerprint returned. | [out]

#### Returns

the fingerprint or `NULL` if the input was invalid.

[transfer full][nullable][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.

#### Parameters

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. | [out]

#### Returns

the fingerprint or `NULL` if the input was invalid.

[transfer full][nullable][array length=n_fingerprint]