11 PKCS7_ISSUER_AND_SERIAL_digest
12 - get digest of various objects
16 #include <openssl/x509.h>
18 int X509_digest(const X509 *data, const EVP_MD *type, unsigned char *md,
20 ASN1_OCTET_STRING *X509_digest_sig(const X509 *cert,
21 EVP_MD **md_used, int *md_is_fallback);
23 int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, unsigned char *md,
26 int X509_pubkey_digest(const X509 *data, const EVP_MD *type,
27 unsigned char *md, unsigned int *len);
29 int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type,
30 unsigned char *md, unsigned int *len);
32 int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type,
33 unsigned char *md, unsigned int *len);
35 #include <openssl/pkcs7.h>
37 int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,
38 const EVP_MD *type, unsigned char *md,
43 X509_digest_sig() calculates a digest of the given certificate I<cert>
44 using the same hash algorithm as in its signature, if the digest
45 is an integral part of the certificate signature algorithm identifier.
46 Otherwise, a fallback hash algorithm is determined as follows:
47 SHA512 if the signature algorithm is ED25519,
48 SHAKE256 if it is ED448, otherwise SHA256.
49 The output parameters are assigned as follows.
50 Unless I<md_used> is NULL, the hash algorithm used is provided
51 in I<*md_used> and must be freed by the caller (if it is not NULL).
52 Unless I<md_is_fallback> is NULL,
53 the I<*md_is_fallback> is set to 1 if the hash algorithm used is a fallback,
56 X509_pubkey_digest() returns a digest of the DER representation of the public
57 key in the specified X509 I<data> object.
59 All other functions described here return a digest of the DER representation
60 of their entire I<data> objects.
62 The I<type> parameter specifies the digest to
63 be used, such as EVP_sha1(). The I<md> is a pointer to the buffer where the
64 digest will be copied and is assumed to be large enough; the constant
65 B<EVP_MAX_MD_SIZE> is suggested. The I<len> parameter, if not NULL, points
66 to a place where the digest size will be stored.
70 X509_digest_sig() returns an ASN1_OCTET_STRING pointer on success, else NULL.
72 All other functions described here return 1 for success and 0 for failure.
80 The X509_digest_sig() function was added in OpenSSL 3.0.
84 Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
86 Licensed under the Apache License 2.0 (the "License"). You may not use
87 this file except in compliance with the License. You can obtain a copy
88 in the file LICENSE in the source distribution or at
89 L<https://www.openssl.org/source/license.html>.