Search This Blog

Sunday, November 18, 2018

How to generate a key randomly

To generate a key randomly, you can use tools like OpenSSL:

$ openssl rand -hex 32
1f0a1f8dc3cfba7954b498b7bb5ad4246459a50dd918577b94d1aa97d764ab40

To put an OpenSSL-generated key into a key file, you can do the following:

[root@dfdf41f1677a /]# openssl rand -hex 32 >keyfile
[root@dfdf41f1677a /]# cat keyfile
cc942e2b18870d2da0b4c468add53a2a6e4d0dc244f117375c37eafb6565fc1c