OPENSSL-REHASH(1ossl)
π« NAME π«
ok so this is the manual page for openssl-rehash and c_rehash (it's OPENSSL-REHASH(1ossl), section 1ossl, bestie) β and what they do is literally create symbolic links to files named by the hash values. that's the whole vibe β¨
π SYNOPSIS π
openssl rehash [-h] [-help] [-old] [-compat] [-n] [-v] [-provider name]
[-provider-path path] [-provparam [name:]key=value] [-propquery propq]
[directory] ...
c_rehash [-h] [-help] [-old] [-n] [-v] [-provider name] [-provider-path
path] [-provparam [name:]key=value] [-propquery propq] [directory] ...
like, yes, that's a lot of brackets. breathe. we'll get there π
πΈ DESCRIPTION πΈ
okay so this command is generally equivalent to the external script c_rehash, except for minor differences that are noted below. minor. noted. moving on π«Ά
openssl rehash scans directories and calculates a hash value of each .pem, .crt, .cer, or .crl file in the specified directory list, and then creates symbolic links for each file β where the name of the link is the hash value. (and if your platform doesn't support symbolic links? no stress, it just makes a copy instead π
)
this is genuinely so useful because so many programs that use OpenSSL require directories to be set up exactly like this in order to find certificates. like they will simply not find them otherwise. it's giving "the directory has to look right or nothing works" π
if any directories are named on the command line, then those get processed in turn. if not, then the SSL_CERT_DIR environment variable gets consulted β and that should be a colon-separated list of directories (or semicolon-separated on Windows, iykyk), like the PATH variable. and if that isn't set either, then the default directory gets processed (it's installation-specific but often /usr/local/ssl/certs).
β οΈ heads up bestie: for a directory to be processed, the user must have write permissions on that directory. otherwise an error will be generated. no write perms, no links. periodt.
the links created are of the form HHHHHHHH.D, where each H is a hexadecimal character and D is a single decimal digit. and here's the spicy part πΆοΈ β when a directory is processed, all links in it that have a name in that syntax are first removed, even if they're being used for some other purpose. yeah. even then. to skip the removal step, use the -n flag. hashes for CRL's look similar except the letter r appears after the period, like this: HHHHHHHH.rD.
multiple objects may have the same hash β they'll be indicated by incrementing the D value. duplicates are found by comparing the full SHA-1 fingerprint. a warning will be displayed if a duplicate is found π
a warning will also be displayed if there are files that cannot be parsed as either a certificate or a CRL, or if more than one such object appears in the file. so like, messy files get called out. respectfully.
π§ Script Configuration π§
the c_rehash script uses the openssl program to compute the hashes and fingerprints. if it's not found in the user's PATH, then set the OPENSSL environment variable to the full pathname. any program can be used, actually β it will be invoked as follows for either a certificate or CRL:
$OPENSSL x509 -hash -fingerprint -noout -in FILENAME
$OPENSSL crl -hash -fingerprint -noout -in FILENAME
where FILENAME is the filename. it must output the hash of the file on the first line, and the fingerprint on the second, optionally prefixed with some text and an equals sign. that's the contract, bestie. honor it π€
β¨ OPTIONS β¨
-help,-hβ display a brief usage message. cute little reminder of how to use it π-oldβ use old-style hashing (MD5, as opposed toSHA-1) for generating links to be used for releases before1.0.0. note that current versions will not use the old style. it's a legacy thing, bestie, we don't judge π«Ά-nβ do not remove existing links. this is needed when keeping new and old-style links in the same directory. like coexisting. iconic.-compatβ generate links for both old-style (MD5) and new-style (SHA1) hashing. this allows releases before1.0.0to use these links along-side newer releases. everyone's invited to the party π-vβ print messages about old links removed and new links created. by default, this command only lists each directory as it is processed. so-vis the yapper mode π¬-provider name,-provider-path path,-provparam [name:]key=value,-propquery propqβ see "Provider Options" inopenssl(1),provider(7), andproperty(7). the lore is over there π
π ENVIRONMENT π
OPENSSLβ the path to an executable to use to generate hashes and fingerprints (see above). πSSL_CERT_DIRβ colon separated list of directories to operate on. ignored if directories are listed on the command line. command line wins, always π
π¦ SEE ALSO π¦
openssl(1), openssl-crl(1), openssl-x509(1)
π COPYRIGHT π
Copyright 2015-2026 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie π this one's from 3.5.9, dated 2026-09-29 β OPENSSL-REHASH(1ossl), slay, go set up your cert directories πβ¨
π¦ where this page comes from
- alpine 3.23: openssl-doc 3.5.9-r0 Β· Apache-2.0
- alpine 3.24: openssl-doc 3.5.9-r0 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms