1KEYCTL_PKEY_QUERY(3)      Linux Key Management Calls      KEYCTL_PKEY_QUERY(3)
2
3
4

NAME

6       keyctl_pkey_query - Query public key parameters
7

SYNOPSIS

9       #include <keyutils.h>
10
11       long keyctl_pkey_query(key_serial_t key, const char *info,
12                              struct keyctl_pkey_query *result);
13

DESCRIPTION

15       keyctl_pkey_query() queries the public key parameters associated with a
16       kernel key that supports these operations (typically  asymmetric-type).
17       The  caller must have search permission on the target key to be able to
18       query its parameters.
19
20       When invoking the function, key indicates the key to be  queried,  info
21       points  to  a  comma-separated  string  of "key[=value]" parameters and
22       result points to a buffer in which the result will be placed.
23
24       The parameters that can be used in the info parameter string are depen‐
25       dent  on the type of key.  Parameters can specify such things as encod‐
26       ing types (such as "enc=pkcs1"); see asymmetric-key(7) for more  infor‐
27       mation.
28
29       If successful, the result is written into the following struct:
30
31           struct keyctl_pkey_query {
32                   unsigned int    supported_ops;
33                   unsigned int    key_size;
34                   unsigned short  max_data_size;
35                   unsigned short  max_sig_size;
36                   unsigned short  max_enc_size;
37                   unsigned short  max_dec_size;
38           };
39
40       The supported_ops field contains a bitmask of the following constants:
41
42           KEYCTL_SUPPORTS_ENCRYPT
43           KEYCTL_SUPPORTS_DECRYPT
44           KEYCTL_SUPPORTS_SIGN
45           KEYCTL_SUPPORTS_VERIFY
46
47       indicating  what  operations  are supported and thus which of the other
48       keyctl_pkey_*() operations can be used with this key.
49
50       The key_size field indicates the number of bits in the key size and the
51       max_data_size, max_sig_size, max_enc_size and max_dec_size fields indi‐
52       cate the maximum sizes in bytes of a blob of data to be signed, a  sig‐
53       nature  blob, a blob to be encrypted and a blob to be decrypted respec‐
54       tively.
55

RETURN VALUE

57       On success keyctl_pkey_query() returns 0.  On error, the value -1  will
58       be returned and errno will have been set to an appropriate error.
59

ERRORS

61       ENOKEY The key specified is invalid.
62
63       EKEYEXPIRED
64              The key specified has expired.
65
66       EKEYREVOKED
67              The key specified has been revoked.
68
69       EACCES The key exists, but is not searchable by the calling process.
70
71       ENOPKG Some  facility needed to complete the requested operation is not
72              available.  This is most probably a requested or required digest
73              or encryption algorithm.
74
75       EFAULT Bad address.
76

LINKING

78       This  is  a  library  function  that can be found in libkeyutils.  When
79       linking, -lkeyutils should be specified to the linker.
80

SEE ALSO

82       keyctl(1), add_key(2), keyctl(2), keyctl(3), keyctl_pkey_encrypt(3),
83       keyctl_pkey_sign(3), asymmetric-key(7), keyrings(7), keyutils(7)
84
85
86
87Linux                             8 Nov 2018              KEYCTL_PKEY_QUERY(3)
Impressum