I am generating a key & iv with Ruby's OpenSSL wrapper for an AES CBC 256 setup:
cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc') key = cipher.random_key iv = cipher.random_iv
I am then storing the generated key / iv in blob columns in the database. When trying to display the key or iv it looks something similar to this:
My question is:
should the key & iv which seem to be random bytes be converted to hex with an SHA function before using and storing into the DB?
Is it safer this way for storage / use or can they be used just as they are generated in byte form?
Looks like I was mistaken on my terminology and use of SHA.
Revised question: Is a random byte key from OpenSSL just as random and secure if I convert it to hex via unpack('H*')
Any help is appreciated.