I want to create a 128bit AES key made up of specific letters. I think I would need to use something like

openssl genrsa -aes128 -out privkey.pem


openssl genrsa -out privkey.pem

but I'm not sure how to make an AES with a 128bit key made up of specific letters that I choose. Am I thinking of this in the wrong way?

Edit: I wonder if doing something like openssl enc -aes-128-cbc -k secret -P -md sha1 would work

  • 2
    "Am I thinking of this in the wrong way?" - totally. The problem you describe makes no sense from the technical perspective. Apart from that the key is binary, i.e. there is no notion of a "character" at all in this context only. Even if it would it makes no sense to restrict the key this way. You could of course represent any binary data as printable characters with an appropriate encoding like base64 or hex, but that's just a representation and does not change the actual key. – Steffen Ullrich Apr 4 '19 at 4:19
  • The problem is to use AES with a 128 bit key which is made up of two letters repeated 8 times. Then using that AES to encrypt a file. I'm not sure how I can make an AES key that is made up of two characters repeated 8 times. It just doesnt make sense to me because AES makes a random one. – my code made me suicidal Apr 4 '19 at 4:21
  • 1
    Please know that you should not use OpenSSL as a general-purpose encryption utility. It is insecure for those purposes and only exists to allow you to test the underlying OpenSSL library functionality. – forest Apr 4 '19 at 4:23
  • @SteffenUllrich I think it might make sense, depending on what he was doing - for instance, 4chan has a "tripcode" option that allows the user to enter a password after their username which is then encrypted and displayed after their username as a way of authenticating their identity on an otherwise-anonymous forum, and deliberately engineering a particular tripcode could be useful if you want to encode a particular message into it. – nick012000 Apr 4 '19 at 4:28
  • 2
    "The problem is to use AES with a 128 bit key which is made up of two letters repeated 8 times. " - again, the key is binary. There is no such thing as "letters" in the key. But if you want to use a specific key you've created you can just use the -K option (uppercase K, this is different from -k password you are using) to make openssl enc use exactly this key. See the documentation for the details. – Steffen Ullrich Apr 4 '19 at 4:29