Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent of Unix c_rehash command/script on Linux?

I am following the instructions on how to import a certificate with its whole chain into a keystore. The problem I face is that I do not have c_rehash on my system:

user@hostanme$ c_rehash ./certs
-bash: c_rehash: command not found

I have found the -subject_hash option of openssl x509, but I am not sure how to use it to replicate whatever c_rehash does.

How can I hash the certificate directory without the c_rehash command/script?

like image 455
Wojtek Avatar asked Sep 17 '14 11:09

Wojtek


People also ask

What is C_rehash script?

The c_rehash script uses the openssl program to compute the hashes and fingerprints. If not found in the user's PATH, then set the OPENSSL environment variable to the full pathname.

What does openssl rehash do?

openssl rehash scans directories and calculates a hash value of each . pem, . crt, .

What is C_rehash in Linux?

DESCRIPTION. c_rehash scans directories and calculates a hash value of each ". pem" file in the specified directory list and creates symbolic links for each file, where the name of the link is the hash value.


1 Answers

c_rehash needs "perl" for execution. If you can not run c_rehase, try below.

use "openssl" in the Shell file

for file in *.pem; do ln -s "$file" "$(openssl x509 -hash -noout -in "$file")".0; done
like image 173
agfe2 Avatar answered Nov 04 '22 20:11

agfe2