xref: /openssl/include/crypto/pem.h (revision 9d987de3)
1 /*
2  * Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.
3  *
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
8  */
9 
10 #ifndef OSSL_INTERNAL_PEM_H
11 # define OSSL_INTERNAL_PEM_H
12 # pragma once
13 
14 # include <openssl/pem.h>
15 # include "crypto/types.h"
16 
17 /* Found in crypto/pem/pvkfmt.c */
18 
19 /* Maximum length of a blob after header */
20 # define BLOB_MAX_LENGTH          102400
21 
22 int ossl_do_blob_header(const unsigned char **in, unsigned int length,
23                         unsigned int *pmagic, unsigned int *pbitlen,
24                         int *pisdss, int *pispub);
25 unsigned int ossl_blob_length(unsigned bitlen, int isdss, int ispub);
26 int ossl_do_PVK_header(const unsigned char **in, unsigned int length,
27                        int skip_magic,
28                        unsigned int *psaltlen, unsigned int *pkeylen);
29 # ifndef OPENSSL_NO_DEPRECATED_3_0
30 #  ifndef OPENSSL_NO_DSA
31 DSA *ossl_b2i_DSA_after_header(const unsigned char **in, unsigned int bitlen,
32                                int ispub);
33 #  endif
34 RSA *ossl_b2i_RSA_after_header(const unsigned char **in, unsigned int bitlen,
35                                int ispub);
36 # endif
37 EVP_PKEY *ossl_b2i(const unsigned char **in, unsigned int length, int *ispub);
38 EVP_PKEY *ossl_b2i_bio(BIO *in, int *ispub);
39 
40 # ifndef OPENSSL_NO_DEPRECATED_3_0
41 #  ifndef OPENSSL_NO_DSA
42 DSA *b2i_DSA_PVK_bio(BIO *in, pem_password_cb *cb, void *u);
43 DSA *b2i_DSA_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u,
44                         OSSL_LIB_CTX *libctx, const char *propq);
45 #  endif
46 RSA *b2i_RSA_PVK_bio(BIO *in, pem_password_cb *cb, void *u);
47 RSA *b2i_RSA_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u,
48                         OSSL_LIB_CTX *libctx, const char *propq);
49 # endif
50 
51 #endif
52