ssl_pkey.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef _SSL_PKEY_H_
  14. #define _SSL_PKEY_H_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include "ssl_types.h"
  19. /**
  20. * @brief create a private key object according to input private key
  21. *
  22. * @param ipk - input private key point
  23. *
  24. * @return new private key object point
  25. */
  26. EVP_PKEY* __EVP_PKEY_new(EVP_PKEY *ipk);
  27. /**
  28. * @brief create a private key object
  29. *
  30. * @param none
  31. *
  32. * @return private key object point
  33. */
  34. EVP_PKEY* EVP_PKEY_new(void);
  35. /**
  36. * @brief load a character key context into system context. If '*a' is pointed to the
  37. * private key, then load key into it. Or create a new private key object
  38. *
  39. * @param type - private key type
  40. * @param a - a point pointed to a private key point
  41. * @param pp - a point pointed to the key context memory point
  42. * @param length - key bytes
  43. *
  44. * @return private key object point
  45. */
  46. EVP_PKEY* d2i_PrivateKey(int type,
  47. EVP_PKEY **a,
  48. const unsigned char **pp,
  49. long length);
  50. /**
  51. * @brief free a private key object
  52. *
  53. * @param pkey - private key object point
  54. *
  55. * @return none
  56. */
  57. void EVP_PKEY_free(EVP_PKEY *x);
  58. /**
  59. * @brief load private key into the SSL
  60. *
  61. * @param type - private key type
  62. * @param ssl - SSL point
  63. * @param len - data bytes
  64. * @param d - data point
  65. *
  66. * @return result
  67. * 0 : failed
  68. * 1 : OK
  69. */
  70. int SSL_use_PrivateKey_ASN1(int type, SSL *ssl, const unsigned char *d, long len);
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74. #endif