I am a software developer interested in developing an application with cryptography. I can explain what I want to accomplish, but I do not know the technical terms for the cryptographic functions I am seeking. Many Google searches have not helped me. Could someone please help me with the proper cryptographic terms for what I am seeking, so I know what to search for in my research?

Here is what I am looking for:

  • Encrypt large amounts of data quickly with key $E$.
  • Encryption is currently unbreakable and is expected to remain so as far as is known.
  • The encrypted data cannot be decrypted with key $E$.
  • The encrypted data can only be decrypted with key $D$.
  • Key $E$ is created by passing key $D$ into an algorithm/function.
  • It is preferred that key $D$ can be less than 20 characters and can be typed from what is visible on the keys of an ordinary computer keyboard. (AKA...a password)

Thank you!

  • 4
    $\begingroup$ The term you are looking for is public-key encryption. $\endgroup$
    – yyyyyyy
    Mar 19 '19 at 1:01
  • $\begingroup$ @yyyyyyy So "public-key encryption" is considered "unbreakable" even when used with a private key of less than 20 characters that can be typed from what is visible on the keys of an ordinary computer keyboard? $\endgroup$ Mar 19 '19 at 1:23
  • 3
    $\begingroup$ with deterministic key pair generation. There are several Q/A's about that. Crypto is knowing the terms :) You can create a reasonable strong password using 20 characters. If you feed that into a PBKDF then you can create a reasonably strong secret, which you can use as input to a well defined pseudo random number generator or stream cipher or XOF, and then use that to drive a key pair generator, e.g. one for EC cryptography. Then you could use e.g. ECIES to encrypt your plaintext. $\endgroup$
    – Maarten Bodewes
    Mar 19 '19 at 1:23
  • $\begingroup$ @MaartenBodewes Yes sir! Knowing the terms is the problem I had...but thanks to you I have another term "deterministic key pair generation" -- never even heard of it before now. Thank you. $\endgroup$ Mar 19 '19 at 1:27
  • $\begingroup$ If there is an algorithm to turn $E$ into $D$ and then you can decrypt with $D$, that gives you a way to decrypt with $E$. Do you mean either 1) it's $D$ that can be turned into $E$, or 2) you generate $D$ and $E$ at the same time? $\endgroup$
    – poncho
    Mar 19 '19 at 2:08

As correctly pointed out in the comments: The term is asymmetric cryptography, also known as public-key cryptography.

How do we know that it's asymmetric encryption?

In symmetric encryption the encryption key and decryption key are identical, meaning you can decrypt data with the same key that it has been encrypted with.

On the other hand, in asymmetric encryption the encryption key and decryption key are different from one another ($K_{Enc} \ne K_{Dec}$) and in your example it's stated:

The encrypted data cannot be decrypted with key $E$.

How to create $E$ from $D$

This can be achieved with the following procedure:

  1. Create a key $K$ with a key derivation function by using your password. You can think of this function as a key-stretching-function. KDFs can be used to stretch keys into longer keys or to obtain keys of a required format. This is important to get an input which is "random enough" for step 2.

    • PBKDF2 is a noteworthy here. To increase the difficulty of a potential attack a cryptographic salt is added to the password.
  2. You can now use this created key $K$ as a seed for a PRNG (pseudo random number generator). Important here is the word pseudo, which means that given the same seed it will always return the same created number.

  3. The PRNG is used for a key-pair-generation-algorithm, which then returns the public-key $K_{Public}$ (in your example $E$ for encryption) and the private-key $K_{Private}$ (in your example $D$ for decryption).

  4. You can now use this generated keys for any asymmetric cryptography methods, some well known examples are:

Important: I left out that you would have to use different key-pair-generation-algorithms, depending on which asymmetric cryptographic scheme you would use.

This procedure would work theoretically, but is very expensive from a computational view as you're only using asymmetric encryption. In practice this problem is solved by implementing a hybrid cryptosystem:

A hybrid cryptosystem is one which combines the convenience of a public-key cryptosystem with the efficiency of a symmetric-key cryptosystem.

A noteworthy example of this would be ECIES (Elliptic Curve Integrated Encryption Scheme), where the security is based on the Diffie–Hellman problem. This scheme allows two parties to create a (random) session key, which allows symmetric encryption.

  • 3
    $\begingroup$ As encryption is meant, it is probably best to include ECIES and a symmetric cipher + mode to create a hybrid cryptosystem. Some notes about e.g. (not using a) salt and symmetric key reuse would polish it. $\endgroup$
    – Maarten Bodewes
    Mar 19 '19 at 9:35
  • $\begingroup$ Thank you for the answer and explanation! Your suggestion of using a "hybrid cryptosystem" is greatly appreciated. When you say asymmetric encryption is "very expensive from a computational view" do you mean that compared to other encryption methods it would take longer to do the actual encrypting of the data? $\endgroup$ Mar 19 '19 at 12:04
  • 1
    $\begingroup$ @JoeGayetty Yes, most asymmetric encryption methods take longer, but there are other factors to consider as well, i.e. RSA can only encrypt data blocks that are shorter than the key length, so you can't really encrypt a lot of data with one key. Have a look at this question, it explains it quite well. $\endgroup$ Mar 19 '19 at 12:19
  • $\begingroup$ @AleksanderRas Thank you for the info and link, I will take a look at it. $\endgroup$ Mar 19 '19 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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