0

Instead of generating keys, is it possible to type your own? For example, could all the characters be A's for example sake. Or do they have to be generated because they are based off of prime numbers or because it would be to hard to create a matching public key as well?

1
  • 2
    May have better luck at crypto.stackexchange.com
    – HashHazard
    Commented Sep 22, 2016 at 17:27

2 Answers 2

6

For RSA there are special requirements on how to formulate a key. Primarily (pun not intended) you need the p and q values, which are large primes.

There are, however, schemes (see here and here) which can be used to deterministically generate asymmetric key material from a passphrase.

The easiest way to achieve such a goal is to take a known-secure PRNG design, then seed it only with data derived from the passphrase (e.g. bits from a PBKDF2 or scrypt hash), then use it in your RSA key generation when picking the p and q primes (this is quite well described in the RSA wikipedia article). This ensures that, given the same passphrase, the same random number sequence is always produced during key generation, leading to deterministic keys.

However, there are certain security drawbacks, primarily around key complexity and memorisation issues compared to the comparative entropy of more traditionally random key generation.

0

What I do is run the key through SHA256 which gives me a 256 bit string. Then use it as the key.

This way the key is directly derived from a passphrase, but random enough that one will not succeed using statistical attacks based on the passphrase language.

1
  • 1
    If you look at the tags in the question, OP is specifically asking about public key cryptography. You cannot generate a key in the way that you described for RSA (one of the tags).
    – d0nut
    Commented Sep 23, 2016 at 18:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .