x509.h 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276
  1. /*
  2. * WARNING: do not edit!
  3. * Generated by Makefile from include/openssl/x509.h.in
  4. *
  5. * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  6. * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
  7. *
  8. * Licensed under the Apache License 2.0 (the "License"). You may not use
  9. * this file except in compliance with the License. You can obtain a copy
  10. * in the file LICENSE in the source distribution or at
  11. * https://www.openssl.org/source/license.html
  12. */
  13. #ifndef OPENSSL_X509_H
  14. # define OPENSSL_X509_H
  15. # pragma once
  16. # include <openssl/macros.h>
  17. # ifndef OPENSSL_NO_DEPRECATED_3_0
  18. # define HEADER_X509_H
  19. # endif
  20. # include <openssl/e_os2.h>
  21. # include <openssl/types.h>
  22. # include <openssl/symhacks.h>
  23. # include <openssl/buffer.h>
  24. # include <openssl/evp.h>
  25. # include <openssl/bio.h>
  26. # include <openssl/asn1.h>
  27. # include <openssl/safestack.h>
  28. # include <openssl/ec.h>
  29. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  30. # include <openssl/rsa.h>
  31. # include <openssl/dsa.h>
  32. # include <openssl/dh.h>
  33. # endif
  34. # include <openssl/sha.h>
  35. # include <openssl/x509err.h>
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. /* Needed stacks for types defined in other headers */
  40. SKM_DEFINE_STACK_OF_INTERNAL(X509_NAME, X509_NAME, X509_NAME)
  41. #define sk_X509_NAME_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_sk_type(sk))
  42. #define sk_X509_NAME_value(sk, idx) ((X509_NAME *)OPENSSL_sk_value(ossl_check_const_X509_NAME_sk_type(sk), (idx)))
  43. #define sk_X509_NAME_new(cmp) ((STACK_OF(X509_NAME) *)OPENSSL_sk_new(ossl_check_X509_NAME_compfunc_type(cmp)))
  44. #define sk_X509_NAME_new_null() ((STACK_OF(X509_NAME) *)OPENSSL_sk_new_null())
  45. #define sk_X509_NAME_new_reserve(cmp, n) ((STACK_OF(X509_NAME) *)OPENSSL_sk_new_reserve(ossl_check_X509_NAME_compfunc_type(cmp), (n)))
  46. #define sk_X509_NAME_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_NAME_sk_type(sk), (n))
  47. #define sk_X509_NAME_free(sk) OPENSSL_sk_free(ossl_check_X509_NAME_sk_type(sk))
  48. #define sk_X509_NAME_zero(sk) OPENSSL_sk_zero(ossl_check_X509_NAME_sk_type(sk))
  49. #define sk_X509_NAME_delete(sk, i) ((X509_NAME *)OPENSSL_sk_delete(ossl_check_X509_NAME_sk_type(sk), (i)))
  50. #define sk_X509_NAME_delete_ptr(sk, ptr) ((X509_NAME *)OPENSSL_sk_delete_ptr(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr)))
  51. #define sk_X509_NAME_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr))
  52. #define sk_X509_NAME_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr))
  53. #define sk_X509_NAME_pop(sk) ((X509_NAME *)OPENSSL_sk_pop(ossl_check_X509_NAME_sk_type(sk)))
  54. #define sk_X509_NAME_shift(sk) ((X509_NAME *)OPENSSL_sk_shift(ossl_check_X509_NAME_sk_type(sk)))
  55. #define sk_X509_NAME_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_NAME_sk_type(sk),ossl_check_X509_NAME_freefunc_type(freefunc))
  56. #define sk_X509_NAME_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr), (idx))
  57. #define sk_X509_NAME_set(sk, idx, ptr) ((X509_NAME *)OPENSSL_sk_set(ossl_check_X509_NAME_sk_type(sk), (idx), ossl_check_X509_NAME_type(ptr)))
  58. #define sk_X509_NAME_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr))
  59. #define sk_X509_NAME_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr))
  60. #define sk_X509_NAME_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr), pnum)
  61. #define sk_X509_NAME_sort(sk) OPENSSL_sk_sort(ossl_check_X509_NAME_sk_type(sk))
  62. #define sk_X509_NAME_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_NAME_sk_type(sk))
  63. #define sk_X509_NAME_dup(sk) ((STACK_OF(X509_NAME) *)OPENSSL_sk_dup(ossl_check_const_X509_NAME_sk_type(sk)))
  64. #define sk_X509_NAME_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_NAME) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_NAME_sk_type(sk), ossl_check_X509_NAME_copyfunc_type(copyfunc), ossl_check_X509_NAME_freefunc_type(freefunc)))
  65. #define sk_X509_NAME_set_cmp_func(sk, cmp) ((sk_X509_NAME_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_compfunc_type(cmp)))
  66. SKM_DEFINE_STACK_OF_INTERNAL(X509, X509, X509)
  67. #define sk_X509_num(sk) OPENSSL_sk_num(ossl_check_const_X509_sk_type(sk))
  68. #define sk_X509_value(sk, idx) ((X509 *)OPENSSL_sk_value(ossl_check_const_X509_sk_type(sk), (idx)))
  69. #define sk_X509_new(cmp) ((STACK_OF(X509) *)OPENSSL_sk_new(ossl_check_X509_compfunc_type(cmp)))
  70. #define sk_X509_new_null() ((STACK_OF(X509) *)OPENSSL_sk_new_null())
  71. #define sk_X509_new_reserve(cmp, n) ((STACK_OF(X509) *)OPENSSL_sk_new_reserve(ossl_check_X509_compfunc_type(cmp), (n)))
  72. #define sk_X509_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_sk_type(sk), (n))
  73. #define sk_X509_free(sk) OPENSSL_sk_free(ossl_check_X509_sk_type(sk))
  74. #define sk_X509_zero(sk) OPENSSL_sk_zero(ossl_check_X509_sk_type(sk))
  75. #define sk_X509_delete(sk, i) ((X509 *)OPENSSL_sk_delete(ossl_check_X509_sk_type(sk), (i)))
  76. #define sk_X509_delete_ptr(sk, ptr) ((X509 *)OPENSSL_sk_delete_ptr(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr)))
  77. #define sk_X509_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr))
  78. #define sk_X509_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr))
  79. #define sk_X509_pop(sk) ((X509 *)OPENSSL_sk_pop(ossl_check_X509_sk_type(sk)))
  80. #define sk_X509_shift(sk) ((X509 *)OPENSSL_sk_shift(ossl_check_X509_sk_type(sk)))
  81. #define sk_X509_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_sk_type(sk),ossl_check_X509_freefunc_type(freefunc))
  82. #define sk_X509_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr), (idx))
  83. #define sk_X509_set(sk, idx, ptr) ((X509 *)OPENSSL_sk_set(ossl_check_X509_sk_type(sk), (idx), ossl_check_X509_type(ptr)))
  84. #define sk_X509_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr))
  85. #define sk_X509_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr))
  86. #define sk_X509_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr), pnum)
  87. #define sk_X509_sort(sk) OPENSSL_sk_sort(ossl_check_X509_sk_type(sk))
  88. #define sk_X509_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_sk_type(sk))
  89. #define sk_X509_dup(sk) ((STACK_OF(X509) *)OPENSSL_sk_dup(ossl_check_const_X509_sk_type(sk)))
  90. #define sk_X509_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_sk_type(sk), ossl_check_X509_copyfunc_type(copyfunc), ossl_check_X509_freefunc_type(freefunc)))
  91. #define sk_X509_set_cmp_func(sk, cmp) ((sk_X509_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_sk_type(sk), ossl_check_X509_compfunc_type(cmp)))
  92. SKM_DEFINE_STACK_OF_INTERNAL(X509_REVOKED, X509_REVOKED, X509_REVOKED)
  93. #define sk_X509_REVOKED_num(sk) OPENSSL_sk_num(ossl_check_const_X509_REVOKED_sk_type(sk))
  94. #define sk_X509_REVOKED_value(sk, idx) ((X509_REVOKED *)OPENSSL_sk_value(ossl_check_const_X509_REVOKED_sk_type(sk), (idx)))
  95. #define sk_X509_REVOKED_new(cmp) ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_new(ossl_check_X509_REVOKED_compfunc_type(cmp)))
  96. #define sk_X509_REVOKED_new_null() ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_new_null())
  97. #define sk_X509_REVOKED_new_reserve(cmp, n) ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_new_reserve(ossl_check_X509_REVOKED_compfunc_type(cmp), (n)))
  98. #define sk_X509_REVOKED_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_REVOKED_sk_type(sk), (n))
  99. #define sk_X509_REVOKED_free(sk) OPENSSL_sk_free(ossl_check_X509_REVOKED_sk_type(sk))
  100. #define sk_X509_REVOKED_zero(sk) OPENSSL_sk_zero(ossl_check_X509_REVOKED_sk_type(sk))
  101. #define sk_X509_REVOKED_delete(sk, i) ((X509_REVOKED *)OPENSSL_sk_delete(ossl_check_X509_REVOKED_sk_type(sk), (i)))
  102. #define sk_X509_REVOKED_delete_ptr(sk, ptr) ((X509_REVOKED *)OPENSSL_sk_delete_ptr(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr)))
  103. #define sk_X509_REVOKED_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr))
  104. #define sk_X509_REVOKED_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr))
  105. #define sk_X509_REVOKED_pop(sk) ((X509_REVOKED *)OPENSSL_sk_pop(ossl_check_X509_REVOKED_sk_type(sk)))
  106. #define sk_X509_REVOKED_shift(sk) ((X509_REVOKED *)OPENSSL_sk_shift(ossl_check_X509_REVOKED_sk_type(sk)))
  107. #define sk_X509_REVOKED_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_REVOKED_sk_type(sk),ossl_check_X509_REVOKED_freefunc_type(freefunc))
  108. #define sk_X509_REVOKED_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr), (idx))
  109. #define sk_X509_REVOKED_set(sk, idx, ptr) ((X509_REVOKED *)OPENSSL_sk_set(ossl_check_X509_REVOKED_sk_type(sk), (idx), ossl_check_X509_REVOKED_type(ptr)))
  110. #define sk_X509_REVOKED_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr))
  111. #define sk_X509_REVOKED_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr))
  112. #define sk_X509_REVOKED_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr), pnum)
  113. #define sk_X509_REVOKED_sort(sk) OPENSSL_sk_sort(ossl_check_X509_REVOKED_sk_type(sk))
  114. #define sk_X509_REVOKED_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_REVOKED_sk_type(sk))
  115. #define sk_X509_REVOKED_dup(sk) ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_dup(ossl_check_const_X509_REVOKED_sk_type(sk)))
  116. #define sk_X509_REVOKED_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_copyfunc_type(copyfunc), ossl_check_X509_REVOKED_freefunc_type(freefunc)))
  117. #define sk_X509_REVOKED_set_cmp_func(sk, cmp) ((sk_X509_REVOKED_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_compfunc_type(cmp)))
  118. SKM_DEFINE_STACK_OF_INTERNAL(X509_CRL, X509_CRL, X509_CRL)
  119. #define sk_X509_CRL_num(sk) OPENSSL_sk_num(ossl_check_const_X509_CRL_sk_type(sk))
  120. #define sk_X509_CRL_value(sk, idx) ((X509_CRL *)OPENSSL_sk_value(ossl_check_const_X509_CRL_sk_type(sk), (idx)))
  121. #define sk_X509_CRL_new(cmp) ((STACK_OF(X509_CRL) *)OPENSSL_sk_new(ossl_check_X509_CRL_compfunc_type(cmp)))
  122. #define sk_X509_CRL_new_null() ((STACK_OF(X509_CRL) *)OPENSSL_sk_new_null())
  123. #define sk_X509_CRL_new_reserve(cmp, n) ((STACK_OF(X509_CRL) *)OPENSSL_sk_new_reserve(ossl_check_X509_CRL_compfunc_type(cmp), (n)))
  124. #define sk_X509_CRL_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_CRL_sk_type(sk), (n))
  125. #define sk_X509_CRL_free(sk) OPENSSL_sk_free(ossl_check_X509_CRL_sk_type(sk))
  126. #define sk_X509_CRL_zero(sk) OPENSSL_sk_zero(ossl_check_X509_CRL_sk_type(sk))
  127. #define sk_X509_CRL_delete(sk, i) ((X509_CRL *)OPENSSL_sk_delete(ossl_check_X509_CRL_sk_type(sk), (i)))
  128. #define sk_X509_CRL_delete_ptr(sk, ptr) ((X509_CRL *)OPENSSL_sk_delete_ptr(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr)))
  129. #define sk_X509_CRL_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr))
  130. #define sk_X509_CRL_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr))
  131. #define sk_X509_CRL_pop(sk) ((X509_CRL *)OPENSSL_sk_pop(ossl_check_X509_CRL_sk_type(sk)))
  132. #define sk_X509_CRL_shift(sk) ((X509_CRL *)OPENSSL_sk_shift(ossl_check_X509_CRL_sk_type(sk)))
  133. #define sk_X509_CRL_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_CRL_sk_type(sk),ossl_check_X509_CRL_freefunc_type(freefunc))
  134. #define sk_X509_CRL_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr), (idx))
  135. #define sk_X509_CRL_set(sk, idx, ptr) ((X509_CRL *)OPENSSL_sk_set(ossl_check_X509_CRL_sk_type(sk), (idx), ossl_check_X509_CRL_type(ptr)))
  136. #define sk_X509_CRL_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr))
  137. #define sk_X509_CRL_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr))
  138. #define sk_X509_CRL_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr), pnum)
  139. #define sk_X509_CRL_sort(sk) OPENSSL_sk_sort(ossl_check_X509_CRL_sk_type(sk))
  140. #define sk_X509_CRL_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_CRL_sk_type(sk))
  141. #define sk_X509_CRL_dup(sk) ((STACK_OF(X509_CRL) *)OPENSSL_sk_dup(ossl_check_const_X509_CRL_sk_type(sk)))
  142. #define sk_X509_CRL_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_CRL) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_CRL_sk_type(sk), ossl_check_X509_CRL_copyfunc_type(copyfunc), ossl_check_X509_CRL_freefunc_type(freefunc)))
  143. #define sk_X509_CRL_set_cmp_func(sk, cmp) ((sk_X509_CRL_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_compfunc_type(cmp)))
  144. /* Flags for X509_get_signature_info() */
  145. /* Signature info is valid */
  146. # define X509_SIG_INFO_VALID 0x1
  147. /* Signature is suitable for TLS use */
  148. # define X509_SIG_INFO_TLS 0x2
  149. # define X509_FILETYPE_PEM 1
  150. # define X509_FILETYPE_ASN1 2
  151. # define X509_FILETYPE_DEFAULT 3
  152. # define X509v3_KU_DIGITAL_SIGNATURE 0x0080
  153. # define X509v3_KU_NON_REPUDIATION 0x0040
  154. # define X509v3_KU_KEY_ENCIPHERMENT 0x0020
  155. # define X509v3_KU_DATA_ENCIPHERMENT 0x0010
  156. # define X509v3_KU_KEY_AGREEMENT 0x0008
  157. # define X509v3_KU_KEY_CERT_SIGN 0x0004
  158. # define X509v3_KU_CRL_SIGN 0x0002
  159. # define X509v3_KU_ENCIPHER_ONLY 0x0001
  160. # define X509v3_KU_DECIPHER_ONLY 0x8000
  161. # define X509v3_KU_UNDEF 0xffff
  162. struct X509_algor_st {
  163. ASN1_OBJECT *algorithm;
  164. ASN1_TYPE *parameter;
  165. } /* X509_ALGOR */ ;
  166. typedef STACK_OF(X509_ALGOR) X509_ALGORS;
  167. typedef struct X509_val_st {
  168. ASN1_TIME *notBefore;
  169. ASN1_TIME *notAfter;
  170. } X509_VAL;
  171. typedef struct X509_sig_st X509_SIG;
  172. typedef struct X509_name_entry_st X509_NAME_ENTRY;
  173. SKM_DEFINE_STACK_OF_INTERNAL(X509_NAME_ENTRY, X509_NAME_ENTRY, X509_NAME_ENTRY)
  174. #define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
  175. #define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx)))
  176. #define sk_X509_NAME_ENTRY_new(cmp) ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_new(ossl_check_X509_NAME_ENTRY_compfunc_type(cmp)))
  177. #define sk_X509_NAME_ENTRY_new_null() ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_new_null())
  178. #define sk_X509_NAME_ENTRY_new_reserve(cmp, n) ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_new_reserve(ossl_check_X509_NAME_ENTRY_compfunc_type(cmp), (n)))
  179. #define sk_X509_NAME_ENTRY_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_NAME_ENTRY_sk_type(sk), (n))
  180. #define sk_X509_NAME_ENTRY_free(sk) OPENSSL_sk_free(ossl_check_X509_NAME_ENTRY_sk_type(sk))
  181. #define sk_X509_NAME_ENTRY_zero(sk) OPENSSL_sk_zero(ossl_check_X509_NAME_ENTRY_sk_type(sk))
  182. #define sk_X509_NAME_ENTRY_delete(sk, i) ((X509_NAME_ENTRY *)OPENSSL_sk_delete(ossl_check_X509_NAME_ENTRY_sk_type(sk), (i)))
  183. #define sk_X509_NAME_ENTRY_delete_ptr(sk, ptr) ((X509_NAME_ENTRY *)OPENSSL_sk_delete_ptr(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr)))
  184. #define sk_X509_NAME_ENTRY_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr))
  185. #define sk_X509_NAME_ENTRY_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr))
  186. #define sk_X509_NAME_ENTRY_pop(sk) ((X509_NAME_ENTRY *)OPENSSL_sk_pop(ossl_check_X509_NAME_ENTRY_sk_type(sk)))
  187. #define sk_X509_NAME_ENTRY_shift(sk) ((X509_NAME_ENTRY *)OPENSSL_sk_shift(ossl_check_X509_NAME_ENTRY_sk_type(sk)))
  188. #define sk_X509_NAME_ENTRY_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_NAME_ENTRY_sk_type(sk),ossl_check_X509_NAME_ENTRY_freefunc_type(freefunc))
  189. #define sk_X509_NAME_ENTRY_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr), (idx))
  190. #define sk_X509_NAME_ENTRY_set(sk, idx, ptr) ((X509_NAME_ENTRY *)OPENSSL_sk_set(ossl_check_X509_NAME_ENTRY_sk_type(sk), (idx), ossl_check_X509_NAME_ENTRY_type(ptr)))
  191. #define sk_X509_NAME_ENTRY_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr))
  192. #define sk_X509_NAME_ENTRY_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr))
  193. #define sk_X509_NAME_ENTRY_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr), pnum)
  194. #define sk_X509_NAME_ENTRY_sort(sk) OPENSSL_sk_sort(ossl_check_X509_NAME_ENTRY_sk_type(sk))
  195. #define sk_X509_NAME_ENTRY_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
  196. #define sk_X509_NAME_ENTRY_dup(sk) ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_dup(ossl_check_const_X509_NAME_ENTRY_sk_type(sk)))
  197. #define sk_X509_NAME_ENTRY_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_copyfunc_type(copyfunc), ossl_check_X509_NAME_ENTRY_freefunc_type(freefunc)))
  198. #define sk_X509_NAME_ENTRY_set_cmp_func(sk, cmp) ((sk_X509_NAME_ENTRY_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_compfunc_type(cmp)))
  199. # define X509_EX_V_NETSCAPE_HACK 0x8000
  200. # define X509_EX_V_INIT 0x0001
  201. typedef struct X509_extension_st X509_EXTENSION;
  202. SKM_DEFINE_STACK_OF_INTERNAL(X509_EXTENSION, X509_EXTENSION, X509_EXTENSION)
  203. #define sk_X509_EXTENSION_num(sk) OPENSSL_sk_num(ossl_check_const_X509_EXTENSION_sk_type(sk))
  204. #define sk_X509_EXTENSION_value(sk, idx) ((X509_EXTENSION *)OPENSSL_sk_value(ossl_check_const_X509_EXTENSION_sk_type(sk), (idx)))
  205. #define sk_X509_EXTENSION_new(cmp) ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_new(ossl_check_X509_EXTENSION_compfunc_type(cmp)))
  206. #define sk_X509_EXTENSION_new_null() ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_new_null())
  207. #define sk_X509_EXTENSION_new_reserve(cmp, n) ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_new_reserve(ossl_check_X509_EXTENSION_compfunc_type(cmp), (n)))
  208. #define sk_X509_EXTENSION_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_EXTENSION_sk_type(sk), (n))
  209. #define sk_X509_EXTENSION_free(sk) OPENSSL_sk_free(ossl_check_X509_EXTENSION_sk_type(sk))
  210. #define sk_X509_EXTENSION_zero(sk) OPENSSL_sk_zero(ossl_check_X509_EXTENSION_sk_type(sk))
  211. #define sk_X509_EXTENSION_delete(sk, i) ((X509_EXTENSION *)OPENSSL_sk_delete(ossl_check_X509_EXTENSION_sk_type(sk), (i)))
  212. #define sk_X509_EXTENSION_delete_ptr(sk, ptr) ((X509_EXTENSION *)OPENSSL_sk_delete_ptr(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr)))
  213. #define sk_X509_EXTENSION_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr))
  214. #define sk_X509_EXTENSION_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr))
  215. #define sk_X509_EXTENSION_pop(sk) ((X509_EXTENSION *)OPENSSL_sk_pop(ossl_check_X509_EXTENSION_sk_type(sk)))
  216. #define sk_X509_EXTENSION_shift(sk) ((X509_EXTENSION *)OPENSSL_sk_shift(ossl_check_X509_EXTENSION_sk_type(sk)))
  217. #define sk_X509_EXTENSION_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_EXTENSION_sk_type(sk),ossl_check_X509_EXTENSION_freefunc_type(freefunc))
  218. #define sk_X509_EXTENSION_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr), (idx))
  219. #define sk_X509_EXTENSION_set(sk, idx, ptr) ((X509_EXTENSION *)OPENSSL_sk_set(ossl_check_X509_EXTENSION_sk_type(sk), (idx), ossl_check_X509_EXTENSION_type(ptr)))
  220. #define sk_X509_EXTENSION_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr))
  221. #define sk_X509_EXTENSION_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr))
  222. #define sk_X509_EXTENSION_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr), pnum)
  223. #define sk_X509_EXTENSION_sort(sk) OPENSSL_sk_sort(ossl_check_X509_EXTENSION_sk_type(sk))
  224. #define sk_X509_EXTENSION_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_EXTENSION_sk_type(sk))
  225. #define sk_X509_EXTENSION_dup(sk) ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_dup(ossl_check_const_X509_EXTENSION_sk_type(sk)))
  226. #define sk_X509_EXTENSION_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_copyfunc_type(copyfunc), ossl_check_X509_EXTENSION_freefunc_type(freefunc)))
  227. #define sk_X509_EXTENSION_set_cmp_func(sk, cmp) ((sk_X509_EXTENSION_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_compfunc_type(cmp)))
  228. typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS;
  229. typedef struct x509_attributes_st X509_ATTRIBUTE;
  230. SKM_DEFINE_STACK_OF_INTERNAL(X509_ATTRIBUTE, X509_ATTRIBUTE, X509_ATTRIBUTE)
  231. #define sk_X509_ATTRIBUTE_num(sk) OPENSSL_sk_num(ossl_check_const_X509_ATTRIBUTE_sk_type(sk))
  232. #define sk_X509_ATTRIBUTE_value(sk, idx) ((X509_ATTRIBUTE *)OPENSSL_sk_value(ossl_check_const_X509_ATTRIBUTE_sk_type(sk), (idx)))
  233. #define sk_X509_ATTRIBUTE_new(cmp) ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_new(ossl_check_X509_ATTRIBUTE_compfunc_type(cmp)))
  234. #define sk_X509_ATTRIBUTE_new_null() ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_new_null())
  235. #define sk_X509_ATTRIBUTE_new_reserve(cmp, n) ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_new_reserve(ossl_check_X509_ATTRIBUTE_compfunc_type(cmp), (n)))
  236. #define sk_X509_ATTRIBUTE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_ATTRIBUTE_sk_type(sk), (n))
  237. #define sk_X509_ATTRIBUTE_free(sk) OPENSSL_sk_free(ossl_check_X509_ATTRIBUTE_sk_type(sk))
  238. #define sk_X509_ATTRIBUTE_zero(sk) OPENSSL_sk_zero(ossl_check_X509_ATTRIBUTE_sk_type(sk))
  239. #define sk_X509_ATTRIBUTE_delete(sk, i) ((X509_ATTRIBUTE *)OPENSSL_sk_delete(ossl_check_X509_ATTRIBUTE_sk_type(sk), (i)))
  240. #define sk_X509_ATTRIBUTE_delete_ptr(sk, ptr) ((X509_ATTRIBUTE *)OPENSSL_sk_delete_ptr(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr)))
  241. #define sk_X509_ATTRIBUTE_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr))
  242. #define sk_X509_ATTRIBUTE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr))
  243. #define sk_X509_ATTRIBUTE_pop(sk) ((X509_ATTRIBUTE *)OPENSSL_sk_pop(ossl_check_X509_ATTRIBUTE_sk_type(sk)))
  244. #define sk_X509_ATTRIBUTE_shift(sk) ((X509_ATTRIBUTE *)OPENSSL_sk_shift(ossl_check_X509_ATTRIBUTE_sk_type(sk)))
  245. #define sk_X509_ATTRIBUTE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_ATTRIBUTE_sk_type(sk),ossl_check_X509_ATTRIBUTE_freefunc_type(freefunc))
  246. #define sk_X509_ATTRIBUTE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr), (idx))
  247. #define sk_X509_ATTRIBUTE_set(sk, idx, ptr) ((X509_ATTRIBUTE *)OPENSSL_sk_set(ossl_check_X509_ATTRIBUTE_sk_type(sk), (idx), ossl_check_X509_ATTRIBUTE_type(ptr)))
  248. #define sk_X509_ATTRIBUTE_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr))
  249. #define sk_X509_ATTRIBUTE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr))
  250. #define sk_X509_ATTRIBUTE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr), pnum)
  251. #define sk_X509_ATTRIBUTE_sort(sk) OPENSSL_sk_sort(ossl_check_X509_ATTRIBUTE_sk_type(sk))
  252. #define sk_X509_ATTRIBUTE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_ATTRIBUTE_sk_type(sk))
  253. #define sk_X509_ATTRIBUTE_dup(sk) ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_dup(ossl_check_const_X509_ATTRIBUTE_sk_type(sk)))
  254. #define sk_X509_ATTRIBUTE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_copyfunc_type(copyfunc), ossl_check_X509_ATTRIBUTE_freefunc_type(freefunc)))
  255. #define sk_X509_ATTRIBUTE_set_cmp_func(sk, cmp) ((sk_X509_ATTRIBUTE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_compfunc_type(cmp)))
  256. typedef struct X509_req_info_st X509_REQ_INFO;
  257. typedef struct X509_req_st X509_REQ;
  258. typedef struct x509_cert_aux_st X509_CERT_AUX;
  259. typedef struct x509_cinf_st X509_CINF;
  260. /* Flags for X509_print_ex() */
  261. # define X509_FLAG_COMPAT 0
  262. # define X509_FLAG_NO_HEADER 1L
  263. # define X509_FLAG_NO_VERSION (1L << 1)
  264. # define X509_FLAG_NO_SERIAL (1L << 2)
  265. # define X509_FLAG_NO_SIGNAME (1L << 3)
  266. # define X509_FLAG_NO_ISSUER (1L << 4)
  267. # define X509_FLAG_NO_VALIDITY (1L << 5)
  268. # define X509_FLAG_NO_SUBJECT (1L << 6)
  269. # define X509_FLAG_NO_PUBKEY (1L << 7)
  270. # define X509_FLAG_NO_EXTENSIONS (1L << 8)
  271. # define X509_FLAG_NO_SIGDUMP (1L << 9)
  272. # define X509_FLAG_NO_AUX (1L << 10)
  273. # define X509_FLAG_NO_ATTRIBUTES (1L << 11)
  274. # define X509_FLAG_NO_IDS (1L << 12)
  275. # define X509_FLAG_EXTENSIONS_ONLY_KID (1L << 13)
  276. /* Flags specific to X509_NAME_print_ex() */
  277. /* The field separator information */
  278. # define XN_FLAG_SEP_MASK (0xf << 16)
  279. # define XN_FLAG_COMPAT 0/* Traditional; use old X509_NAME_print */
  280. # define XN_FLAG_SEP_COMMA_PLUS (1 << 16)/* RFC2253 ,+ */
  281. # define XN_FLAG_SEP_CPLUS_SPC (2 << 16)/* ,+ spaced: more readable */
  282. # define XN_FLAG_SEP_SPLUS_SPC (3 << 16)/* ;+ spaced */
  283. # define XN_FLAG_SEP_MULTILINE (4 << 16)/* One line per field */
  284. # define XN_FLAG_DN_REV (1 << 20)/* Reverse DN order */
  285. /* How the field name is shown */
  286. # define XN_FLAG_FN_MASK (0x3 << 21)
  287. # define XN_FLAG_FN_SN 0/* Object short name */
  288. # define XN_FLAG_FN_LN (1 << 21)/* Object long name */
  289. # define XN_FLAG_FN_OID (2 << 21)/* Always use OIDs */
  290. # define XN_FLAG_FN_NONE (3 << 21)/* No field names */
  291. # define XN_FLAG_SPC_EQ (1 << 23)/* Put spaces round '=' */
  292. /*
  293. * This determines if we dump fields we don't recognise: RFC2253 requires
  294. * this.
  295. */
  296. # define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24)
  297. # define XN_FLAG_FN_ALIGN (1 << 25)/* Align field names to 20
  298. * characters */
  299. /* Complete set of RFC2253 flags */
  300. # define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \
  301. XN_FLAG_SEP_COMMA_PLUS | \
  302. XN_FLAG_DN_REV | \
  303. XN_FLAG_FN_SN | \
  304. XN_FLAG_DUMP_UNKNOWN_FIELDS)
  305. /* readable oneline form */
  306. # define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \
  307. ASN1_STRFLGS_ESC_QUOTE | \
  308. XN_FLAG_SEP_CPLUS_SPC | \
  309. XN_FLAG_SPC_EQ | \
  310. XN_FLAG_FN_SN)
  311. /* readable multiline form */
  312. # define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \
  313. ASN1_STRFLGS_ESC_MSB | \
  314. XN_FLAG_SEP_MULTILINE | \
  315. XN_FLAG_SPC_EQ | \
  316. XN_FLAG_FN_LN | \
  317. XN_FLAG_FN_ALIGN)
  318. typedef struct X509_crl_info_st X509_CRL_INFO;
  319. typedef struct private_key_st {
  320. int version;
  321. /* The PKCS#8 data types */
  322. X509_ALGOR *enc_algor;
  323. ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */
  324. /* When decrypted, the following will not be NULL */
  325. EVP_PKEY *dec_pkey;
  326. /* used to encrypt and decrypt */
  327. int key_length;
  328. char *key_data;
  329. int key_free; /* true if we should auto free key_data */
  330. /* expanded version of 'enc_algor' */
  331. EVP_CIPHER_INFO cipher;
  332. } X509_PKEY;
  333. typedef struct X509_info_st {
  334. X509 *x509;
  335. X509_CRL *crl;
  336. X509_PKEY *x_pkey;
  337. EVP_CIPHER_INFO enc_cipher;
  338. int enc_len;
  339. char *enc_data;
  340. } X509_INFO;
  341. SKM_DEFINE_STACK_OF_INTERNAL(X509_INFO, X509_INFO, X509_INFO)
  342. #define sk_X509_INFO_num(sk) OPENSSL_sk_num(ossl_check_const_X509_INFO_sk_type(sk))
  343. #define sk_X509_INFO_value(sk, idx) ((X509_INFO *)OPENSSL_sk_value(ossl_check_const_X509_INFO_sk_type(sk), (idx)))
  344. #define sk_X509_INFO_new(cmp) ((STACK_OF(X509_INFO) *)OPENSSL_sk_new(ossl_check_X509_INFO_compfunc_type(cmp)))
  345. #define sk_X509_INFO_new_null() ((STACK_OF(X509_INFO) *)OPENSSL_sk_new_null())
  346. #define sk_X509_INFO_new_reserve(cmp, n) ((STACK_OF(X509_INFO) *)OPENSSL_sk_new_reserve(ossl_check_X509_INFO_compfunc_type(cmp), (n)))
  347. #define sk_X509_INFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_INFO_sk_type(sk), (n))
  348. #define sk_X509_INFO_free(sk) OPENSSL_sk_free(ossl_check_X509_INFO_sk_type(sk))
  349. #define sk_X509_INFO_zero(sk) OPENSSL_sk_zero(ossl_check_X509_INFO_sk_type(sk))
  350. #define sk_X509_INFO_delete(sk, i) ((X509_INFO *)OPENSSL_sk_delete(ossl_check_X509_INFO_sk_type(sk), (i)))
  351. #define sk_X509_INFO_delete_ptr(sk, ptr) ((X509_INFO *)OPENSSL_sk_delete_ptr(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr)))
  352. #define sk_X509_INFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr))
  353. #define sk_X509_INFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr))
  354. #define sk_X509_INFO_pop(sk) ((X509_INFO *)OPENSSL_sk_pop(ossl_check_X509_INFO_sk_type(sk)))
  355. #define sk_X509_INFO_shift(sk) ((X509_INFO *)OPENSSL_sk_shift(ossl_check_X509_INFO_sk_type(sk)))
  356. #define sk_X509_INFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_INFO_sk_type(sk),ossl_check_X509_INFO_freefunc_type(freefunc))
  357. #define sk_X509_INFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr), (idx))
  358. #define sk_X509_INFO_set(sk, idx, ptr) ((X509_INFO *)OPENSSL_sk_set(ossl_check_X509_INFO_sk_type(sk), (idx), ossl_check_X509_INFO_type(ptr)))
  359. #define sk_X509_INFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr))
  360. #define sk_X509_INFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr))
  361. #define sk_X509_INFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr), pnum)
  362. #define sk_X509_INFO_sort(sk) OPENSSL_sk_sort(ossl_check_X509_INFO_sk_type(sk))
  363. #define sk_X509_INFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_INFO_sk_type(sk))
  364. #define sk_X509_INFO_dup(sk) ((STACK_OF(X509_INFO) *)OPENSSL_sk_dup(ossl_check_const_X509_INFO_sk_type(sk)))
  365. #define sk_X509_INFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_INFO) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_INFO_sk_type(sk), ossl_check_X509_INFO_copyfunc_type(copyfunc), ossl_check_X509_INFO_freefunc_type(freefunc)))
  366. #define sk_X509_INFO_set_cmp_func(sk, cmp) ((sk_X509_INFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_compfunc_type(cmp)))
  367. /*
  368. * The next 2 structures and their 8 routines are used to manipulate Netscape's
  369. * spki structures - useful if you are writing a CA web page
  370. */
  371. typedef struct Netscape_spkac_st {
  372. X509_PUBKEY *pubkey;
  373. ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */
  374. } NETSCAPE_SPKAC;
  375. typedef struct Netscape_spki_st {
  376. NETSCAPE_SPKAC *spkac; /* signed public key and challenge */
  377. X509_ALGOR sig_algor;
  378. ASN1_BIT_STRING *signature;
  379. } NETSCAPE_SPKI;
  380. /* Netscape certificate sequence structure */
  381. typedef struct Netscape_certificate_sequence {
  382. ASN1_OBJECT *type;
  383. STACK_OF(X509) *certs;
  384. } NETSCAPE_CERT_SEQUENCE;
  385. /*- Unused (and iv length is wrong)
  386. typedef struct CBCParameter_st
  387. {
  388. unsigned char iv[8];
  389. } CBC_PARAM;
  390. */
  391. /* Password based encryption structure */
  392. typedef struct PBEPARAM_st {
  393. ASN1_OCTET_STRING *salt;
  394. ASN1_INTEGER *iter;
  395. } PBEPARAM;
  396. /* Password based encryption V2 structures */
  397. typedef struct PBE2PARAM_st {
  398. X509_ALGOR *keyfunc;
  399. X509_ALGOR *encryption;
  400. } PBE2PARAM;
  401. typedef struct PBKDF2PARAM_st {
  402. /* Usually OCTET STRING but could be anything */
  403. ASN1_TYPE *salt;
  404. ASN1_INTEGER *iter;
  405. ASN1_INTEGER *keylength;
  406. X509_ALGOR *prf;
  407. } PBKDF2PARAM;
  408. #ifndef OPENSSL_NO_SCRYPT
  409. typedef struct SCRYPT_PARAMS_st {
  410. ASN1_OCTET_STRING *salt;
  411. ASN1_INTEGER *costParameter;
  412. ASN1_INTEGER *blockSize;
  413. ASN1_INTEGER *parallelizationParameter;
  414. ASN1_INTEGER *keyLength;
  415. } SCRYPT_PARAMS;
  416. #endif
  417. #ifdef __cplusplus
  418. }
  419. #endif
  420. # include <openssl/x509_vfy.h>
  421. # include <openssl/pkcs7.h>
  422. #ifdef __cplusplus
  423. extern "C" {
  424. #endif
  425. # define X509_EXT_PACK_UNKNOWN 1
  426. # define X509_EXT_PACK_STRING 2
  427. # define X509_extract_key(x) X509_get_pubkey(x)/*****/
  428. # define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a)
  429. # define X509_name_cmp(a,b) X509_NAME_cmp((a),(b))
  430. void X509_CRL_set_default_method(const X509_CRL_METHOD *meth);
  431. X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl),
  432. int (*crl_free) (X509_CRL *crl),
  433. int (*crl_lookup) (X509_CRL *crl,
  434. X509_REVOKED **ret,
  435. const
  436. ASN1_INTEGER *serial,
  437. const
  438. X509_NAME *issuer),
  439. int (*crl_verify) (X509_CRL *crl,
  440. EVP_PKEY *pk));
  441. void X509_CRL_METHOD_free(X509_CRL_METHOD *m);
  442. void X509_CRL_set_meth_data(X509_CRL *crl, void *dat);
  443. void *X509_CRL_get_meth_data(X509_CRL *crl);
  444. const char *X509_verify_cert_error_string(long n);
  445. int X509_verify(X509 *a, EVP_PKEY *r);
  446. int X509_self_signed(X509 *cert, int verify_signature);
  447. int X509_REQ_verify_ex(X509_REQ *a, EVP_PKEY *r, OSSL_LIB_CTX *libctx,
  448. const char *propq);
  449. int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);
  450. int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);
  451. int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r);
  452. NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len);
  453. char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x);
  454. EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x);
  455. int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey);
  456. int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki);
  457. int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent);
  458. int X509_signature_print(BIO *bp, const X509_ALGOR *alg,
  459. const ASN1_STRING *sig);
  460. int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
  461. int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);
  462. int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
  463. int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);
  464. int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
  465. int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);
  466. int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md);
  467. int X509_pubkey_digest(const X509 *data, const EVP_MD *type,
  468. unsigned char *md, unsigned int *len);
  469. int X509_digest(const X509 *data, const EVP_MD *type,
  470. unsigned char *md, unsigned int *len);
  471. ASN1_OCTET_STRING *X509_digest_sig(const X509 *cert,
  472. EVP_MD **md_used, int *md_is_fallback);
  473. int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type,
  474. unsigned char *md, unsigned int *len);
  475. int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type,
  476. unsigned char *md, unsigned int *len);
  477. int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type,
  478. unsigned char *md, unsigned int *len);
  479. X509 *X509_load_http(const char *url, BIO *bio, BIO *rbio, int timeout);
  480. X509_CRL *X509_CRL_load_http(const char *url, BIO *bio, BIO *rbio, int timeout);
  481. # ifndef OPENSSL_NO_DEPRECATED_3_0
  482. # include <openssl/http.h> /* OSSL_HTTP_REQ_CTX_nbio_d2i */
  483. # define X509_http_nbio(rctx, pcert) \
  484. OSSL_HTTP_REQ_CTX_nbio_d2i(rctx, pcert, ASN1_ITEM_rptr(X509))
  485. # define X509_CRL_http_nbio(rctx, pcrl) \
  486. OSSL_HTTP_REQ_CTX_nbio_d2i(rctx, pcrl, ASN1_ITEM_rptr(X509_CRL))
  487. # endif
  488. # ifndef OPENSSL_NO_STDIO
  489. X509 *d2i_X509_fp(FILE *fp, X509 **x509);
  490. int i2d_X509_fp(FILE *fp, const X509 *x509);
  491. X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl);
  492. int i2d_X509_CRL_fp(FILE *fp, const X509_CRL *crl);
  493. X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req);
  494. int i2d_X509_REQ_fp(FILE *fp, const X509_REQ *req);
  495. # ifndef OPENSSL_NO_DEPRECATED_3_0
  496. OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa);
  497. OSSL_DEPRECATEDIN_3_0 int i2d_RSAPrivateKey_fp(FILE *fp, const RSA *rsa);
  498. OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa);
  499. OSSL_DEPRECATEDIN_3_0 int i2d_RSAPublicKey_fp(FILE *fp, const RSA *rsa);
  500. OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa);
  501. OSSL_DEPRECATEDIN_3_0 int i2d_RSA_PUBKEY_fp(FILE *fp, const RSA *rsa);
  502. # endif
  503. # ifndef OPENSSL_NO_DEPRECATED_3_0
  504. # ifndef OPENSSL_NO_DSA
  505. OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa);
  506. OSSL_DEPRECATEDIN_3_0 int i2d_DSA_PUBKEY_fp(FILE *fp, const DSA *dsa);
  507. OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa);
  508. OSSL_DEPRECATEDIN_3_0 int i2d_DSAPrivateKey_fp(FILE *fp, const DSA *dsa);
  509. # endif
  510. # endif
  511. # ifndef OPENSSL_NO_DEPRECATED_3_0
  512. # ifndef OPENSSL_NO_EC
  513. OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey);
  514. OSSL_DEPRECATEDIN_3_0 int i2d_EC_PUBKEY_fp(FILE *fp, const EC_KEY *eckey);
  515. OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey);
  516. OSSL_DEPRECATEDIN_3_0 int i2d_ECPrivateKey_fp(FILE *fp, const EC_KEY *eckey);
  517. # endif /* OPENSSL_NO_EC */
  518. # endif /* OPENSSL_NO_DEPRECATED_3_0 */
  519. X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8);
  520. int i2d_PKCS8_fp(FILE *fp, const X509_SIG *p8);
  521. X509_PUBKEY *d2i_X509_PUBKEY_fp(FILE *fp, X509_PUBKEY **xpk);
  522. int i2d_X509_PUBKEY_fp(FILE *fp, const X509_PUBKEY *xpk);
  523. PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,
  524. PKCS8_PRIV_KEY_INFO **p8inf);
  525. int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, const PKCS8_PRIV_KEY_INFO *p8inf);
  526. int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, const EVP_PKEY *key);
  527. int i2d_PrivateKey_fp(FILE *fp, const EVP_PKEY *pkey);
  528. EVP_PKEY *d2i_PrivateKey_ex_fp(FILE *fp, EVP_PKEY **a, OSSL_LIB_CTX *libctx,
  529. const char *propq);
  530. EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a);
  531. int i2d_PUBKEY_fp(FILE *fp, const EVP_PKEY *pkey);
  532. EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a);
  533. # endif
  534. X509 *d2i_X509_bio(BIO *bp, X509 **x509);
  535. int i2d_X509_bio(BIO *bp, const X509 *x509);
  536. X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl);
  537. int i2d_X509_CRL_bio(BIO *bp, const X509_CRL *crl);
  538. X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req);
  539. int i2d_X509_REQ_bio(BIO *bp, const X509_REQ *req);
  540. # ifndef OPENSSL_NO_DEPRECATED_3_0
  541. OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa);
  542. OSSL_DEPRECATEDIN_3_0 int i2d_RSAPrivateKey_bio(BIO *bp, const RSA *rsa);
  543. OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa);
  544. OSSL_DEPRECATEDIN_3_0 int i2d_RSAPublicKey_bio(BIO *bp, const RSA *rsa);
  545. OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa);
  546. OSSL_DEPRECATEDIN_3_0 int i2d_RSA_PUBKEY_bio(BIO *bp, const RSA *rsa);
  547. # endif
  548. # ifndef OPENSSL_NO_DEPRECATED_3_0
  549. # ifndef OPENSSL_NO_DSA
  550. OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa);
  551. OSSL_DEPRECATEDIN_3_0 int i2d_DSA_PUBKEY_bio(BIO *bp, const DSA *dsa);
  552. OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa);
  553. OSSL_DEPRECATEDIN_3_0 int i2d_DSAPrivateKey_bio(BIO *bp, const DSA *dsa);
  554. # endif
  555. # endif
  556. # ifndef OPENSSL_NO_DEPRECATED_3_0
  557. # ifndef OPENSSL_NO_EC
  558. OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey);
  559. OSSL_DEPRECATEDIN_3_0 int i2d_EC_PUBKEY_bio(BIO *bp, const EC_KEY *eckey);
  560. OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey);
  561. OSSL_DEPRECATEDIN_3_0 int i2d_ECPrivateKey_bio(BIO *bp, const EC_KEY *eckey);
  562. # endif /* OPENSSL_NO_EC */
  563. # endif /* OPENSSL_NO_DEPRECATED_3_0 */
  564. X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8);
  565. int i2d_PKCS8_bio(BIO *bp, const X509_SIG *p8);
  566. X509_PUBKEY *d2i_X509_PUBKEY_bio(BIO *bp, X509_PUBKEY **xpk);
  567. int i2d_X509_PUBKEY_bio(BIO *bp, const X509_PUBKEY *xpk);
  568. PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,
  569. PKCS8_PRIV_KEY_INFO **p8inf);
  570. int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, const PKCS8_PRIV_KEY_INFO *p8inf);
  571. int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, const EVP_PKEY *key);
  572. int i2d_PrivateKey_bio(BIO *bp, const EVP_PKEY *pkey);
  573. EVP_PKEY *d2i_PrivateKey_ex_bio(BIO *bp, EVP_PKEY **a, OSSL_LIB_CTX *libctx,
  574. const char *propq);
  575. EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a);
  576. int i2d_PUBKEY_bio(BIO *bp, const EVP_PKEY *pkey);
  577. EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a);
  578. DECLARE_ASN1_DUP_FUNCTION(X509)
  579. DECLARE_ASN1_DUP_FUNCTION(X509_ALGOR)
  580. DECLARE_ASN1_DUP_FUNCTION(X509_ATTRIBUTE)
  581. DECLARE_ASN1_DUP_FUNCTION(X509_CRL)
  582. DECLARE_ASN1_DUP_FUNCTION(X509_EXTENSION)
  583. DECLARE_ASN1_DUP_FUNCTION(X509_PUBKEY)
  584. DECLARE_ASN1_DUP_FUNCTION(X509_REQ)
  585. DECLARE_ASN1_DUP_FUNCTION(X509_REVOKED)
  586. int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype,
  587. void *pval);
  588. void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype,
  589. const void **ppval, const X509_ALGOR *algor);
  590. void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md);
  591. int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b);
  592. int X509_ALGOR_copy(X509_ALGOR *dest, const X509_ALGOR *src);
  593. DECLARE_ASN1_DUP_FUNCTION(X509_NAME)
  594. DECLARE_ASN1_DUP_FUNCTION(X509_NAME_ENTRY)
  595. int X509_cmp_time(const ASN1_TIME *s, time_t *t);
  596. int X509_cmp_current_time(const ASN1_TIME *s);
  597. int X509_cmp_timeframe(const X509_VERIFY_PARAM *vpm,
  598. const ASN1_TIME *start, const ASN1_TIME *end);
  599. ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t);
  600. ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s,
  601. int offset_day, long offset_sec, time_t *t);
  602. ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj);
  603. const char *X509_get_default_cert_area(void);
  604. const char *X509_get_default_cert_dir(void);
  605. const char *X509_get_default_cert_file(void);
  606. const char *X509_get_default_cert_dir_env(void);
  607. const char *X509_get_default_cert_file_env(void);
  608. const char *X509_get_default_private_dir(void);
  609. X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
  610. X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey);
  611. DECLARE_ASN1_FUNCTIONS(X509_ALGOR)
  612. DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS)
  613. DECLARE_ASN1_FUNCTIONS(X509_VAL)
  614. DECLARE_ASN1_FUNCTIONS(X509_PUBKEY)
  615. X509_PUBKEY *X509_PUBKEY_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
  616. int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);
  617. EVP_PKEY *X509_PUBKEY_get0(const X509_PUBKEY *key);
  618. EVP_PKEY *X509_PUBKEY_get(const X509_PUBKEY *key);
  619. int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain);
  620. long X509_get_pathlen(X509 *x);
  621. DECLARE_ASN1_ENCODE_FUNCTIONS_only(EVP_PKEY, PUBKEY)
  622. EVP_PKEY *d2i_PUBKEY_ex(EVP_PKEY **a, const unsigned char **pp, long length,
  623. OSSL_LIB_CTX *libctx, const char *propq);
  624. # ifndef OPENSSL_NO_DEPRECATED_3_0
  625. DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0,RSA, RSA_PUBKEY)
  626. # endif
  627. # ifndef OPENSSL_NO_DEPRECATED_3_0
  628. # ifndef OPENSSL_NO_DSA
  629. DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0,DSA, DSA_PUBKEY)
  630. # endif
  631. # endif
  632. # ifndef OPENSSL_NO_DEPRECATED_3_0
  633. # ifndef OPENSSL_NO_EC
  634. DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, EC_KEY, EC_PUBKEY)
  635. # endif
  636. # endif
  637. DECLARE_ASN1_FUNCTIONS(X509_SIG)
  638. void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg,
  639. const ASN1_OCTET_STRING **pdigest);
  640. void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg,
  641. ASN1_OCTET_STRING **pdigest);
  642. DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO)
  643. DECLARE_ASN1_FUNCTIONS(X509_REQ)
  644. X509_REQ *X509_REQ_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
  645. DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE)
  646. X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value);
  647. DECLARE_ASN1_FUNCTIONS(X509_EXTENSION)
  648. DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS)
  649. DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY)
  650. DECLARE_ASN1_FUNCTIONS(X509_NAME)
  651. int X509_NAME_set(X509_NAME **xn, const X509_NAME *name);
  652. DECLARE_ASN1_FUNCTIONS(X509_CINF)
  653. DECLARE_ASN1_FUNCTIONS(X509)
  654. X509 *X509_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
  655. DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX)
  656. #define X509_get_ex_new_index(l, p, newf, dupf, freef) \
  657. CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, l, p, newf, dupf, freef)
  658. int X509_set_ex_data(X509 *r, int idx, void *arg);
  659. void *X509_get_ex_data(const X509 *r, int idx);
  660. DECLARE_ASN1_ENCODE_FUNCTIONS_only(X509,X509_AUX)
  661. int i2d_re_X509_tbs(X509 *x, unsigned char **pp);
  662. int X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid,
  663. int *secbits, uint32_t *flags);
  664. void X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid,
  665. int secbits, uint32_t flags);
  666. int X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits,
  667. uint32_t *flags);
  668. void X509_get0_signature(const ASN1_BIT_STRING **psig,
  669. const X509_ALGOR **palg, const X509 *x);
  670. int X509_get_signature_nid(const X509 *x);
  671. void X509_set0_distinguishing_id(X509 *x, ASN1_OCTET_STRING *d_id);
  672. ASN1_OCTET_STRING *X509_get0_distinguishing_id(X509 *x);
  673. void X509_REQ_set0_distinguishing_id(X509_REQ *x, ASN1_OCTET_STRING *d_id);
  674. ASN1_OCTET_STRING *X509_REQ_get0_distinguishing_id(X509_REQ *x);
  675. int X509_alias_set1(X509 *x, const unsigned char *name, int len);
  676. int X509_keyid_set1(X509 *x, const unsigned char *id, int len);
  677. unsigned char *X509_alias_get0(X509 *x, int *len);
  678. unsigned char *X509_keyid_get0(X509 *x, int *len);
  679. DECLARE_ASN1_FUNCTIONS(X509_REVOKED)
  680. DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO)
  681. DECLARE_ASN1_FUNCTIONS(X509_CRL)
  682. X509_CRL *X509_CRL_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
  683. int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
  684. int X509_CRL_get0_by_serial(X509_CRL *crl,
  685. X509_REVOKED **ret, const ASN1_INTEGER *serial);
  686. int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);
  687. X509_PKEY *X509_PKEY_new(void);
  688. void X509_PKEY_free(X509_PKEY *a);
  689. DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI)
  690. DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC)
  691. DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE)
  692. X509_INFO *X509_INFO_new(void);
  693. void X509_INFO_free(X509_INFO *a);
  694. char *X509_NAME_oneline(const X509_NAME *a, char *buf, int size);
  695. #ifndef OPENSSL_NO_DEPRECATED_3_0
  696. OSSL_DEPRECATEDIN_3_0
  697. int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1,
  698. ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey);
  699. OSSL_DEPRECATEDIN_3_0
  700. int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
  701. unsigned char *md, unsigned int *len);
  702. OSSL_DEPRECATEDIN_3_0
  703. int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, X509_ALGOR *algor2,
  704. ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey,
  705. const EVP_MD *type);
  706. #endif
  707. int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data,
  708. unsigned char *md, unsigned int *len);
  709. int ASN1_item_verify(const ASN1_ITEM *it, const X509_ALGOR *alg,
  710. const ASN1_BIT_STRING *signature, const void *data,
  711. EVP_PKEY *pkey);
  712. int ASN1_item_verify_ctx(const ASN1_ITEM *it, const X509_ALGOR *alg,
  713. const ASN1_BIT_STRING *signature, const void *data,
  714. EVP_MD_CTX *ctx);
  715. int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
  716. ASN1_BIT_STRING *signature, const void *data,
  717. EVP_PKEY *pkey, const EVP_MD *md);
  718. int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1,
  719. X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
  720. const void *data, EVP_MD_CTX *ctx);
  721. #define X509_VERSION_1 0
  722. #define X509_VERSION_2 1
  723. #define X509_VERSION_3 2
  724. long X509_get_version(const X509 *x);
  725. int X509_set_version(X509 *x, long version);
  726. int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);
  727. ASN1_INTEGER *X509_get_serialNumber(X509 *x);
  728. const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x);
  729. int X509_set_issuer_name(X509 *x, const X509_NAME *name);
  730. X509_NAME *X509_get_issuer_name(const X509 *a);
  731. int X509_set_subject_name(X509 *x, const X509_NAME *name);
  732. X509_NAME *X509_get_subject_name(const X509 *a);
  733. const ASN1_TIME * X509_get0_notBefore(const X509 *x);
  734. ASN1_TIME *X509_getm_notBefore(const X509 *x);
  735. int X509_set1_notBefore(X509 *x, const ASN1_TIME *tm);
  736. const ASN1_TIME *X509_get0_notAfter(const X509 *x);
  737. ASN1_TIME *X509_getm_notAfter(const X509 *x);
  738. int X509_set1_notAfter(X509 *x, const ASN1_TIME *tm);
  739. int X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
  740. int X509_up_ref(X509 *x);
  741. int X509_get_signature_type(const X509 *x);
  742. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  743. # define X509_get_notBefore X509_getm_notBefore
  744. # define X509_get_notAfter X509_getm_notAfter
  745. # define X509_set_notBefore X509_set1_notBefore
  746. # define X509_set_notAfter X509_set1_notAfter
  747. #endif
  748. /*
  749. * This one is only used so that a binary form can output, as in
  750. * i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), &buf)
  751. */
  752. X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x);
  753. const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x);
  754. void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid,
  755. const ASN1_BIT_STRING **psuid);
  756. const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x);
  757. EVP_PKEY *X509_get0_pubkey(const X509 *x);
  758. EVP_PKEY *X509_get_pubkey(X509 *x);
  759. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x);
  760. #define X509_REQ_VERSION_1 0
  761. long X509_REQ_get_version(const X509_REQ *req);
  762. int X509_REQ_set_version(X509_REQ *x, long version);
  763. X509_NAME *X509_REQ_get_subject_name(const X509_REQ *req);
  764. int X509_REQ_set_subject_name(X509_REQ *req, const X509_NAME *name);
  765. void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig,
  766. const X509_ALGOR **palg);
  767. void X509_REQ_set0_signature(X509_REQ *req, ASN1_BIT_STRING *psig);
  768. int X509_REQ_set1_signature_algo(X509_REQ *req, X509_ALGOR *palg);
  769. int X509_REQ_get_signature_nid(const X509_REQ *req);
  770. int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp);
  771. int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
  772. EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req);
  773. EVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req);
  774. X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req);
  775. int X509_REQ_extension_nid(int nid);
  776. int *X509_REQ_get_extension_nids(void);
  777. void X509_REQ_set_extension_nids(int *nids);
  778. STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req);
  779. int X509_REQ_add_extensions_nid(X509_REQ *req,
  780. const STACK_OF(X509_EXTENSION) *exts, int nid);
  781. int X509_REQ_add_extensions(X509_REQ *req, const STACK_OF(X509_EXTENSION) *ext);
  782. int X509_REQ_get_attr_count(const X509_REQ *req);
  783. int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos);
  784. int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj,
  785. int lastpos);
  786. X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc);
  787. X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc);
  788. int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr);
  789. int X509_REQ_add1_attr_by_OBJ(X509_REQ *req,
  790. const ASN1_OBJECT *obj, int type,
  791. const unsigned char *bytes, int len);
  792. int X509_REQ_add1_attr_by_NID(X509_REQ *req,
  793. int nid, int type,
  794. const unsigned char *bytes, int len);
  795. int X509_REQ_add1_attr_by_txt(X509_REQ *req,
  796. const char *attrname, int type,
  797. const unsigned char *bytes, int len);
  798. #define X509_CRL_VERSION_1 0
  799. #define X509_CRL_VERSION_2 1
  800. int X509_CRL_set_version(X509_CRL *x, long version);
  801. int X509_CRL_set_issuer_name(X509_CRL *x, const X509_NAME *name);
  802. int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm);
  803. int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm);
  804. int X509_CRL_sort(X509_CRL *crl);
  805. int X509_CRL_up_ref(X509_CRL *crl);
  806. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  807. # define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate
  808. # define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate
  809. #endif
  810. long X509_CRL_get_version(const X509_CRL *crl);
  811. const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl);
  812. const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl);
  813. #ifndef OPENSSL_NO_DEPRECATED_1_1_0
  814. OSSL_DEPRECATEDIN_1_1_0 ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl);
  815. OSSL_DEPRECATEDIN_1_1_0 ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl);
  816. #endif
  817. X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl);
  818. const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl);
  819. STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl);
  820. void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig,
  821. const X509_ALGOR **palg);
  822. int X509_CRL_get_signature_nid(const X509_CRL *crl);
  823. int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp);
  824. const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x);
  825. int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);
  826. const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x);
  827. int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);
  828. const STACK_OF(X509_EXTENSION) *
  829. X509_REVOKED_get0_extensions(const X509_REVOKED *r);
  830. X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer,
  831. EVP_PKEY *skey, const EVP_MD *md, unsigned int flags);
  832. int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey);
  833. int X509_check_private_key(const X509 *x509, const EVP_PKEY *pkey);
  834. int X509_chain_check_suiteb(int *perror_depth,
  835. X509 *x, STACK_OF(X509) *chain,
  836. unsigned long flags);
  837. int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags);
  838. STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain);
  839. int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
  840. unsigned long X509_issuer_and_serial_hash(X509 *a);
  841. int X509_issuer_name_cmp(const X509 *a, const X509 *b);
  842. unsigned long X509_issuer_name_hash(X509 *a);
  843. int X509_subject_name_cmp(const X509 *a, const X509 *b);
  844. unsigned long X509_subject_name_hash(X509 *x);
  845. # ifndef OPENSSL_NO_MD5
  846. unsigned long X509_issuer_name_hash_old(X509 *a);
  847. unsigned long X509_subject_name_hash_old(X509 *x);
  848. # endif
  849. # define X509_ADD_FLAG_DEFAULT 0
  850. # define X509_ADD_FLAG_UP_REF 0x1
  851. # define X509_ADD_FLAG_PREPEND 0x2
  852. # define X509_ADD_FLAG_NO_DUP 0x4
  853. # define X509_ADD_FLAG_NO_SS 0x8
  854. int X509_add_cert(STACK_OF(X509) *sk, X509 *cert, int flags);
  855. int X509_add_certs(STACK_OF(X509) *sk, STACK_OF(X509) *certs, int flags);
  856. int X509_cmp(const X509 *a, const X509 *b);
  857. int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);
  858. #ifndef OPENSSL_NO_DEPRECATED_3_0
  859. # define X509_NAME_hash(x) X509_NAME_hash_ex(x, NULL, NULL, NULL)
  860. OSSL_DEPRECATEDIN_3_0 int X509_certificate_type(const X509 *x,
  861. const EVP_PKEY *pubkey);
  862. #endif
  863. unsigned long X509_NAME_hash_ex(const X509_NAME *x, OSSL_LIB_CTX *libctx,
  864. const char *propq, int *ok);
  865. unsigned long X509_NAME_hash_old(const X509_NAME *x);
  866. int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
  867. int X509_CRL_match(const X509_CRL *a, const X509_CRL *b);
  868. int X509_aux_print(BIO *out, X509 *x, int indent);
  869. # ifndef OPENSSL_NO_STDIO
  870. int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag,
  871. unsigned long cflag);
  872. int X509_print_fp(FILE *bp, X509 *x);
  873. int X509_CRL_print_fp(FILE *bp, X509_CRL *x);
  874. int X509_REQ_print_fp(FILE *bp, X509_REQ *req);
  875. int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent,
  876. unsigned long flags);
  877. # endif
  878. int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase);
  879. int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent,
  880. unsigned long flags);
  881. int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag,
  882. unsigned long cflag);
  883. int X509_print(BIO *bp, X509 *x);
  884. int X509_ocspid_print(BIO *bp, X509 *x);
  885. int X509_CRL_print_ex(BIO *out, X509_CRL *x, unsigned long nmflag);
  886. int X509_CRL_print(BIO *bp, X509_CRL *x);
  887. int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag,
  888. unsigned long cflag);
  889. int X509_REQ_print(BIO *bp, X509_REQ *req);
  890. int X509_NAME_entry_count(const X509_NAME *name);
  891. int X509_NAME_get_text_by_NID(const X509_NAME *name, int nid,
  892. char *buf, int len);
  893. int X509_NAME_get_text_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj,
  894. char *buf, int len);
  895. /*
  896. * NOTE: you should be passing -1, not 0 as lastpos. The functions that use
  897. * lastpos, search after that position on.
  898. */
  899. int X509_NAME_get_index_by_NID(const X509_NAME *name, int nid, int lastpos);
  900. int X509_NAME_get_index_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj,
  901. int lastpos);
  902. X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc);
  903. X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);
  904. int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne,
  905. int loc, int set);
  906. int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type,
  907. const unsigned char *bytes, int len, int loc,
  908. int set);
  909. int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
  910. const unsigned char *bytes, int len, int loc,
  911. int set);
  912. X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
  913. const char *field, int type,
  914. const unsigned char *bytes,
  915. int len);
  916. X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
  917. int type,
  918. const unsigned char *bytes,
  919. int len);
  920. int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,
  921. const unsigned char *bytes, int len, int loc,
  922. int set);
  923. X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,
  924. const ASN1_OBJECT *obj, int type,
  925. const unsigned char *bytes,
  926. int len);
  927. int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj);
  928. int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,
  929. const unsigned char *bytes, int len);
  930. ASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne);
  931. ASN1_STRING * X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne);
  932. int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne);
  933. int X509_NAME_get0_der(const X509_NAME *nm, const unsigned char **pder,
  934. size_t *pderlen);
  935. int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x);
  936. int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x,
  937. int nid, int lastpos);
  938. int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x,
  939. const ASN1_OBJECT *obj, int lastpos);
  940. int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x,
  941. int crit, int lastpos);
  942. X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc);
  943. X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc);
  944. STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x,
  945. X509_EXTENSION *ex, int loc);
  946. int X509_get_ext_count(const X509 *x);
  947. int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos);
  948. int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos);
  949. int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos);
  950. X509_EXTENSION *X509_get_ext(const X509 *x, int loc);
  951. X509_EXTENSION *X509_delete_ext(X509 *x, int loc);
  952. int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
  953. void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx);
  954. int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
  955. unsigned long flags);
  956. int X509_CRL_get_ext_count(const X509_CRL *x);
  957. int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos);
  958. int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj,
  959. int lastpos);
  960. int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos);
  961. X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc);
  962. X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);
  963. int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
  964. void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx);
  965. int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,
  966. unsigned long flags);
  967. int X509_REVOKED_get_ext_count(const X509_REVOKED *x);
  968. int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos);
  969. int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj,
  970. int lastpos);
  971. int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit,
  972. int lastpos);
  973. X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc);
  974. X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc);
  975. int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc);
  976. void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit,
  977. int *idx);
  978. int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,
  979. unsigned long flags);
  980. X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,
  981. int nid, int crit,
  982. ASN1_OCTET_STRING *data);
  983. X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,
  984. const ASN1_OBJECT *obj, int crit,
  985. ASN1_OCTET_STRING *data);
  986. int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj);
  987. int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);
  988. int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data);
  989. ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex);
  990. ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);
  991. int X509_EXTENSION_get_critical(const X509_EXTENSION *ex);
  992. int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x);
  993. int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid,
  994. int lastpos);
  995. int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk,
  996. const ASN1_OBJECT *obj, int lastpos);
  997. X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc);
  998. X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc);
  999. STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x,
  1000. X509_ATTRIBUTE *attr);
  1001. STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE)
  1002. **x, const ASN1_OBJECT *obj,
  1003. int type,
  1004. const unsigned char *bytes,
  1005. int len);
  1006. STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE)
  1007. **x, int nid, int type,
  1008. const unsigned char *bytes,
  1009. int len);
  1010. STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE)
  1011. **x, const char *attrname,
  1012. int type,
  1013. const unsigned char *bytes,
  1014. int len);
  1015. void *X509at_get0_data_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *x,
  1016. const ASN1_OBJECT *obj, int lastpos, int type);
  1017. X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid,
  1018. int atrtype, const void *data,
  1019. int len);
  1020. X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr,
  1021. const ASN1_OBJECT *obj,
  1022. int atrtype, const void *data,
  1023. int len);
  1024. X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr,
  1025. const char *atrname, int type,
  1026. const unsigned char *bytes,
  1027. int len);
  1028. int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj);
  1029. int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype,
  1030. const void *data, int len);
  1031. void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype,
  1032. void *data);
  1033. int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr);
  1034. ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);
  1035. ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);
  1036. int EVP_PKEY_get_attr_count(const EVP_PKEY *key);
  1037. int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos);
  1038. int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj,
  1039. int lastpos);
  1040. X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc);
  1041. X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc);
  1042. int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);
  1043. int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,
  1044. const ASN1_OBJECT *obj, int type,
  1045. const unsigned char *bytes, int len);
  1046. int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,
  1047. int nid, int type,
  1048. const unsigned char *bytes, int len);
  1049. int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,
  1050. const char *attrname, int type,
  1051. const unsigned char *bytes, int len);
  1052. /* lookup a cert from a X509 STACK */
  1053. X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, const X509_NAME *name,
  1054. const ASN1_INTEGER *serial);
  1055. X509 *X509_find_by_subject(STACK_OF(X509) *sk, const X509_NAME *name);
  1056. DECLARE_ASN1_FUNCTIONS(PBEPARAM)
  1057. DECLARE_ASN1_FUNCTIONS(PBE2PARAM)
  1058. DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM)
  1059. #ifndef OPENSSL_NO_SCRYPT
  1060. DECLARE_ASN1_FUNCTIONS(SCRYPT_PARAMS)
  1061. #endif
  1062. int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
  1063. const unsigned char *salt, int saltlen);
  1064. int PKCS5_pbe_set0_algor_ex(X509_ALGOR *algor, int alg, int iter,
  1065. const unsigned char *salt, int saltlen,
  1066. OSSL_LIB_CTX *libctx);
  1067. X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
  1068. const unsigned char *salt, int saltlen);
  1069. X509_ALGOR *PKCS5_pbe_set_ex(int alg, int iter,
  1070. const unsigned char *salt, int saltlen,
  1071. OSSL_LIB_CTX *libctx);
  1072. X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
  1073. unsigned char *salt, int saltlen);
  1074. X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
  1075. unsigned char *salt, int saltlen,
  1076. unsigned char *aiv, int prf_nid);
  1077. X509_ALGOR *PKCS5_pbe2_set_iv_ex(const EVP_CIPHER *cipher, int iter,
  1078. unsigned char *salt, int saltlen,
  1079. unsigned char *aiv, int prf_nid,
  1080. OSSL_LIB_CTX *libctx);
  1081. #ifndef OPENSSL_NO_SCRYPT
  1082. X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher,
  1083. const unsigned char *salt, int saltlen,
  1084. unsigned char *aiv, uint64_t N, uint64_t r,
  1085. uint64_t p);
  1086. #endif
  1087. X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,
  1088. int prf_nid, int keylen);
  1089. X509_ALGOR *PKCS5_pbkdf2_set_ex(int iter, unsigned char *salt, int saltlen,
  1090. int prf_nid, int keylen,
  1091. OSSL_LIB_CTX *libctx);
  1092. /* PKCS#8 utilities */
  1093. DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
  1094. EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8);
  1095. EVP_PKEY *EVP_PKCS82PKEY_ex(const PKCS8_PRIV_KEY_INFO *p8, OSSL_LIB_CTX *libctx,
  1096. const char *propq);
  1097. PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(const EVP_PKEY *pkey);
  1098. int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
  1099. int version, int ptype, void *pval,
  1100. unsigned char *penc, int penclen);
  1101. int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg,
  1102. const unsigned char **pk, int *ppklen,
  1103. const X509_ALGOR **pa, const PKCS8_PRIV_KEY_INFO *p8);
  1104. const STACK_OF(X509_ATTRIBUTE) *
  1105. PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8);
  1106. int PKCS8_pkey_add1_attr(PKCS8_PRIV_KEY_INFO *p8, X509_ATTRIBUTE *attr);
  1107. int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type,
  1108. const unsigned char *bytes, int len);
  1109. int PKCS8_pkey_add1_attr_by_OBJ(PKCS8_PRIV_KEY_INFO *p8, const ASN1_OBJECT *obj,
  1110. int type, const unsigned char *bytes, int len);
  1111. int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,
  1112. int ptype, void *pval,
  1113. unsigned char *penc, int penclen);
  1114. int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg,
  1115. const unsigned char **pk, int *ppklen,
  1116. X509_ALGOR **pa, const X509_PUBKEY *pub);
  1117. int X509_PUBKEY_eq(const X509_PUBKEY *a, const X509_PUBKEY *b);
  1118. # ifdef __cplusplus
  1119. }
  1120. # endif
  1121. #endif