pem.h 1.9 KB

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