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