I've looked in many places (NIST, text books, online resources) and I cannot find an answer to the definition of the term "key" from a semantic point of view.

Is it the "key" to cipher-texts (i.e. like a door key to lock/unlock), or is the the "key" to the algorithm (i.e. a crucial factor to make it work, like a keystone)?

I was taught that it was the latter, but I cannot find proof either way. I can understand if the difference is too minor to discuss, but I was wondering if the original intent of the term is known.


To further clarify how I understand the semantics: because the key is required for the algorithm to function at all, the key is 'meant' for the algorithm (e.g. a keystone for an arch or a punch card for a IBM computer) the term 'key' is meant as an enabler for a process, not as a lock/unlocker for a secret. This is especially true because cryptographic keys can be used for algorithms that do not 'hide' or 'protect' data.

  • $\begingroup$ Keys can be used to decrypt multiple ciphertexts. $\endgroup$
    – yyyyyyy
    Commented May 1, 2015 at 9:13
  • $\begingroup$ @yyyyyyy edited to generalize the key/ciphertext relationship $\endgroup$
    – schroeder
    Commented May 1, 2015 at 17:16
  • 1
    $\begingroup$ Exactly why I wanted to confirm my understanding and challenge my own education on the matter. It is understandable that people would gravitate to the analogy of the key/lock analogy in terms of secrets, but I question if this analogy is precise. $\endgroup$
    – schroeder
    Commented May 1, 2015 at 17:22
  • 2
    $\begingroup$ A cipher still works when you use the wrong key - it will just return garbage but it will output. I don't see the keystone analogy in that sense. Usually the key is compared with a key to a padlock locking an opaque box. Unless you have a mobile home it is tricky to send a room anywhere. $\endgroup$
    – Maarten Bodewes
    Commented May 1, 2015 at 21:53
  • 1
    $\begingroup$ Note that a key (in the sense of "thing used to open a lock") is also a key (in the sense of "essential to make something work"). Without a matching key, a lock is little more than a useless lump of metal. $\endgroup$ Commented May 9, 2015 at 11:32

4 Answers 4


In the context of encryption schemes, the key is whatever piece of information the legitimate recipient of an encrypted message possesses, which allows him to decrypt the ciphertext efficiently. Hence, the key must be kept hidden from an attacker, since otherwise the attacker could decrypt efficiently just as the legitimate recipent does.

  • $\begingroup$ I understand the function of the key (and the importance to keep it secret). But this does not address the semantics of the term. $\endgroup$
    – schroeder
    Commented May 1, 2015 at 5:00
  • $\begingroup$ Then I have no idea what your question is about, so I vote to close as "unclear what you're asking". $\endgroup$
    – fkraiem
    Commented May 1, 2015 at 5:02
  • $\begingroup$ I am new to this community, and you are free to manage my question as appropriate. My question is not a technical one, but more of a "history of the meaning" of an oft used cryptographic word. $\endgroup$
    – schroeder
    Commented May 1, 2015 at 5:09
  • 1
    $\begingroup$ It's effectively like a key to a lock. The key is used to encrypt or decrypt, just as a physical key is used to lock or unlock something. I believe the term comes from that, though I'm not certain. I've never seen the keystone comparison/etymology. $\endgroup$ Commented May 1, 2015 at 5:46

Most ciphers — both classical and modern — will work just fine with any key. It's just that, if the key used to dechipher the message does not match1 the key used to encipher it, the output will be essentially nonsense, and the actual intended message will not be revealed.

(Some encryption systems may then detect that the decrypted text is nonsense, often as a side effect of a message integrity check, and may abort with an error indicator instead of returning garbage. But this is strictly secondary to the fundamental operation of the cipher.)

Thus, it's not really correct to say that the key is something "required for the algorithm to function at all" — the algorithm functions just fine with any key (and it's typically easy to make up arbitrary keys), it just functions differently depending on the key.

Indeed, historically, it's pretty clear that the original sense of "key" in cryptography comes from the meaning of "something that permits entrance or access". For example, here's an early quote from Leon Battista Alberti's treatise De componendis cifris (c. 1466), describing the Alberti cipher:

"His peractis inter nos constituetur quem esse indicem velimus; nam index quidem veluti clavis quaedam est qua in penetralia sacrorum intima ingressus pateat. Atqui index ipse duplex est; nam alter est qui ex maiusculis stabilibus litteris constituitur, alter qui ex minusculis mobilibus litteris constituitur, uterque ad arbitrium."

My Latin, alas, is pretty awful, but here's a crude translation I managed to piece together with the help of a dictionary and Google Translate. Improvements and corrections are welcome:

"Having done this, we must choose the index [cipher alphabet]; for this index is indeed like a key that opens the entrance to the innermost sacred shrine. But the index itself is twofold; one part consists of the static majuscule letters, the other of the movable minuscule letters, both of them freely choosable."

This is, in fact, the only place where the word "key" (clavis) appears in the text. It should be clear, even from my clumsy translation, that this somewhat poetic allusion is indeed to a key for opening doors, not to a keystone.

Of course, nowadays this issue is somewhat confused by the introduction of cryptographic tools other than ciphers; in modern cryptography, a key might not be used (only) for encryption and decryption, but also e.g. for signing or authenticating messages.

Yet (even though one might view it as just a terminological coincidence) the same metaphor, properly understood, still works: a key, in modern cryptography, is something that controls access, and the possession of which grants one the ability to do something that should be restricted only to certain individuals — be it decrypting a secret message, signing a document in someone's name, or being granted access to a computer system.

(The metaphor does break down somewhat for public-key cryptography; indeed, I would almost consider the phrase "public key" a contradiction in terms, since everywhere else in cryptography, a "key" is something to be kept secret. Still, it is an established part of modern crypto terminology, and, for want of a better term, it persists.)

See also:

1) For classical ciphers, and for modern symmetric ciphers, the keys need to be effectively identical. For asymmetric (public-key) ciphers, the two halves of the key pair need to have the appropriate mathematical relationship. For example, for RSA, the public and private keys consist of a modulus and an exponent; for decryption to succeed, the moduli need to be identical, and the exponents need to be modular inverses of each other.


fkraiem's definition is too narrow. $\:$ "In the context of encryption schemes," keys are

"whatever piece of information the legitimate recipient of an encrypted
message possesses, which allows him to decrypt the ciphertext"


any information related to keys of the type mentioned above,
which allows its possessor to encrypt the plaintext


  • $\begingroup$ So, both the key and the metadata of the key? $\endgroup$
    – schroeder
    Commented May 1, 2015 at 5:27
  • $\begingroup$ No, both secret keys and private keys and public keys. $\;$ $\endgroup$
    – user991
    Commented May 1, 2015 at 6:03

I personally have always seen a key used for encryption as a key used in a door, I never compared it to a keystone. But i think it is fair to compare it to a key with which you open a door. Since a key in cryptographic sense give you access to data or even to complete systems.

Further more a keystone in the sense that a key is needed to make it work is not necessarily true, Hash functions don't use a key, though of course that's not necessarily 'encryption' but it is cryptography.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.