1gnutls_store_pubkey(3) gnutls gnutls_store_pubkey(3)
2
3
4
6 gnutls_store_pubkey - API function
7
9 #include <gnutls/gnutls.h>
10
11 int gnutls_store_pubkey(const char * db_name, gnutls_tdb_t tdb, const
12 char * host, const char * service, gnutls_certificate_type_t cert_type,
13 const gnutls_datum_t * cert, time_t expiration, unsigned int flags);
14
16 const char * db_name
17 A file specifying the stored keys (use NULL for the de‐
18 fault)
19
20 gnutls_tdb_t tdb
21 A storage structure or NULL to use the default
22
23 const char * host
24 The peer's name
25
26 const char * service
27 non-NULL if this key is specific to a service (e.g. http)
28
29 gnutls_certificate_type_t cert_type
30 The type of the certificate
31
32 const gnutls_datum_t * cert
33 The data of the certificate
34
35 time_t expiration
36 The expiration time (use 0 to disable expiration)
37
38 unsigned int flags
39 should be 0.
40
42 This function will store a raw public-key or a public-key provided via
43 a raw (DER-encoded) certificate to the list of stored public keys. The
44 key will be considered valid until the provided expiration time.
45
46 The tdb variable if non-null specifies a custom backend for the stor‐
47 age of entries. If it is NULL then the default file backend will be
48 used.
49
50 Unless an alternative tdb is provided, the storage format is a textual
51 format consisting of a line for each host with fields separated by '|'.
52 The contents of the fields are a format-identifier which is set to
53 'g0', the hostname that the rest of the data applies to, the numeric
54 port or host name, the expiration time in seconds since the epoch (0
55 for no expiration), and a base64 encoding of the raw (DER) public key
56 information (SPKI) of the peer.
57
58 As of GnuTLS 3.6.6 this function also accepts raw public keys.
59
61 On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative er‐
62 ror value.
63
65 3.0.13
66
68 Report bugs to <bugs@gnutls.org>.
69 Home page: https://www.gnutls.org
70
71
73 Copyright © 2001- Free Software Foundation, Inc., and others.
74 Copying and distribution of this file, with or without modification,
75 are permitted in any medium without royalty provided the copyright no‐
76 tice and this notice are preserved.
77
79 The full documentation for gnutls is maintained as a Texinfo manual.
80 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
81 visit
82
83 https://www.gnutls.org/manual/
84
85gnutls 3.7.2 gnutls_store_pubkey(3)