1EVP_PKEY_CTX_ctrl(3)                OpenSSL               EVP_PKEY_CTX_ctrl(3)
2
3
4

NAME

6       EVP_PKEY_ctrl, EVP_PKEY_ctrl_str - algorithm specific control
7       operations
8

SYNOPSIS

10        #include <openssl/evp.h>
11
12        int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
13                                       int cmd, int p1, void *p2);
14        int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
15                                                       const char *value);
16
17        int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
18
19        #include <openssl/rsa.h>
20
21        int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
22
23        int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int pad);
24        int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int len);
25        int EVP_PKEY_CTX_set_rsa_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int mbits);
26        int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp);
27
28        #include <openssl/dsa.h>
29        int EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx, int nbits);
30
31        #include <openssl/dh.h>
32        int EVP_PKEY_CTX_set_dh_paramgen_prime_len(EVP_PKEY_CTX *ctx, int len);
33        int EVP_PKEY_CTX_set_dh_paramgen_generator(EVP_PKEY_CTX *ctx, int gen);
34
35        #include <openssl/ec.h>
36        int EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid);
37

DESCRIPTION

39       The function EVP_PKEY_CTX_ctrl() sends a control operation to the
40       context ctx. The key type used must match keytype if it is not -1. The
41       parameter optype is a mask indicating which operations the control can
42       be applied to.  The control command is indicated in cmd and any
43       additional arguments in p1 and p2.
44
45       Applications will not normally call EVP_PKEY_CTX_ctrl() directly but
46       will instead call one of the algorithm specific macros below.
47
48       The function EVP_PKEY_ctrl_str() allows an application to send an
49       algorithm specific control operation to a context ctx in string form.
50       This is intended to be used for options specified on the command line
51       or in text files. The commands supported are documented in the openssl
52       utility command line pages for the option -pkeyopt which is supported
53       by the pkeyutl, genpkey and req commands.
54
55       All the remaining "functions" are implemented as macros.
56
57       The EVP_PKEY_CTX_set_signature_md() macro sets the message digest type
58       used in a signature. It can be used with any public key algorithm
59       supporting signature operations.
60
61       The macro EVP_PKEY_CTX_set_rsa_padding() sets the RSA padding mode for
62       ctx.  The pad parameter can take the value RSA_PKCS1_PADDING for PKCS#1
63       padding, RSA_SSLV23_PADDING for SSLv23 padding, RSA_NO_PADDING for no
64       padding, RSA_PKCS1_OAEP_PADDING for OAEP padding (encrypt and decrypt
65       only), RSA_X931_PADDING for X9.31 padding (signature operations only)
66       and RSA_PKCS1_PSS_PADDING (sign and verify only).
67
68       Two RSA padding modes behave differently if
69       EVP_PKEY_CTX_set_signature_md() is used. If this macro is called for
70       PKCS#1 padding the plaintext buffer is an actual digest value and is
71       encapsulated in a DigestInfo structure according to PKCS#1 when signing
72       and this structure is expected (and stripped off) when verifying. If
73       this control is not used with RSA and PKCS#1 padding then the supplied
74       data is used directly and not encapsulated. In the case of X9.31
75       padding for RSA the algorithm identifier byte is added or checked and
76       removed if this control is called. If it is not called then the first
77       byte of the plaintext buffer is expected to be the algorithm identifier
78       byte.
79
80       The EVP_PKEY_CTX_set_rsa_pss_saltlen() macro sets the RSA PSS salt
81       length to len as its name implies it is only supported for PSS padding.
82       Two special values are supported: -1 sets the salt length to the digest
83       length. When signing -2 sets the salt length to the maximum permissible
84       value. When verifying -2 causes the salt length to be automatically
85       determined based on the PSS block structure. If this macro is not
86       called a salt length value of -2 is used by default.
87
88       The EVP_PKEY_CTX_set_rsa_rsa_keygen_bits() macro sets the RSA key
89       length for RSA key genration to bits. If not specified 1024 bits is
90       used.
91
92       The EVP_PKEY_CTX_set_rsa_keygen_pubexp() macro sets the public exponent
93       value for RSA key generation to pubexp currently it should be an odd
94       integer. The pubexp pointer is used internally by this function so it
95       should not be modified or free after the call. If this macro is not
96       called then 65537 is used.
97
98       The macro EVP_PKEY_CTX_set_dsa_paramgen_bits() sets the number of bits
99       used for DSA parameter generation to bits. If not specified 1024 is
100       used.
101
102       The macro EVP_PKEY_CTX_set_dh_paramgen_prime_len() sets the length of
103       the DH prime parameter p for DH parameter generation. If this macro is
104       not called then 1024 is used.
105
106       The EVP_PKEY_CTX_set_dh_paramgen_generator() macro sets DH generator to
107       gen for DH parameter generation. If not specified 2 is used.
108
109       The EVP_PKEY_CTX_set_ec_paramgen_curve_nid() sets the EC curve for EC
110       parameter generation to nid. For EC parameter generation this macro
111       must be called or an error occurs because there is no default curve.
112

RETURN VALUES

114       EVP_PKEY_CTX_ctrl() and its macros return a positive value for success
115       and 0 or a negative value for failure. In particular a return value of
116       -2 indicates the operation is not supported by the public key
117       algorithm.
118

SEE ALSO

120       EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3),
121       EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3),
122       EVP_PKEY_derive(3) EVP_PKEY_keygen(3)
123

HISTORY

125       These functions were first added to OpenSSL 1.0.0.
126
127
128
1291.0.1e                            2013-02-11              EVP_PKEY_CTX_ctrl(3)
Impressum