X509_get0_signature.pod 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. =pod
  2. =head1 NAME
  3. X509_get0_signature, X509_REQ_set0_signature, X509_REQ_set1_signature_algo,
  4. X509_get_signature_nid, X509_get0_tbs_sigalg, X509_REQ_get0_signature,
  5. X509_REQ_get_signature_nid, X509_CRL_get0_signature, X509_CRL_get_signature_nid,
  6. X509_get_signature_info, X509_SIG_INFO_get, X509_SIG_INFO_set - signature information
  7. =head1 SYNOPSIS
  8. #include <openssl/x509.h>
  9. void X509_get0_signature(const ASN1_BIT_STRING **psig,
  10. const X509_ALGOR **palg,
  11. const X509 *x);
  12. void X509_REQ_set0_signature(X509_REQ *req, ASN1_BIT_STRING *psig);
  13. int X509_REQ_set1_signature_algo(X509_REQ *req, X509_ALGOR *palg);
  14. int X509_get_signature_nid(const X509 *x);
  15. const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x);
  16. void X509_REQ_get0_signature(const X509_REQ *crl,
  17. const ASN1_BIT_STRING **psig,
  18. const X509_ALGOR **palg);
  19. int X509_REQ_get_signature_nid(const X509_REQ *crl);
  20. void X509_CRL_get0_signature(const X509_CRL *crl,
  21. const ASN1_BIT_STRING **psig,
  22. const X509_ALGOR **palg);
  23. int X509_CRL_get_signature_nid(const X509_CRL *crl);
  24. int X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits,
  25. uint32_t *flags);
  26. int X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid,
  27. int *secbits, uint32_t *flags);
  28. void X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid,
  29. int secbits, uint32_t flags);
  30. =head1 DESCRIPTION
  31. X509_get0_signature() sets B<*psig> to the signature of B<x> and B<*palg>
  32. to the signature algorithm of B<x>. The values returned are internal
  33. pointers which B<MUST NOT> be freed up after the call.
  34. X509_set0_signature() and X509_REQ_set1_signature_algo() are the
  35. equivalent setters for the two values of X509_get0_signature().
  36. X509_get0_tbs_sigalg() returns the signature algorithm in the signed
  37. portion of B<x>.
  38. X509_get_signature_nid() returns the NID corresponding to the signature
  39. algorithm of B<x>.
  40. X509_REQ_get0_signature(), X509_REQ_get_signature_nid()
  41. X509_CRL_get0_signature() and X509_CRL_get_signature_nid() perform the
  42. same function for certificate requests and CRLs.
  43. X509_get_signature_info() retrieves information about the signature of
  44. certificate B<x>. The NID of the signing digest is written to B<*mdnid>,
  45. the public key algorithm to B<*pknid>, the effective security bits to
  46. B<*secbits> and flag details to B<*flags>. Any of the parameters can
  47. be set to B<NULL> if the information is not required.
  48. X509_SIG_INFO_get() and X509_SIG_INFO_set() get and set information
  49. about a signature in an B<X509_SIG_INFO> structure. They are only
  50. used by implementations of algorithms which need to set custom
  51. signature information: most applications will never need to call
  52. them.
  53. =head1 NOTES
  54. These functions provide lower level access to signatures in certificates
  55. where an application wishes to analyse or generate a signature in a form
  56. where X509_sign() et al is not appropriate (for example a non standard
  57. or unsupported format).
  58. The security bits returned by X509_get_signature_info() refers to information
  59. available from the certificate signature (such as the signing digest). In some
  60. cases the actual security of the signature is less because the signing
  61. key is less secure: for example a certificate signed using SHA-512 and a
  62. 1024 bit RSA key.
  63. =head1 RETURN VALUES
  64. X509_get_signature_nid(), X509_REQ_get_signature_nid() and
  65. X509_CRL_get_signature_nid() return a NID.
  66. X509_get0_signature(), X509_REQ_get0_signature() and
  67. X509_CRL_get0_signature() do not return values.
  68. X509_get_signature_info() returns 1 if the signature information
  69. returned is valid or 0 if the information is not available (e.g.
  70. unknown algorithms or malformed parameters).
  71. X509_REQ_set1_signature_algo() returns 0 on success; or 1 on an
  72. error (e.g. null ALGO pointer). X509_REQ_set0_signature does
  73. not return an error value.
  74. =head1 SEE ALSO
  75. L<d2i_X509(3)>,
  76. L<ERR_get_error(3)>,
  77. L<X509_CRL_get0_by_serial(3)>,
  78. L<X509_get_ext_d2i(3)>,
  79. L<X509_get_extension_flags(3)>,
  80. L<X509_get_pubkey(3)>,
  81. L<X509_get_subject_name(3)>,
  82. L<X509_get_version(3)>,
  83. L<X509_NAME_add_entry_by_txt(3)>,
  84. L<X509_NAME_ENTRY_get_object(3)>,
  85. L<X509_NAME_get_index_by_NID(3)>,
  86. L<X509_NAME_print_ex(3)>,
  87. L<X509_new(3)>,
  88. L<X509_sign(3)>,
  89. L<X509V3_get_d2i(3)>,
  90. L<X509_verify_cert(3)>
  91. =head1 HISTORY
  92. The
  93. X509_get0_signature() and X509_get_signature_nid() functions were
  94. added in OpenSSL 1.0.2.
  95. The
  96. X509_REQ_get0_signature(), X509_REQ_get_signature_nid(),
  97. X509_CRL_get0_signature() and X509_CRL_get_signature_nid() were
  98. added in OpenSSL 1.1.0.
  99. The X509_REQ_set0_signature() and X509_REQ_set1_signature_algo()
  100. were added in OpenSSL 1.1.1e.
  101. =head1 COPYRIGHT
  102. Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
  103. Licensed under the Apache License 2.0 (the "License"). You may not use
  104. this file except in compliance with the License. You can obtain a copy
  105. in the file LICENSE in the source distribution or at
  106. L<https://www.openssl.org/source/license.html>.
  107. =cut