2 * Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (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 #ifndef OSSL_INTERNAL_PEM_H
11 # define OSSL_INTERNAL_PEM_H
14 # include <openssl/pem.h>
15 # include "crypto/types.h"
17 /* Found in crypto/pem/pvkfmt.c */
19 /* Maximum length of a blob after header */
20 # define BLOB_MAX_LENGTH 102400
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,
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,
34 RSA *ossl_b2i_RSA_after_header(const unsigned char **in, unsigned int bitlen,
37 EVP_PKEY *ossl_b2i(const unsigned char **in, unsigned int length, int *ispub);
38 EVP_PKEY *ossl_b2i_bio(BIO *in, int *ispub);
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);
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);