1d2i_PrivateKey(3) OpenSSL d2i_PrivateKey(3)
2
3
4
6 d2i_Private_key, d2i_AutoPrivateKey, i2d_PrivateKey - decode and encode
7 functions for reading and saving EVP_PKEY structures.
8
10 #include <openssl/evp.h>
11
12 EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
13 long length);
14 EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
15 long length);
16 int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp);
17
19 d2i_PrivateKey() decodes a private key using algorithm type. It
20 attempts to use any key specific format or PKCS#8 unencrypted
21 PrivateKeyInfo format. The type parameter should be a public key
22 algorithm constant such as EVP_PKEY_RSA. An error occurs if the decoded
23 key does not match type.
24
25 d2i_AutoPrivateKey() is similar to d2i_PrivateKey() except it attempts
26 to automatically detect the private key format.
27
28 i2d_PrivateKey() encodes key. It uses a key specific format or, if none
29 is defined for that key type, PKCS#8 unencrypted PrivateKeyInfo format.
30
31 These functions are similar to the d2i_X509() functions, and you should
32 refer to that page for a detailed description (see d2i_X509(3)).
33
35 All these functions use DER format and unencrypted keys. Applications
36 wishing to encrypt or decrypt private keys should use other functions
37 such as d2i_PKC8PrivateKey() instead.
38
39 If the *a is not NULL when calling d2i_PrivateKey() or
40 d2i_AutoPrivateKey() (i.e. an existing structure is being reused) and
41 the key format is PKCS#8 then *a will be freed and replaced on a
42 successful call.
43
45 d2i_PrivateKey() and d2i_AutoPrivateKey() return a valid EVP_KEY
46 structure or NULL if an error occurs. The error code can be obtained by
47 calling ERR_get_error(3).
48
49 i2d_PrivateKey() returns the number of bytes successfully encoded or a
50 negative value if an error occurs. The error code can be obtained by
51 calling ERR_get_error(3).
52
54 crypto(3), d2i_PKCS8PrivateKey(3)
55
56
57
581.0.2o 2020-08-01 d2i_PrivateKey(3)