x5 is a tool for working with the sorts of cryptographic objects and files that are commonly used for TLS/SSL.
It provides a command line interface for reading certificates, keys & keystores and processing them in various ways.
The functionality overlaps with some of the ways that the openssl commandline tool might be used.
Check the releases page on GitHub
Read a PEM file (of any type) and write details to the console:
x5 'read file.pem | info'
Read a PKCS#12 keystore and write full details of each pair:
x5 'read keystore.p12 | each ( .value | each ( info ) )'
The above command requires some explanation.
The design of x5 is that there is a single command (x5) with a rich expression language that allows the user to dig into the contents of any cryptographic object and treat them in consistent ways.
Thus, there is no "keystore" or "pkcs12" command, there is just "read" and process.
The command above says:
readthekeystore.p12file (and sniff its content type)- pipe (
|) the result of reading that file into theeachfunction.eachcan be applied to anything that is a sequence, and a keystore is a sequence of "entries" (a name+value pair), so the argument toeachwill be a "store entry" - For
eachstore entry, we get thevalueproperty (using the.operator). In this case the value is a key-pair (a certificate and private key). - For
eachelement in the key pair (that is the private key and the public certifiacte) we print out the object'sinfo