Scroll to navigation

X509_NAME_HASH(3) Library Functions Manual X509_NAME_HASH(3)

NAME

X509_NAME_hash, X509_issuer_name_hash, X509_subject_name_hash, X509_NAME_hash_old, X509_issuer_name_hash_old, X509_subject_name_hash_oldcalculate SHA-1 or MD5 hashes of X.501 Name objects

SYNOPSIS

#include <openssl/x509.h>

unsigned long
X509_NAME_hash(X509_NAME *name);

unsigned long
X509_issuer_name_hash(X509 *x);

unsigned long
X509_subject_name_hash(X509 *x);

unsigned long
X509_NAME_hash_old(X509_NAME *name);

unsigned long
X509_issuer_name_hash_old(X509 *x);

unsigned long
X509_subject_name_hash_old(X509 *x);

DESCRIPTION

() calculates an SHA1(3) hash of the DER-encoded form of name. It is for example used by X509_LOOKUP_hash_dir(3) to locate certificate files in the file system.

() and () are wrappers to calculate this hash of the issuer or subject name of x, respectively.

(), (), and () are variants that use MD5 instead of SHA-1.

RETURN VALUES

These functions return the hash value or 0 if an error occurs.

SEE ALSO

i2d_X509_NAME(3), X509_get_subject_name(3), X509_LOOKUP_new(3), X509_NAME_digest(3), X509_NAME_new(3)

HISTORY

X509_subject_name_hash() first appeared in SSLeay 0.4.0, X509_issuer_name_hash() in SSLeay 0.5.1, and X509_NAME_hash() in SSLeay 0.8.0. They were switched to hashing the DER representation of the name rather than an ASCII rendering in SSLeay 0.9.0 and have all been available since OpenBSD 2.4.

They were switched to using SHA1 instead of MD5 in OpenSSL 1.0.0 and in OpenBSD 4.9.

X509_NAME_hash_old(), X509_issuer_name_hash_old(), and X509_subject_name_hash_old() first appeared in OpenSSL 1.0.0 and have been available since OpenBSD 4.9.

July 31, 2021 Linux 6.4.0-150600.23.25-default