1gnutls_privkey_import_ext4(3) gnutls gnutls_privkey_import_ext4(3)
2
3
4
6 gnutls_privkey_import_ext4 - API function
7
9 #include <gnutls/abstract.h>
10
11 int gnutls_privkey_import_ext4(gnutls_privkey_t pkey, void * userdata,
12 gnutls_privkey_sign_data_func sign_data_fn,
13 gnutls_privkey_sign_hash_func sign_hash_fn, gnutls_privkey_decrypt_func
14 decrypt_fn, gnutls_privkey_deinit_func deinit_fn,
15 gnutls_privkey_info_func info_fn, unsigned int flags);
16
18 gnutls_privkey_t pkey
19 The private key
20
21 void * userdata
22 private data to be provided to the callbacks
23
24 gnutls_privkey_sign_data_func sign_data_fn
25 callback for signature operations (may be NULL)
26
27 gnutls_privkey_sign_hash_func sign_hash_fn
28 callback for signature operations (may be NULL)
29
30 gnutls_privkey_decrypt_func decrypt_fn
31 callback for decryption operations (may be NULL)
32
33 gnutls_privkey_deinit_func deinit_fn
34 a deinitialization function
35
36 gnutls_privkey_info_func info_fn
37 returns info about the public key algorithm (should not be
38 NULL)
39
40 unsigned int flags
41 Flags for the import
42
44 This function will associate the given callbacks with the
45 gnutls_privkey_t type. At least one of the callbacks must be non-null.
46 If a deinitialization function is provided then flags is assumed to
47 contain GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE.
48
49 Note that in contrast with the signing function of gnutls_privkey_im‐
50 port_ext3(), the signing functions provided to this function take ex‐
51 plicitly the signature algorithm as parameter and different functions
52 are provided to sign the data and hashes.
53
54 The sign_hash_fn is to be called to sign pre-hashed data. The input to
55 the callback is the output of the hash (such as SHA256) corresponding
56 to the signature algorithm. For RSA PKCS1 signatures, the signature al‐
57 gorithm can be set to GNUTLS_SIGN_RSA_RAW, and in that case the data
58 should be handled as if they were an RSA PKCS1 DigestInfo structure.
59
60 The sign_data_fn is to be called to sign data. The input data will be
61 he data to be signed (and hashed), with the provided signature algo‐
62 rithm. This function is to be used for signature algorithms like
63 Ed25519 which cannot take pre-hashed data as input.
64
65 When both sign_data_fn and sign_hash_fn functions are provided they
66 must be able to operate on all the supported signature algorithms, un‐
67 less prohibited by the type of the algorithm (e.g., as with Ed25519).
68
69 The info_fn must provide information on the signature algorithms sup‐
70 ported by this private key, and should support the flags
71 GNUTLS_PRIVKEY_INFO_PK_ALGO, GNUTLS_PRIVKEY_INFO_HAVE_SIGN_ALGO and
72 GNUTLS_PRIVKEY_INFO_PK_ALGO_BITS. It must return -1 on unknown flags.
73
75 On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative er‐
76 ror value.
77
79 3.6.0
80
82 Report bugs to <bugs@gnutls.org>.
83 Home page: https://www.gnutls.org
84
85
87 Copyright © 2001- Free Software Foundation, Inc., and others.
88 Copying and distribution of this file, with or without modification,
89 are permitted in any medium without royalty provided the copyright no‐
90 tice and this notice are preserved.
91
93 The full documentation for gnutls is maintained as a Texinfo manual.
94 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
95 visit
96
97 https://www.gnutls.org/manual/
98
99gnutls 3.7.2 gnutls_privkey_import_ext4(3)