2 * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include <openssl/core.h>
11 #include <openssl/core_numbers.h>
12 #include <openssl/bn.h>
13 #include <openssl/asn1.h> /* i2d_of_void */
14 #include <openssl/x509.h> /* X509_SIG */
15 #include <openssl/types.h>
17 struct pkcs8_encrypt_ctx_st
{
18 /* Set to 1 if intending to encrypt/decrypt, otherwise 0 */
22 int pbe_nid
; /* For future variation */
24 /* Passphrase that was passed by the caller */
26 size_t cipher_pass_length
;
28 /* This callback is only used of |cipher_pass| is NULL */
29 OSSL_PASSPHRASE_CALLBACK
*cb
;
33 OSSL_OP_keymgmt_importkey_fn
*ossl_prov_get_importkey(const OSSL_DISPATCH
*fns
);
35 OSSL_OP_keymgmt_importkey_fn
*ossl_prov_get_rsa_importkey(void);
37 int ossl_prov_print_labeled_bignum(BIO
*out
, const char *label
,
39 int ossl_prov_print_rsa(BIO
*out
, RSA
*rsa
, int priv
);
41 int ossl_prov_write_priv_der_from_obj(BIO
*out
, const void *obj
, int obj_nid
,
42 int (*p2s
)(const void *obj
, int nid
,
45 int (*k2d
)(const void *obj
,
46 unsigned char **pder
),
47 struct pkcs8_encrypt_ctx_st
*ctx
);
48 int ossl_prov_write_priv_pem_from_obj(BIO
*out
, const void *obj
, int obj_nid
,
49 int (*p2s
)(const void *obj
, int nid
,
52 int (*k2d
)(const void *obj
,
53 unsigned char **pder
),
54 struct pkcs8_encrypt_ctx_st
*ctx
);
55 int ossl_prov_write_pub_der_from_obj(BIO
*out
, const void *obj
, int obj_nid
,
56 int (*p2s
)(const void *obj
, int nid
,
59 int (*k2d
)(const void *obj
,
60 unsigned char **pder
));
61 int ossl_prov_write_pub_pem_from_obj(BIO
*out
, const void *obj
, int obj_nid
,
62 int (*p2s
)(const void *obj
, int nid
,
65 int (*k2d
)(const void *obj
,
66 unsigned char **pder
));