Asked 11 years, 9 months ago
Viewed 146k times
Closed.This question is
off-topic. It is not currently accepting answers.
This question does not appear to be about Information security within the scope defined in the help center.
Closed 11 years ago.
How long is the encryption/decryption key for an assymetric algorithm, such as AES? If I use AES 128-bit, how many characters should I type in for my key? What about AES 256-bit?
Edit: Here is why I am asking: I am trying to use OpenSSL to encrypt some data using Node.js, PHP and command-line. I need to give in the key. When I tried 32 letter-key for AES128, it returned key length error. When I tried 32 for AES256 it returned general key error. I have no idea how I am supposed to enter the encryption key...
asked Nov 11, 2013 at 23:10
XeosXeos50411 gold badge44 silver badges1111 bronze badges
2An AES 128-bit key can be expressed as a hexadecimal string with 32 characters. It will require 24 characters in base64.
An AES 256-bit key can be expressed as a hexadecimal string with 64 characters. It will require 44 characters in base64.
answered Nov 12, 2013 at 6:15
John WuJohn Wu9,45122 gold badges3131 silver badges4040 bronze badges
1Encryption keys for AES are not expressed in characters or letters. Encryption keys are a series of 128 (or 256) bits.
If you are using some kind of interface to enter a text-based password, internally it is turning your typed password into bits. It may be using a complex routine like PBKDF2, or a single iteration of SHA-1.
In that case, you need to understand the unpredictability of someone guessing your password, instead of thinking of a minimum number of characters. Much has been written on the topic. I suggest you google for "correct horse battery staple" for an excellent primer on the topic.
answered Nov 12, 2013 at 6:11
John DetersJohn Deters34.9k33 gold badges6565 silver badges117117 bronze badges
For a 128-bit key:
8-bits per character raw (base-256, i.e. where a character can take any byte value)
6-bits per character base-64 encoded
answered Nov 11, 2013 at 23:27
tylerltylerl83.9k2727 gold badges156156 silver badges234234 bronze badges
Start asking to get answers
Find the answer to your question by asking.
Ask questionExplore related questions
See similar questions with these tags.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4