Talk:RSA (cryptosystem)

From Wikipedia, the free encyclopedia
  (Redirected from Talk:RSA (algorithm))
Jump to: navigation, search
Wikipedia Version 1.0 Editorial Team
WikiProject icon This article has been reviewed by the Version 1.0 Editorial Team.
Taskforce icon
This article does not currently meet the quality requirements for the Version 0.7 offline release. It is not currently being considered for later releases, as outlined in the notes left here. Please help improve this article if you can, and renominate after improvements have been made.
 
B-Class article B  This article has been rated as B-Class on the quality scale.
WikiProject Cryptography / Computer science  (Rated C-class, Top-importance)
WikiProject icon This article is within the scope of WikiProject Cryptography, a collaborative effort to improve the coverage of Cryptography on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
C-Class article C  This article has been rated as C-Class on the quality scale.
 Top  This article has been rated as Top-importance on the importance scale.
Taskforce icon
This article is supported by WikiProject Computer science (marked as Top-importance).
 
edit·history·watch·refresh Stock post message.svg To-do list for RSA (cryptosystem):

To-do list is empty: remove {{To do}} tag or click on edit to add an item.



Contents

What is greatest common denominator?[edit]

Is is the same as greatest common divisor? gcd(n,m)? — Preceding unsigned comment added by 156.17.236.67 (talk) 14:07, 6 January 2012 (UTC)

EQUATIONS USING MODULI[edit]

Equations involving mod operations seem to be written in the wrong order. On this account I was not able to understand the simple operation even though it should have been easy. The first example is as follows:

d*e = 1 mod( phi )

Surely you mean:

d*e mod( phi ) = 1

Don't you? Or am I missing something?

1 mod( anything ) = 1 doesn't it?

It's an unfortunate mathematical convention that "mod" applies to everything to the left of it. You could think of it as a very low precedence operator, or like a parenthetical remark, as in "four is equal to eight (if we reduce them both modulo two)". Lunkwill 20:46, 24 November 2005 (UTC)
Even so, if they mean the same thing (which I think Lunkwill is saying), wouldn't it be clearer to write it as suggested? At least the original questioner and I both did not know this "unfortunate fact," and avoiding the confusion in the first place seems preferable to explaining it afterwards. Jackrepenning (talk) 21:47, 14 January 2008 (UTC)
No, it is much better to follow the accepted notation.   Maybe we could add a sentence describing in words what the symbols say to make it more clear, but the RSA page doesn't need to be explaining modular arithmetic. Astgtciv (talk) 11:40, 16 January 2008 (EST) —Preceding unsigned comment added by 143.215.153.95 (talk)

Well, that is an unfortunate convention. I am glad that you explained that. To clarify, I guess that you are saying that: (II) x=y mod(a) is the same thing as: (I) x%a = y%a ... if I may steal that modulus symbol from C. But in your notation, how do you write (II) y = x%a , where y is the unknown???? What I mean is that in equation (I), if x = 8 and a = 5, then y has to be a member of {3,8,13,18,.........}. But in equation (II), there is only one solution for y, 3. right?

If all you care about is finding out if two numbers are at the same point in a cycle given that a cycle has a certain length, that makes sense, you are qualifying in which way they are equivalent.

But there is no way of asking, using that notation, what is the most basic way to represent that point in that cycle of that given length. Or is there?

This doesn't have much to do with the subject of this page. But Lunkwill seems to know a little about this. So I just thought I would ask.

Response from Anonomous -> Keep in mind that the reasoning behind the convention is that you are doing arithmetic in a finite field, i.e. you only have a subset of the integer numbers to work with (a FINITE field of integer numbers) designated as Z sub N (where N is the number of integer elements, ex. Z sub 7 is Z sub inf. mod 7 thus => [0,6] inclusive). Therefore, anytime any particular operation is done, if the resultant number is "outside" the field, it is mod'ed down to get back into the field (this is rather a harsh explanation, but is an easy way to see it at first). So for instance, saying x [is congruent to] y (mod a) can be directly viewed as x = y + k * a for some value of k (y is a multiple of k * a which equals x). Keep in mind that a congruence and an equality are two different things. For ex, say that you have something silly like 11 [is congruent to] 1 (mod 10), this makes sense since 11 = 1 + [1] * 10, 11 is outside of the finite field of Z sub 10. The calculator notation is in fact mod(11, 10) (for TI-89) or 11 % 10 (for C/C++/Java/etc.), but that is just by notation of an operator (from a comp. sci. point of view), not modular arithmetic (from a mathematical point of view). Keep in mind that the reason for doing modulus in the first place, again, is for staying inside of the field. A really good example of this is modular exponentiation, where we have, say, some number a raised to some ridiculously large power b (which RSA does with its e and d components) but while doing it mod some normal value of n (ex. say something rhetorically stupid as 2^1234567890 (mod 3)). Would you really compute this by doing a^b and then mod'ing by n? No, you would overflow 64-bit integers within a few iterations of pow(). All you need to do is take it one step at a time maintaining the field (in fact if you do it the intelligent way you can do it in O(log n) if you use successive squaring). So, I think what you're missing is, why is the notation not like one would do it on a calculator? Because, simply, having a (mod n) at the far right hand side (and only once) isn't an operation per-sey, it is literally meaning working with integers of a finite field, which is a convenient way to work with moduluar arithmetic, (mod n). Hope this helps.

the question is answered, but I'll add that confusion seems to come from computer types who see mod(phi) as an operator changing the value of 1, but you'd be closer to the truth if you see it as an operator changing the meaning of the '=' —Preceding unsigned comment added by 131.172.99.15 (talk) 08:10, 14 August 2008 (UTC)

No, this is clearly wrong and only adds to the confusion. One simply has to distinguish between congruence relations (see modular arithmetic) and the modulo operation, which have similar but not equal notation. Congruence relations use an equivalence symbol, e.g. 27\equiv 17 \pmod{10} (Note, the three strokes in \equiv). This notation means that both sides reduced modulo 10 are the same (or more precise that the difference is a multiple of 10). The meaning of the '=' sign is never changed and  a = b \mod c always denotes a modulo operation that only involves the arguments b and c. Hence, it is wrong to write 7=2 \mod 5 and as the OP notes it would be equally wrong to write d*e = 1 \mod( phi ). But fortunately the RSA article does use correct notation. 85.2.20.48 (talk) 08:19, 16 August 2008 (UTC)

Destroying P and Q[edit]

Will people please stop saying that good implementations destroy P and Q. In fact, good implementations keep P and Q, and never calculate D at all; they use the Chinese Remainder Theorem to speed up private key operations, and calculate a separate D for P and Q. Furthermore, it has long been known that P and Q are easily determined given N, E, and D. So there is no point to this misleading advice. ciphergoth 19:54, 2004 Nov 30 (UTC)

To Featured Article standard?[edit]

Would anyone be interested in working this article up to "Featured Article" standard? What would it need? I guess some sort of diagram or illustration is usually asked for, and references. — Matt 17:45, 30 Nov 2004 (UTC)

The most important thing would be a proper treatment of padding and security for encryption and signing - without them, it's positively misleading. ciphergoth 19:54, 2004 Nov 30 (UTC)

Proof[edit]

Should we be including a proof of RSA in this section? Revived 22:31, 28 Dec 2004 (UTC)

What do you mean by a "proof of RSA"? Do you mean a proof that decryption "works"? If so, no; TBH I'd rather move away from presenting the idea of a "decryption exponent" at all, in favour of directly using the Chinese Remainder Theorem to do decryption. This would be easier to understand, closer to what is really done in practice, and gets rid of the misleading idea that the public and secret key operations are somehow 'symmetric' when for all practical purposes they aren't. Hopefully it would discourage people from saying misleading things like "signing is encryption with the private key".
If on the other hand you mean a proof that RSA is secure, there is no such proof. — ciphergoth 12:15, 2004 Dec 29 (UTC)

Earlier Work[edit]

Pohlig and Hellman[edit]

The history section of the article gives the impression that Rivest, Shamir and Adleman invented the algorithm out of thin air although very similar work had actually been published shortly before by others. For example: Stephen C. Pohlig and Martin E. Hellman, An Improved Algorithm for Computing Logarithms over GF(p) and its Cryptographic Significance, IEEE TRANSACTIONS ON INFORMATION THEORY (Jan. 1978) (article submitted on June 17, 1976). Unfortunately I don't have easy access to this article - I've only found it referenced on http://www.cyberlaw.com/rsa.html.

Can we cite a source showing that Rivest, Shamir and Adleman were influenced by (or are believed to have been influenced by) Pohlig and Hellman's work? (RSA was published as an MIT tech report in April 1977, before Pohlig-Hellman's pub in Jan 1978).— Matt Crypto 18:44, 14 Mar 2005 (UTC)

At the NSA[edit]

The recently declassified A History of U.S. Communications Security (Volumes I and II); the David G. Boak Lectures, National Security Agency, 1973 (declassified December 2008) mentions in volume 2 an algorithm that is not fully described but is clearly similar to RSA. The document implies that it's only useful for encryption, not signature, though. A closer reading might indicate how much the NSA knew about PKC when RSA's work was published. Volume 2 seems to date from 1981. 209.221.140.12 (talk) 11:15, 29 December 2008 (UTC) In view of the close links between GCHQ and NSA, it would be surprising if NSA did not know about Clifford Cocks's work long before its public disclosure.109.158.245.62 (talk) 23:09, 2 April 2012 (UTC)

how large shoude p and q be?[edit]

how large shoude be p and q? can you give me some real public key?

For an l-bit modulus n=pq, the lengths of p and q would need to add up to about l. So 512-bit p and q would give you an n around 1024 bits long. I generated a real key just for you and created a sub-article about it under the "working example" part of the main article. Lunkwill 4 July 2005 23:15 (UTC)

p and q should be approximately the same size which means they should be half the size of the modulus you want. Common RSA modulus sizes are 1024 bit, 2048 bit and 4096 bit. So for a 1024 bit modulus you would be looking at 512 bit p and q, for a 2048 bit modulus you would be looking at 1024 bit p and q and for a 4096 bit modulus you would be looking at a 2048 bit p ang q.
768 bit moduluses are known to be feasible to factor (see RSA numbers). AIUI noone has publically demonstrated factoring a 1024 bit modulus yet but they are generally regarded as "at risk" and should not be used for new keys. 2048 bit seems to be the default for new keys at the moment at least in GPG. 4096 bit is typically used by users looking for a larger margin of safety.

A comment on variables[edit]

Every article I've ever seen on RSA uses n as a public modulus. Why the heck are we using n to be the message integer here? That's really confusing, especially since N is the modulus. Should we fix this, or am I wrong about the conventional variables? Birge 02:19, 16 August 2005 (UTC)

Yeah, I'd prefer the message to be written as m. — Matt Crypto 08:09, 16 August 2005 (UTC)
I second this, and made the change throughout the article. M is now the un-padded plaintext, and m is the padded value to be encrypted. Hope I didn't miss any... Dachshund 17:18, 16 August 2005 (UTC)

What does this mean ?[edit]

I think more information is needed about \phi(n) = (p-1)(q-1). What does this mean ? Take the 2 primes, decrease them by 1,multiply them with each other, but then ? Save the result in empty set number 'n' ? How can a empty set contain something ? --Garo 21:52, 17 August 2005 (UTC)

That's a phi, not an empty set. In this case, it is simply a new function which we have defined over the domain of all integers n which are the product of two large primes. It is, in effect, a convenient notation for (p-1)(q-1). Aerion//talk 23:20, 17 August 2005 (UTC)
Small correction: phi(n) is the Euler totient function and it is defined over all integers. It is the number of integers less than n which are coprime to n. Should I mention this in the article where phi(n) first appears? Birge 06:26, 18 August 2005 (UTC)

Question for a reader[edit]

A Wikipedia reader has asked the following question at the Wikipedia Help Desk.

Where m is the plaintext in this case m=123.Shouldn't m be less than or equal to the least of (p-1) or ( q-1) which would be 52 or less for both m^(e d) congruent m(mod p) and m^(e d) congruent m(mod q) to be correct.

I have posted it here so that we can provide an answer.Capitalistroadster 09:53, 1 December 2005 (UTC)

Technically, no, since m^ed is only claimed to be congruent, not equal, to m (modulo p and q). But it does seem nonintuitive that RSA would still work for m>p and m>q. Note that taking m^ed mod p and q is a setup for using the Chinese Remainder Theorem to then find the value m for which m^ed is also congruent to m modulo pq. To be honest though, the CRT never seemed especially intuitive to me, so I prefer to think in terms of the generalization of Fermat's Little Theorem which states that m^phi(n) is congruent to m modulo n (for all m relatively prime to n). That way is easier to understand and code, since you just take m^ed(mod n), but using the CRT is faster for computers because it allows the modular exponentiation to happen on the smaller values p and q. Lunkwill 10:54, 1 December 2005 (UTC)

Is RSA based on the discrete logarithm problem?[edit]

I have just removed a claim that RSA is based on the discrete logarithm problem. Here are some additional clarifications. RSA is based on the integer factorisation problem, that is RSA can be reduced to integer factorisation. This means that RSA can be broken if the integer factorisation problem is easy, but does not mean that every attack on RSA leads to a fast factorisation algorithm. It is indeed possible to prove that integer factorisation can be reduced to computing discrete logarithms modulo composite integers. I.e. if there exists a fast algorithm for computing discrete logarithm modulo pq, then this algorithm can be used to find p and q fast. If there exists a fast algorithm for computing discrete logarithms modulo primes, then this algorithm cannot be used to break RSA.

That said, it should be clear that claiming RSA is based on the discrete logarithm problem, is certainly a confusing claim, even though it is correct in the sense described above. Since additionaly solving discrete logarithms does not provide an alternative way to break RSA, I have removed the claim that RSA is based on DL. 24.228.93.22 20:52, 17 March 2006 (UTC)

Please define your acronyms[edit]

If you don't mind.

Rivest Shamir Adleman[edit]

for Ron Rivest, Adi Shamir, and Leonard Adleman.

I'm sure they'd appreciate a proper citation for their work, as you might. —The preceding unsigned comment was added by CyberSongs (talkcontribs) 16:03, 26 June 2006 (UTC)

I'm not sure what you mean. Rivest, Shamir and Adleman are already mentioned: the fourth sentence of the article reads, "The algorithm was described in 1977 by Ron Rivest, Adi Shamir and Len Adleman at MIT; the letters RSA are the initials of their surnames." Their publication is also referenced in the "References" section. — Matt Crypto 18:05, 26 June 2006 (UTC)

Ah, so, you get top billing over the creators? Doesn't seem fair, an offshoot, no doubt, of the failure in Wikipedia and most of the world these days to define their acronyms.

RSA is not an acronym, it doesn't "stand" for anything - it's just a name derived from the surnames of its creators. Dcoetzee 00:32, 28 January 2010 (UTC)
You just described an acronym.
 "acronym –noun
1. a word formed from the initial letters or groups of letters of words in a set phrase or series of words." Unimaginative Username (talk) 02:50, 22 March 2010 (UTC)

Fermat's little theorem[edit]

The article says:

Now, since ed ≡ 1 (mod p-1) and ed ≡ 1 (mod q-1), Fermat's little theorem yields
m^{ed} \equiv m \pmod{p}
and
m^{ed} \equiv m \pmod{q}

How does one use Fermat's little theorem to do this? The theorem states that for all integers a and all primes p, a^{p} \equiv a \pmod{p}. Only p and q are primes here, so one would assume that the theorem is to apply to the last two equations, but how? The first congruences state that there exist integer k and k' such that ed=k(p-1)+1=k'(q-1)+1, but how does this help? The rest of the explanation is very clear, but this part could surely be made more obvious. 82.103.198.180 14:43, 9 July 2006 (UTC)

You started well. Remember that Fermat's little theorem states that m(p-1)≡1 (mod p), since p is prime. Thus we also have mk(p-1)≡1k≡1 (mod p) and thus medmk(p-1)+1≡1k mm (mod p). 129.199.97.157 16:26, 10 July 2006 (UTC)

Since ed ≡ 1 (mod p-1) and ed ≡ 1 (mod q-1) then ed ≡ p (mod p) and ed ≡ q (mod q) which can be substituted in Fermat's little theorem as above. 86.9.165.154 12:23, 31 March 2007 (UTC)

No. This is incorrect. Maybe you wanted to say that ed ≡ 1 (mod p-1) implies e.g. med≡m (mod p) since p is prime. 85.2.73.11 15:31, 31 March 2007 (UTC)

"Still" and "Electronic Commerce"[edit]

The article says: "RSA is still widely used in electronic commerce protocols, and is believed to be secure given sufficiently long keys."

  1. To me the word "still" gives the impression that newer and better algorithms are taking over, but the electronic commerce is still using RSA, because they are a little behind or because they dont need anything better.
  1. Yup. AES-256 is the current state of the art, approved by the US Govt for Top Secret material. Plenty of web sites (not just commerce, but e-mail, etc.) have implemented it. Want to have some fun? Visit your various banks, credit card companies, etc., double-click the padlock icon in the browser, and view the encryption protocol used. You'll find that a free webmail service (Yahoo) uses AES-256 (although for sending login credentials only), while a number of *banks* -- who need security the most -- are still using RSA-128. Can't be bothered? Unimaginative Username (talk) 05:32, 10 March 2011 (UTC)
AES-256 is not a public key system; RSA is. They serve different purposes and are not directly comparable.--agr (talk) 12:13, 10 March 2011 (UTC)
My bad. I had RC4-128 on the brain, probably because it bugs me how many "secure" sites still use it instead of AES, *after* agreeing on symmetric keys by using RSA. Thanks for the catch. Unimaginative Username (talk) 05:23, 20 March 2011 (UTC)
  1. And what is the electronic commerce protocols? I guess they are talking about https, but this is aimed at every kind of internet use, not only electronic commerce! Velle 12:29, 20 August 2006 (UTC)
  1. Yup, again. HTTPS is used for many other kinds of secure connections, not just for online shopping. Unimaginative Username (talk) 05:32, 10 March 2011 (UTC)
AIUI eliptic curve cryptography is considered "better" in that it is belived to be deliver eqivilent security with much smaller keys. Plugwash (talk) 14:07, 27 September 2013 (UTC)

From message to integer, how?[edit]

  1. When encrypting a message, how is it turned into a number? I guess the message will be divided into blocks, and every block is mapped into a number by some reversible function. Is it?
  2. Does the term padding count for the "mapping" Im looking for. I thought the term padding was used for turning a bit string into a longer one, in a reversible way, and not for mapping between messages and numbers.
  3. And if im right, about a message being divided into blocks, what is the block size? I guess this is implementation specific, but I cant find any implementations on wikipedia describing this.
  4. Will the mapping from message to integer sometimes result in small numbers like 15, or is this easily broken and therefor avoided?

Velle 12:54, 20 August 2006 (UTC)

Remember that text is just an array of bytes which are represented as characters based on their binary value. You can say exactly the same thing for numbers - the 16-bit integer 9656 is represented in an array of bytes as 0x25 0xb8 (I'm ignoring the usual least-significant byte first integer-encoding policy for this example). So, we could technically say that the string 'hello' converts to 0x68 0x65 0x6c 0x6c 0x6f, or 448378203247 in integer format. This isn't the exact method in RSA, but it's the basis on which the "convert text to a number" principle is based. Burningmace 13:10, 27 January 2009 (UTC) —Preceding unsigned comment added by Burningmace (talkcontribs)

Key size[edit]

What is the size of RSA keys? I saw somewhere that they are multiples of 1024, with 1024 about to be broken and 2048 expected to be broken in 2030. But I guess they could be any size?

And what is the key size? The size of p,q,m or some combination?

Velle 13:01, 20 August 2006 (UTC)

The key size is the length in bits of the modulus pq. Standardised sizes are 2^9 through 2^14 bits (512, 1024, 2048, 4096, 8192, 16384) but in reality any arbitrary number of bits can be used. Try using 'openssl rsagen -out private_key.pem <key_length>' with different values of key length - the lowest supported is 32 bits and the highest is 2147483646. Obviously generating such inordinately sized key is going to take a few million years on your average supercomputer. Burningmace 12:58, 27 January 2009 (UTC) —Preceding unsigned comment added by Burningmace (talkcontribs)

e<phi(n) is not necessary[edit]

It is not necessary to choose e<phi(n). RSA works as long as the public exponent e is just relatively prime to (p-1)(q-1). In fact, Cocks description of RSA used a fixed public exponent e=n. Also some protocols may require that the sender can verify that e is chosen relatively prime to phi(n). Such a verification is easy if e is a prime larger than n. 67.84.116.166 17:12, 10 September 2006 (UTC)

Notation[edit]

We should clearly distinguish between modular reduction and congruence relations. I.e. c=m^e \bmod{n}\, denotes a modular reduction. Here mod is a function. The result of m^e \bmod{n}\, is an integer in the range 0..n-1. On the other hand m^{ed}\equiv m\pmod{n} denotes an congruence relation, which only states that the difference between the left and right side of the relation is divisible by n. In particular we should not mix the two notations and not write things like c=me(mod n). 212.254.78.1 10:09, 15 October 2006 (UTC)

Norbert Wiener[edit]

From article: "Norbert Wiener showed in 1990 that if p is between q and 2q (which is quite typical) and d < n1/4/3, then d can be computed efficiently from n and e."

According to the Norbert Wiener article he died in 1964 so it seems that someone has mistaken him with someone else. Anybody know who actually made this discovery? --Evild00d 10:39, 26 October 2006 (UTC)

Michael J. Wiener "Cryptanalysis of Short RSA Secret Exponents", IEEE Transactions on Information Theory, vol. 36, no. 3, 1990, pp. 553-558. Also presented at Eurocrypt ’89, Houthalen, Belgium, April 1989.

Rendering glitch?[edit]

In the example section, I see this

φ(n) = (61 − 1)(53 − 1) = 3120-

What the hell is the "-" at the end? I checked, it's not there in the code. I am not familiar with entering math into wikipedia yet, but that definitely looks like some sort of a script glitching out. User:IvanAndreevich 27 October 2006

Strange. I see it too; in fact I see it in every block enclosed by <math> tags. Like "p=61- and q=53-". It is present in the page's source (the HTML source, not the pre-HTML source in the wiki). I guess it's a (new) bug with Mediawiki's math rendering... it wasn't there earlier, AFAIR. I don't see it in the bigger blocks that have been rendered as images (but obviously).
To clarify: when I set my "math" options (in "my preferences", available at the top right to logged in users) to "MathML if possible", I see these extra "-"s everywhere (as above). When I set it to "Always render PNG" or to "Leave it as TeX", I see it nowhere (obviously). When I set it to anyting else, I see it in only the place User:IvanAndreevich mentioned above. --Shreevatsa 07:59, 28 October 2006 (UTC)

Unusable messages[edit]

The article mentions that if the message is 0 or 1 the encrypted message will be the same, but if i remember correctly, if m = n - 1, the encrypted message will also be the same (unless the public exponent is an even nuber, which it is not). Is this correct, and is it worth mentioning? 213.214.198.224 15:09, 13 January 2007 (UTC)

Yes, it is. --thematrixeatsyou 10:10, 28 August 2007 (UTC)

Non-article question about RSA[edit]

I'm trying to do a rough implementation of RSA in C++, and have encountered a stumbling block, which could be a programming error, but I think is a more fundamental misunderstanding on my part of the encryption scheme. For simplicity, I'm using 17 as the public exponent (e). The problem arises when I end up with prime numbers P and Q whose totient (phi) is a whole number multiple of e. Under these circumstances, my decrypted message ends up with the same value as my encrypted method (.e.g, message = 17 , encrypted to 46, and decrypted to 46 as well). I guess technically, e and phi aren't coprime because in addition to 1, they share e as a common factor. So I guess that's where the problem lies, but is there a way to make sure I don't end up with P and Q that will yield such a result? I've tried this with both phi = (p-1)(q-1), as well as lambda = lcm(p-1, q-1), but neither is helpful. Also, this doesn't happen if I restrict P and Q to values under 103. As soon as I let them go to 103 or above, I start seeing this behavior pop up. Any clarification here, or on my talk page, or by email (bmearns#coe.neu.edu) would be appreciated). B.Mearns*, KSC 19:50, 1 March 2007 (UTC)

I don't think you're supposed to pick a predetermined value of e, but rather choose it after you have your modulus. If you insist on doing it this way, then you'll have to reject values for P and Q that are congruent to 1 mod e. Ntsimp 20:27, 1 March 2007 (UTC)
Many implementations (e.g. OpenSSL, Java JCE, Microsoft Capi etc.) let the user fix the public exponent e and simply generate P and Q such that P-1 and Q-1 are relatively prime to e. Similarly the digital signature standard (FIPS PUB 186-3) selects e first and then generates P and Q. We might even consider to change the RSA article accordingly. 85.2.66.205 01:02, 2 March 2007 (UTC)

defacement[edit]

well, it looks like some sort of anti-semitic statement has been put up in place of the rsa entry... backup? —The preceding unsigned comment was added by 68.159.120.49 (talk) 02:41, 6 March 2007 (UTC).(68.159.120.49 02:41, 6 March 2007 (UTC))

All better. Goodnightmush 02:42, 6 March 2007 (UTC)

RSA without padding[edit]

I'm removing the following paragraph:

If a padding method is not used, then m\, < \min(p,q)\, is better. if a value m\, > \min(p,q)\, is used, then for some combinations of e\, and \phi(n)\, you will get m = c\, for some values of m\,. In the working example below, this happens for m=477 and 560 and others. Usually, this is no problem since p,q is larger than any m\, value.

First, RSA without padding is in most cases insecure and should be avoided. The advice given here to use short messages only when using RSA without padding makes the situation even worse. The paper "Why Textbook ElGamal and RSA Encryption are Insecure" by D. Boneh, A. Joux, and P. Nguyen presented at AsiaCrypt '00 analyzes this situation. One attack presented there is only feasible when short messages are encrypted without padding. 85.2.31.101 12:59, 10 April 2007 (UTC)

I'm also removing this paragraph:

When m is between \min(p,q) and n, then for some combinations of e and \phi(n) you will get m = c for some values of m. In the working example above, this happens for the given e,d and m=477 or m=560 among others. This can confuse beginners trying to understand the basic algorithm. It can be avoided using padding.

First, the coincidence m=c=m^e (mod n) has nothing to do with the size of m. In particular it can happen for m<\min(p,q). An example is n = 73 * 97; e=17 and m=22 or m=27. Cases where m=c become rare with large n. There are only (\gcd(e-1,p-1)+1)(\gcd(e-1,q-1)+1) such messages. Paddings schemes do not prevent these unlikely cases. m=c can happen even with padding, but that is just very unlikely. 85.2.41.56 12:14, 14 April 2007 (UTC)

RSA implementation of educational purposes[edit]

Is there a need for oversimplified implementations that show how to implement textbook RSA (i.e. no padding) using standard libraries? I think it is not, because it (i.e. writing an insecure implementation) is simple enough to be done by most people. Moreover, there is a danger that promoting such implementations will lead to insecure use, when people start extending such tiny implementations and use them instead of the preinstalled standard libraries. However, if readers still look for educational implementations we might want to find one that does a good job commenting the code. [1] might be a start, although I'm sure there are better pages. 85.2.56.39 07:58, 18 April 2007 (UTC)

How to choose the two prime numbers P and Q?[edit]

Can any one explain me how a key generator choose the two prime number P and Q? It seems to me that choosing 512bit long prime number is not easy without certain algorithm.

The article already contains a link to probabilistic primality tests, which includes the most commonly used algorithms for RSA key generation. 85.2.125.143 11:56, 10 June 2007 (UTC)

Communists attack America's wallet via RSA-breaking[edit]

Russkie company Elcomsoft blackmails Intuit via breaking the RSA-512 Quicken factory support backdoor keycode. This is the same company which blackmailed Adobe Acrobat a few years ago but FBI nabbed the boss, who had to be released due to liberal whining instead of supermax.

Link: http://www.theregister.co.uk/2007/06/23/quicken_password_backdoor/

Me thinks NSA and Homeland Security should act against the crypto-communists before it is too late for the free world! 81.0.68.145 16:41, 24 June 2007 (UTC)

Why don't we think logically and blame the people who put the back door in their product and secured it with weak encryption? --Ray andrew 17:57, 24 June 2007 (UTC)

RSA for general encryption[edit]

RSA can be used for general encryption. Do I need to find references stating such or is it obvious? Someone reverted my edit stating so. Its expensive computationally, but done for short messages. Daniel.Cardenas 17:50, 28 June 2007 (UTC)

Something I should note that with a small key I made (pq = 8633, e = 83 ), from 2 to 8632 inclusively, there were 7 values which encoded to themselves, and 216 which decoced with the public key. Also, if you have an encoded byte, you can re-encode it 39 times and you will return to the original value. My advice: only use RSA for fun. Like sending a message to me with that key I supplied ;D --thematrixeatsyou 10:08, 28 August 2007 (UTC)
This is known as a cycling attack. Such attacks are long known, have been well analyzed. They are unlikely to succeed. 24.228.51.109 21:06, 28 August 2007 (UTC)

Easy Decryption???[edit]

Why can't you just encrypt all possible plaintext characters once and compare the encrypted characters with other ciphertexts? Wouldn't you instantly be able to decrypt all messages given the public key? There must be something I am missing in the article... —Preceding unsigned comment added by 141.154.34.78 (talk) 04:28, 26 December 2007 (UTC)

The main reason why this does not work are the padding schemes. These padding schemes generally randomize the message. E.g. to encrypt a message M the popular PKCS #1 v1.5 standard first generates a new message of the form m = 00 01 PS 00 M, where PS is a randomly chosen padding string of 8 or more bytes. Then m is converted into a single large integer which is encrypted with RSA. Hence if an attacker tries to find out whether a message M was sent by encrypting M he would also have to guess the random padding string PS correctly. More reasons for using message padding are described in the section on padding schemes. 85.2.46.162 (talk) 12:20, 26 December 2007 (UTC)
RSA messages are not encrypted character-by-character - it's typically used to encrypt secret keys as a single complete message. Your scheme would at best work for single-character messages, and the padding schemes still defeat it. Dcoetzee 18:58, 27 December 2007 (UTC)

Create a database of all known primes[edit]

Yes, there are infinitely many primes but only finite number of primes are known. Why can't some govt (say US govt) create a database of all known primes and then figure out p and q by dividing n with all the numbers in the database? Don't say there are infinitely many primes because only finite number of primes are known, and it's possible to create a database of all known primes. 75.87.86.76 (talk) 22:04, 18 March 2008 (UTC)

When creating a new RSA key one does not use published primes. Rather one finds two random primes, e.g. by first generating random numbers of the approriate size and testing them for primality. These primes are kept secret. Thus a list of published primes does not help to break RSA keys. The prime number theorem gives us an approximation on the number of primes smaller than a given bound. This theorem tells us that there are far too many primes for typical RSA key sizes to be listed all in a database. E.g. the number of 512 bit primes is larger than 10151. Trying to factor an integer by dividing it by potential factors is known as trial division. Because of the size of the RSA keys this method is infeasible. Much better integer factorisation methods exist. 85.2.6.86 (talk) 06:24, 19 March 2008 (UTC)
Can you post a simple algorithim (say written in java) that can genegerate 2048 bit random primes? it would take too long for instantly generating random primes for online transaction 75.87.86.76 (talk) 08:14, 19 March 2008 (UTC)
In java the method java.math.BigInteger.probablePrime generates primes reasonably fast. 85.2.69.178 (talk) 06:16, 20 March 2008 (UTC)
Yes, the Miller-Rabin algorithm can test a random 2048-bit number for primality quickly, and a random 2048-bit number has a roughly 1 in 1420 chance of being prime. More importantly, this is actually how cryptography systems work in practice. Dcoetzee 03:25, 22 June 2008 (UTC)

Function changes?[edit]

In the list describing the RSA algorithm, I believe there is a mistake with the function used to describe totient. It changes from a \phi to a φ for some reason, but they could be different functions as I am not sure of the steps, so I didn't change it.

RSA involves a public key and a private key. The public key can be known to everyone and is used for encrypting messages. Messages encrypted with the public key can only be decrypted using the private key. The keys for the RSA algorithm are generated the following way:

  1. Choose two distinct large random prime numbers p and q
  2. Compute n = pq\,
         * n\, is used as the modulus for both the public and private keys
  3. Compute the totient: \phi(n) = (p-1)(q-1) \,.
  4. Choose an integer e such that 1 < e < φ(n), and e\, and φ(n) share no factors other than 1 (i.e. e and φ(n) are coprime)
         * e is released as the public key exponent
  5. Compute d to satisfy the congruence relation d e \equiv 1\pmod{\phi(n)}; i.e. de = 1 + kφ(n) for some integer k.
         * d is kept as the private key exponent  —Preceding unsigned comment added by Michael miceli (talkcontribs) 19:34, 21 May 2008 (UTC) 
Yup. Correct is to use \varphi not \phi. 85.2.104.180 (talk) 19:55, 21 May 2008 (UTC)

RSA on T-shirts[edit]

I've removed a section about violating US export restrictions by printing some small code snippets on T-shirts because it is not relavant. What was relevant to the discussion about export control is for example the case Bernstein v. United States or the criminal investigation against Phil Zimmermann for publishing PGP. These cases did have an impact on cryptography. The T-shirts did not. 85.1.98.86 (talk) 20:46, 1 July 2008 (UTC)

I've restored the section as even though the use of RSA-in-Perl was something of a MacGuffin, the three-line RSA script and the T-shirts it was printed on did play a major role in the debate as a protest of the government's treatment of Zimmerman et al. It could just as easily have been Bruce Schneier's Solitaire/Pontifex algorithm or some other strong encrypt, but it happened to be RSA, and therefore the section is highly relevant as a description of a watershed event in the ongoing debate over online civil rights. It's like having a history of the Civil War without talking about John Brown, Nat Turner or Harriet Tubman -- they may not have had anything directly to do with the war, but their lives and actions as opponents of slavery are a critical part of the context of the history of the Southern secession and the ensuing war. Haikupoet (talk) 18:44, 8 July 2008 (UTC)
What do you think of making more general comments about the legal restrictions placed on RSA? RSA as an internet meme could be the PGP incident or something. We could add a few things about Bernstein and Zimmermann, if applicable. My hope is a more professional look. Skippydo (talk) 20:37, 8 July 2008 (UTC)
Rephrase it however you wish; just make sure the coverage remains, as it's a fairly important thing. I will point out, however, that though deadly serious, the RSA-in-Perl protest does in fact qualify as an Internet meme by the currently accepted definition. RSA and the ITAR controversy would be another good phrasing. Haikupoet (talk) 02:11, 9 July 2008 (UTC)
Ok, let's try to be at least somewhat serious and do some simple fact checking. Much of the section just simply contradicts common sense and hence should either be removed or referenced. The first sentence reads like the U.S. government was more interested to restrict the export of Perl snippets than the export of fully implemented cryptographic schemes such as PGP. Why would the gouvernment want to do that? Can you give a reference? The next sentence claims that the government treated cryptography as munitions. All I can find is that cryptography was treated as export restricted technology with primarily military use and hence the same restrictions as for munition would apply. Just because the two things were treated the same does not mean the government claimed cryptography is munition. Next, the section implies that people in black t-shirts were responsible for easing the U.S. export restriction. This is in contradiction with the article export of cryptography, which claims more bluntly that American companies claimed the export restrictions would hurt their business. Given these two potential explanations, I really find it difficult that it was the t-shirts that made an impact unless of course you can give a reliable reference. 85.0.101.98 (talk) 05:41, 9 August 2008 (UTC)

Are d and e interchangeable?[edit]

Is there a reason why d is the private key and e is the public key? Can you release d and keep e secret and achieve the same results? —Preceding unsigned comment added by 68.62.2.221 (talk) 21:56, 21 August 2008 (UTC)

Yes. Or to put it differently, whereas the current steps say to choose e and then compute d, you are free to choose d and then compute e instead. Dcoetzee 22:54, 21 August 2008 (UTC)
No. Public and secret exponents are not exchangeable. Encryption and decryption still works when d and e are exchanged. However, doing so may allow an attacker to break the key. This is because the conditions that d and e must satisfy are different. e can be small but not d. E.g., e=65537 is very common. On the other hand it must not be possible to guess d or compute d from information how it was selected. In particular, d must not be small, because of the attack by Wiener. There are other attacks that can break if d is chosen in a specific way. Standards such as PKCS #1 or FIPS PUB 186-3 specifically require that e is chosen first and d is computed from e, p and q. In fact appendix B.3.1 in FIPS PUB 186-3 requires that e is at least 160 bits shorter than the public modulus. This requirement was included into the standard so that it is possible to protect against a user exchanging d and e by accident. 85.2.92.41 (talk) 07:39, 23 August 2008 (UTC)
I came here looking for this specific information and I'm grateful for your clear and concise explanation. However, shouldn't this text be in the main article rather than hidden in the discussions? Mandolamus (talk) 09:47, 19 April 2011 (UTC)
Perhaps you're right, this could go in the article, but it should be worded carefully. As far as the core algorithm and its underlying mathematics are concerned, d and e are completely interchangeable, as are p and q for that matter. However, in practice you do need to keep track of which is the public exponent and which is the private one because, as mentioned above, there are implications to the resulting strength of security. --Skysmurf (talk) 13:47, 19 April 2011 (UTC)

Real standards specify lambda(n), not phi(n)[edit]

Real standards for RSA, such as PKCS #1 or IEEE P1363, specify that e d \equiv 1 \pmod{\lambda(n)}, where \lambda(n) = \mathrm{lcm}(p - 1, q - 1). Note that \lambda(n) = \phi(n)/\gcd(p - 1, q - 1), so the difference is at least a factor of 2.

To see that this is both necessary and sufficient, observe that the Chinese Remainder Theorem describes an isomorphism of rings \mathbb{Z}/n\mathbb{Z} \cong \mathbb{Z}/p\mathbb{Z} \times \mathbb{Z}/q\mathbb{Z}. Therefore x^k \equiv x \pmod{n} if and only if x^k \equiv x \pmod{p} and x^k \equiv x \pmod{q}. Fermat's Little Theorem tells us that the latter happens if and only if k \equiv 1 \pmod{p - 1} and k \equiv 1 \pmod{q - 1}. Hence k - 1 must be a multiple of both p - 1 and q - 1, i.e., a multiple of \lambda(n) = \mathrm{lcm}(p - 1, q - 1) by definition of lcm.

None of this makes any difference for practical implementations, since they use the Chinese Remainder Theorem directly for private-key operations and the public exponent is chosen to be small.

--80.177.3.76 (talk) 19:34, 10 October 2008 (UTC)

encryption preconditions wrong[edit]

Hi,

I've had just added the correct preconditions for decryption to work.

History:

  # 18:03, 16 February 2009 Skippydo (Talk | contribs) (28,437 bytes) 
    (undo: with overwelmingly high probability, M is relatively prime to p and q.) 
  # 13:37, 16 February 2009 141.24.45.251 (Talk) (28,473 bytes) 
    (→Encryption: vgl. page 318 in ISBN 3-540-42061-4 or slide 19 in chapter 4 of
    networt security analysis of prof. schäfer at tu-ilmenau or look at the prerequisites of the euler theorem) (undo) 

The wikitext says, that the Message M is put into a number m < n.

The assumption is that (M**phi(n) mod n = 1), which does not hold for n=15, M=3.

The correct precondition - as they are also mentioned in scientific literature - is that m is relativly prime to n and m < n.

Removing this precondition - as skippydo did - renders the the algorithm wrong. Who wants an encrpytion algorithm that *probably* can decrpyt ones important messages - but not always though they are correct.

I could agree that with m < n m is likely to be relativly prime to n - but not always the case.

Please give a proof that (m < n) implies (m relatively prime to n) before removing the preconditions from the wikitext!

141.24.45.251 (talk) 13:35, 18 February 2009 (UTC)

Keep in mind that the security of the protocol requires that factoring is difficult. If you discover a message that shares a nontrivial factor with n, you have factored n. Since we are assuming factoring is infeasible (for the security of the algorithm), we are assuming that finding such a message is infeasible. Removing the check makes the algorithm more efficient.
In summery, we are left to chose between a faster algorithm, or a check for something that is infeasible. Also note that using the heuristic infeasible=impossible, the choice is obvious.
I would suggest we note that for the algorithm to work, m must be relatively prime to n but in practice, this issue does not arise. Skippydo (talk) 17:10, 18 February 2009 (UTC)
agreed
141.24.45.251 (talk) 18:09, 18 February 2009 (UTC)
Correctness of RSA requires that m^{ed} \bmod n = m and this holds for all 0\leq m < n. At some point this article contained a proof of correctness that included the m that were not relatively prime to n, but that proof got replaced by the current one, which is simpler but does not cover all values for m. Still, RSA does correctly work for all m and as Skippydo notices those special cases happen with extremely small probability anyway. Standards don't include any requirements that gcd(n,m) must be checked. Nor is this done in any implementation of RSA that I'm aware of. 92.106.74.178 (talk) 19:15, 18 February 2009 (UTC)

"private key" != "secret key"[edit]

This article uses the phrase secret key as a synonym of private key. This could cause confusion with secret-key cryptography, which is not the topic of this article. It would be best to use private key exclusively. DaveBeal (talk) 15:59, 14 March 2009 (UTC)

You are of course right, using two terms that refer to the same thing is confusing. Though, authors sometimes use the the terms "public key" and "secret key" for the two keys in a key pair of a public key cryptosystem, for example when they also use symbols such as {\rm PK}_A, {\rm SK}_A to refer to the two keys. 62.203.40.35 (talk) 21:41, 14 March 2009 (UTC)
I don't see the problem. Please give an example where the meaning of private key is distinct from secret key. What is secret-key cryptography? Skippydo (talk) 21:59, 14 March 2009 (UTC)
The problem was that the article used both "secret key" and "private key" at the same time. They mean the same thing in public key crypto, but it is still less confusing just to use one of the terms consistently in the article. 62.203.40.35 (talk) 22:28, 14 March 2009 (UTC)

Question on example[edit]

I can't reproduce the example of encryption / decryption using python or scientific calc.

I get:

123^17 mod 3233 = 855 and not 2193 
Indeed 855^2753 mod 3233 = 123 so it gives back message m=123
whereas 2193^2753=1254 which is not expected m

Am i missing something? 82.66.65.79 (talk) 14:34, 18 May 2009 (UTC) Chris

Yup, it should be 855. Thanks 62.203.4.103 (talk) 17:05, 18 May 2009 (UTC)

What happened to the Proof? !![edit]

(Ie that decryption works.) There was a good explanation here, involving Fermats little theorum. I went to look for it and it has disappeared. The one liner does not cut it. Who deleted it, and why! (There seems to be a general theme that maths on wikipedia shoul be impenetrable.) Tuntable (talk) 00:02, 20 November 2009 (UTC)

The proof using Fermats little theorem and the Chinese remainder theorem was removed in Dezember 2008. Comparing the two versions, I'd agree that the old proof based on Fermat is clearer than the current proof that is based on Eulers theorem. Eulers theorem doesn't cover the cases where the message is not relatively prime to the modulus. Hence it is not a complete proof 83.78.70.161 (talk) 01:01, 11 December 2009 (UTC)
I have added an intuative proof, largely based on http://www.di-mgt.com.au/rsa_theory.pdf. No need for Totient functions. I have left the original for the mathematically minded, although there is a gap about why phi(pq) = (p-1)(q-1). I realize that there are many mathematician on wikipedia who delite in articles that only they can understand. But this was written for the rest of us. Tuntable (talk) 06:29, 27 January 2010 (UTC)

I also added a note about why the obvious attack of finding a different decrypter

e f \equiv 1 \pmod{n-1}

would not work. This was not obvious to me initially. It also helps give a good understanding of the algorithm, and is short. Remember, this is the intuitive seciton. Tuntable (talk) 10:53, 27 January 2010 (UTC)

The problem with your "explanation" is that it simply is not correct. If n is not prime then this does not imply that a^{n-1}\not\equiv 1\pmod{n}. [Charmicael numbers] (e.g. n=561) are counter examples. Just because you call a section "intuitive" does not mean you can invent stuff on the spot. Those numbers are rare enough not to be a threat to RSA. There is no need to disprove attacks that are nobody is seriously suggesting. If we write a section about attacks that don't work, then we should include stuff that has been proposed and analyzed. For example "cycling attacks" come to my mind. On a separate note, there is a simple proof that computing d from e and n is as difficult as factoring. However, no such proof is mentioned in the section "Security" as you claim. Thus, please either cite a reference or give a proof. Don't just remove the call for citation. 62.203.85.79 (talk) 06:59, 29 January 2010 (UTC)
I still prefer the former proof in the section "Decryption", which was removed in December 2008 to the current proof in the section "Intuitive Derivation". The former proof was somewhat better organized and better formalized (i.e. it used whole sentences rather than thought snippets). I'll try to clean up the current proof a little, but I wouldn't mind if it gets replaced again with the old version. 62.203.85.79 (talk) 07:24, 29 January 2010 (UTC)

Small detail: the "concise proof" uses k, while the "intuitive proof" uses h. These are the same variable. So perhaps h could be changed to k in the "intuitive proof" for notational consistency. 69.139.234.238 (talk) 10:11, 25 November 2010 (UTC)

section on patents needs fact checking[edit]

The article says that the patent was to expire in September 2003, and that RSA released the algorithm into public domain in September 2000. United States patent law states that the term of patent is 20 years, which corroborates this information. However, most other sources I've found state that the patent lasted only until 2000.

Does anyone know which is the correct case? --Ixfd64 (talk) 03:17, 25 November 2009 (UTC)

  • Never mind, it turned out that the term of patent was 17 years at the time. --Ixfd64 (talk) 03:29, 25 November 2009 (UTC)

Verification[edit]

  • Choosing e having a short addition chain results in more efficient encryption.
  • In practice, e is usually 216+1.

Both of these statements are bold to not have a reference. I added citation needed, but doing some small googling the second statement seems like it should be "e is usually 2^16 - 1" not + 1 website Michael miceli (talk) 21:21, 22 February 2010 (UTC)

I've cleaned it up a bit. Hopefully, you'll find it acceptable. Skippydo (talk) 18:04, 23 February 2010 (UTC)

1024-bit broken[edit]

http://techie-buzz.com/tech-news/1024-bit-rsa-cracked.html --149.4.115.3 (talk) 22:51, 8 March 2010 (UTC)

The title of this article is misleading. 1024-bit RSA wasn't cracked. The researchers just claim to have successfully implemented a fault based attack. They changed the valtage of the server doing RSA so long until it started making errors, then manage to derived the RSA private key from the faulty results. Since the concept of this attack is already known, it is unclear what exactly is the contribution. Hence as usual newpaper articles are a weak source. Having access to the conference paper would be much more helpful. 92.107.157.23 (talk) 07:52, 9 March 2010 (UTC)
Link to the paper http://www.eecs.umich.edu/~valeria/research/publications/DATE10RSA.pdf —Preceding unsigned comment added by 84.209.15.52 (talk) 07:41, 10 March 2010 (UTC)

Equivalence to factoring[edit]

There is a EUROCRYPT 2009 paper (Aggarwal and Maurer, Breaking RSA Generically is Equivalent to Factoring) showing that breaking RSA generically (i.e., using only ring operations to work on the numbers involved) is equivalent to factoring. I believe that this is significantly stronger than all previous security proofs of RSA. Might be worthwhile adding to the discussion in the hardness section. —Preceding unsigned comment added by 128.178.42.58 (talk) 14:52, 18 March 2010 (UTC)

ASCII Error[edit]

In the worked example, it says 'A' is represented in ASCII as 65. As far as I know, 'A' in ASCII is 41 while 65 is 'e.' Am I missing something?

The ASCII code of 'A' is 65 (or 41 in hexadecimal notation). But this is irrelevant here. RSA is not used to encrypt single characters and in fact it is generally not even used to encrypt text. Rather one encrypts for example a AES key, which is then used to encrypt the text. Hence the "worked exmaple" is contrieved an may even mislead readers to apply RSA incorrectly. 85.2.166.21 (talk) 17:58, 13 September 2010 (UTC)

Only the private key holder can know the value of P and Q separately - please make this clear for didactic purposes.[edit]

In the RSA article I attempted to change the private key example. The private key should consist of (P,Q,D) not (PQ,D). Yes we can definitely compute P and Q if we know D however for didactic purposes in this article its important for people to be able to understand that from the public key only we CAN NOT compute P and Q separately which is the foundation of the algorithm based on the integer factorization problem. Integer factorization states that semiprimes, in this case PQ are computationally infeasible to factor.

Anytime in the article that the private key is shown it should be listed as (P,Q and D) not (PQ,D).

http://en.wikipedia.org/wiki/Integer_factorization —Preceding unsigned comment added by Mikeatcmu (talkcontribs) 17:12, 17 September 2010 (UTC)

Right now, the wikipedia article follows the notation used in the original paper by Rivest, Shamir and Adleman. I.e. they used (n,e) as the public key and (n,d) as the private key. (n,e) is sufficient to encrypt and (n,d) is sufficient to decrypt. There is no need to use the factors of n. For didactic purposes the primary question should be, how hard it is to invert RSA. The fact that finding (n,d) is equivalent to factoring n is then only a consequence of exploring one way to break RSA, but it is not the primary question. Therefore, I think, it is quite adequate how the wikipedia article presents basic RSA.85.3.176.55 (talk) 21:24, 17 September 2010 (UTC)

Yes I see how P and Q do not have to be represented separately in the explanation of the private key. P and Q separately are only needed to generate d. Thanks for the explanation. —Preceding unsigned comment added by 128.237.243.213 (talk) 00:19, 22 September 2010 (UTC)

What makes you think the private key should store original values of P and Q (instead of N which is P*Q)? Did you read this in some college cryptography textbook, or other source? If so, what is your source? If you have a source for this idea, please state it in your post here. 76.104.145.19 (talk) 08:04, 4 January 2014 (UTC)

When are primes created in browser?[edit]

When are the primes created in web browser? I would assume it takes several minutes for a web browser to find two e.g. 1024 primes? When are they created?--Teveten (talk) 12:10, 3 October 2010 (UTC)

Or is it so, that server sends its public key to client, and client encrypts symmetric key with that, so client's browser does not need to create primes?--Teveten (talk) 15:11, 5 October 2010 (UTC)
The details depend on the cipher suite but AIUI there are generally two approaches, the first is for the client to generate the secret key and encrypt it with the server's public key (which it can obtain from the certificate). This is simple but has the significant disadvantage that anyone who can steal the server's key can passively decrypt the session and they can do so retroactively.
The other approach is to use some key agreement algorithm like diffe-hellmen to agree the secret key and use RSA merely to verify that you are agreeing a key with the correct server.
As you say generating a new RSA key for every session isn't really practical.
See the perfect forward secrecy article for more. 151.229.191.223 (talk) 01:50, 22 June 2014 (UTC)

Concise proof using Euler's Theorem[edit]

In the end of the proof there is stated:

The last congruence directly follows from Euler's theorem when m is relatively prime to n.

So it's no complete proof because RSA works for all numbers and not only for those that are relatively prime to n. --Jobu0101 (talk) 09:39, 15 March 2011 (UTC)

Disambiguation[edit]

Is RSA such a common search term for South Africa that it really needs its own disambiguation message? Feezo (send a signal | watch the sky) 21:55, 20 May 2011 (UTC)

As there have been no objections, I have removed it. Feezo (send a signal | watch the sky) 08:31, 22 May 2011 (UTC)
I object - RSA is an extremely common acronym for Republic of South Africa in the RSA. For example South African stamps have RSA on them as the name of the country. — Preceding unsigned comment added by 78.147.7.7 (talk) 01:29, 9 June 2011 (UTC)

Possibly breakable by NSA?[edit]

http://www.cablegatesearch.net/manning-logs-diff.php Ctrl F for (7:35:37 AM) bradass87: other person knows a lot about phones... how to tap cellular phones (its his job, after all) — Preceding unsigned comment added by 90.204.167.76 (talk) 17:50, 26 July 2011 (UTC)

bradass87 doesn't seem to know the difference between DES and tripleDES, otherwise he wouldn't claim that both can be brute forced in minutes. bradass87 doesn't seems to understand that a successful fault-based attack does not mean 1024-bit keys are broken, and generally his claims are not reputable. For a recent estimate how much it would take to break a 2048-bit RSA keys, see for example the paper http://eprint.iacr.org/2011/254.pdf which was written by the real experts using real arguments and comes to the conclusion that 2048-bit RSA keys are way out of reach. 83.79.23.51 (talk) 19:21, 26 July 2011 (UTC)

...The same key should never be used for both encryption and signing. ...[edit]

In that source, there were mentioned that only if raw encrypted data is signed, there is a weakness. This is rather unlikely and does not includes case when signed data is encrypted, so it seems that the same key CAN be used safely for signing and encryption, as long as not blindly signing random raw data. -Yyy (talk) 11:29, 30 July 2011 (UTC)

There is a design principle saying that generally the same key (for any cryptographic algorithm not just RSA) should not be used for multiple encryption modes. NIST has this explicitely in one of its standards (though I can't find a reference at the moment). One reason for not using a cryptographic key for multiple encryption modes is that the analysis of encryption modes are done under the assumption that the key is only used for one particular encryption mode. I.e., RSA-OAEP does have a nice security reduction. But the proofs can no longer be applied, if the same key is also used for some signature scheme (or even another encryption mode). Hence using an RSA key for both encryption and signature means that you have to give up much of the scientific progress on RSA an go back to a situation, where your only argument for security is the lack of known attacks.
Of course, the text in the article may need some clarification and better citation. Generally for recommendations like this one, we should not rely on a web page and rather refer to a concrete cryptographic standard or a reviewed paper. 85.3.68.148 (talk) 08:26, 31 July 2011 (UTC)

First for Key Exchange[edit]

Diffie-Hellman was first, based on WP dates in that article and this one, as well as CISSP references. (These aren't authoritative as they all cite answers from the same, single, dictatorial source, which is ISC2. They are ubiquitous).

Also removed reference to being consider adequate since all algorithms used for their intended purpose are also deemed adequate -- which is how they end up getting used in the first place. However, most banking encryption isn't this sophisticated -- which was the real reason I removed it. See "Security Engineering" by Ross Anderson.

Kernel.package (talk) 18:57, 10 November 2011 (UTC)

Page Move[edit]

This page has been moved from RSA to RSA algorithm based on an assertion that "the RSA - acronym should redirect to the most notable denotations of the acronym (which is in this case an organisation Royal Society of Arts and not the algorithm. The page view statistics indicate that Royal Society of Arts got about 4,500 hits in October 2011 and RSA (as far as the page view stats for October are concerned the old name would appear to be required) got 63,914. Accordingly, without going through all of the other uses of the acronym, this assertion would not appear to be well grounded in fact and the RSA algorithm would appear to meet WP:PRIMARYTOPIC. Moreover, no discussion took place on the talk page. I believe that the original page name might usefully be restored.

FrankFlanagan (talk) 23:45, 10 November 2011 (UTC) 23:56, 10 November 2011 (UTC)

I would suggest renaming this article RSA algorithm instead of the current RSA (algorithm). Per WP:NAME, a natural disambiguation is preferred over parenthetical terms.--agr (talk) 22:09, 21 February 2012 (UTC)

Faulty Key Generation additions[edit]

Recent additions to the Faulty Key Generation section about Lenstra's discovery of faulty keys are premature and read like an essay. There have been additional developments that change the story significantly -- see Nadia Heninger's post https://freedom-to-tinker.com/blog/nadiah/new-research-theres-no-need-panic-over-factorable-keys-just-mind-your-ps-and-qs and my http://diceware.blogspot.com. In particular the duplicate keys seems to come from weak entropy generation in some black-box appliances, perhaps when they are first setup. The keys with one shared prime seem to be caused by an interesting programming glitch:

seed_random_number_generator (entropy-pool)
P=generate_random_prime ()
add_entropy_to_pool (whatever)
Q=generate_random_prime ()
public_key=P*Q  

The add_entropy statement seems harmless enough, but if the initial entropy pool is weak, it can result in two users with the same P and different Q's, which is fatal to RSA via GCD algorithm. The simple solution is to remove the add_entropy statement. The apparent weak entropy revealed by duplicate keys from some appliances implies a bigger problem. If the detailed nature of the weak entropy can be characterized, perhaps by reverse engineering one of the boxes, then an attacker can generate a large numbers of keys using the same limited entropy states and compare them against public key registries or intercepted internet traffic, with a high likelihood of many successful matches. Generating high quality random numbers is essential to all public key systems, not just RSA. For example, an attacker who discovers weak entropy being used could look for two DSA signatures that employ the same nonce and thereby find the DSA secret key, much like the PlayStation attack. --agr (talk) 19:45, 17 February 2012 (UTC)

md5[edit]

what is md5 in padding — Preceding unsigned comment added by 220.225.106.177 (talk) 08:13, 6 March 2012 (UTC)

A paradox![edit]

Hi We said that there mustn't be any way to find the private key by public key. public key is(n, e) private key is(n, d) and d=φ(n)/e can't we easily find the d from n and e ?! Qualux (talk) 16:57, 13 July 2012 (UTC)

We can find d from n and e but not easily. Finding φ(n) is equivalent to factoring n, which is difficult, in general. Skippydo (talk) 15:21, 14 July 2012 (UTC)

Smallest Keys[edit]

Is it possible that 22,3 and 22,7 are the smallest keys you can get with RSA without having the same key for both encryption and decryption ? — Preceding unsigned comment added by 2001:6F8:14DC:2:1E65:9DFF:FE26:33C3 (talk) 07:26, 28 August 2012 (UTC)

I don't see how small RSA keys are useful, but I'll bite: 22,3 and 14,5 look a little smaller? --DavidCary (talk) 17:10, 13 February 2014 (UTC)

Missing text?[edit]

I can't make sense of "so, d*e= 1 mod φ(n)". It seems like some text got deleted or moved. — Preceding unsigned comment added by 213.114.153.157 (talk) 16:24, 25 September 2012 (UTC)

should be better now. --MarioS (talk) 11:11, 26 September 2012 (UTC)

Valid range for m[edit]

how can this be a valid range "0 ≤ m < n " when 0^x = 0 and 1^x = 1 ? — Preceding unsigned comment added by 129.12.46.20 (talk) 12:57, 25 July 2013 (UTC)

You are presumably referring to my revert of your edit, which you should mention so that editors generally know what you are referring to. I infer that you are concerned that the encryption might not be secure with these values (as well as with n – 1, as you pointed out in your edit summary). These cases could be treated as a weak encryption, but not out of the valid range of the algorithm, since it functions correctly for all values (including these). However, the literature generally makes no mention of an exclusion such as you are motivating, and the primary requirement is that the literature be used as reference.
However, these values are in fact not weak from a security perspective, counterintuitive as this may seem. For an attacker to exploit these values, she must implement a comparison algorithm on the ciphertext. Since the attacker can derive any number of plaintext–ciphertext pairs given only the public key, limited only by her computational and storage capacity, any message value is exactly as weak as the ones that you have chosen to classify as "invalid", because such a comparison algorithm would work equally well for any other value in the attacker's database. — Quondum 14:49, 25 July 2013 (UTC)

polynomial-time method for factoring large integers may have been discovered[edit]

Primary link to article:

http://deepthought.newsvine.com/_news/2013/08/15/20030719-has-rsa-encryption-been-broken-need-a-second-opinion-on-this-math

Yet to be confirmed...but looks good. — Preceding unsigned comment added by 80.47.125.210 (talk) 05:35, 15 August 2013 (UTC)

Please don't waste your time on this. Wolfram Alpha automatically determines and displays the prime factorization of relatively small numbers. — Quondum 02:17, 16 August 2013 (UTC)

Removed HE-RSA[edit]

The article is about RSA not its derivatives. If I were an author to HE-RSA's paper I would be ashamed of such inappropriate inclusion.

Message equaling ciphertext[edit]

A couple years ago I added the sentence "Note that at least nine values of m will yield a ciphertext c equal to m, but this is very unlikely to occur in practice", with a footnote saying, "Namely, the values of m which are equal to -1, 0, or 1 modulo p while also equal to -1, 0, or 1 modulo q. There will be more values of m having c=m if p-1 or q-1 has other divisors in common with e-1 besides 2 because this gives more values of m such that m^{e-1}\text{ (mod }p\text{)}=1 or m^{e-1}\text{ (mod }q\text{)}=1 respectively." In December 2012, user:Quondum removed this with the comment "Removal of false statement. There is a bijection between ciphertexts and plaintexts in RSA."

But of course, what I wrote is true. It's quite easy to see that the message 0 will give ciphertext 0 and 1 will give 1. This has nothing to do with whether there exists a bijection between m and c. So I'm putting my sentence back in. Eric Kvaalen (talk) 08:15, 28 November 2013 (UTC)

Indeed it is; I was being sloppy and did not think through the detail closely enough. However, the inclusion of this point seems to me to be spurious; in particular, it does not have cryptographic significance and I strongly doubt whether you'll find any notable source mentioning it. If whole books on the subject do not mention it, there is little case for including it in WP. You don't find mention of approximately one c=m pair expected for every use of AES (or any other block cipher) for any give key, which is a far higher probability than for the typical RSA operation. Even if it were to be included, it is in an inappropriate section. Try to add quality, not oddments. —Quondum 01:59, 29 November 2013 (UTC)


What about when the Totient of n is 1 or 2 ?[edit]

If for example p=2 and q=2 (both valid prime numbers) then the totient is (p-1)*(q-1) = (2-1)*(2-1) = 1. Also, if p=2 and q=3 the totient will be 2. Since in the next step the value e must be a random integer greater than 1 but less than the totient, how is that specific condition to be resolved? 2 and 3 are both valid prime numbers, so it is possible (but highly unlikely) that both p and q will be 2, or that one will be 2 and the other will be 3 when the random prime number generator is creating the values for p and q. How is the algorithm to proceed then? Does it have to go back and regenerate values p and q? 76.104.145.19 (talk) 07:43, 4 January 2014 (UTC)

The security of RSA is based on the difficulty to factor n = pq. This implies that none of p, q and |p-q| is small. In practice, the random prime generator is designed to produce p and q in some predefined range. For example, for a n with 600 digits, one choose p with, say, 200 digits and q with 400 digits. Thus small primes like 2 and 3 are never generated. D.Lazard (talk) 09:42, 4 January 2014 (UTC)


Any unusual conditions when RSA does not work?[edit]

I wrote a simple VB6 (Visual Basic 6) program to test RSA. For simplicity I used 1-byte random prime numbers for P and Q, which produced 2-byte numbers for the totient, the modulo, and the keys E and D. I'm not sure what the conditions are yet, but I've found that even when E and D are multiplicative inverses as calculated by finding a value of D that makes (D * E) mod totient = 1, D is NOT necessarily able to decrypt a number that had been encrypted with E (it usually does, but sometimes it doesn't). I made sure all the values were calculated according to the Wikipedia article. Totient = (P-1)*(Q-1). Modulo = P*Q. E is a random value greater than 1 and less than the totient, and who's GCD is equal to 1. Everything has been calculated to Wikipedia's specs. Yet, I'm not always able to decrypt a number that has been encrypted. It fails about 1 time out of 15 times. Sometimes more, sometimes less. The only thing I can think of is that the Wikipedia article is not complete in listing special conditions in which RSA actually fails, and an encrypted number is unable to be decrypted. E and the totient is all I should need to encrypt a number, and D along with the totient is all I should need to decrypt it. I've double checked my program, and can't find any bugs in the code. So I assume something may be missing or inaccurate in the Wikipedia article.


Ok I think I found the problem. It happens when P=Q. 76.104.145.19 (talk) 09:58, 4 January 2014 (UTC)

That one is in the article: Choose two distinct prime numbers p and q. Digital Brains (talk) 10:10, 4 January 2014 (UTC)

I just found the problem still occurs, even when the two random prime numbers are different from each other. I thought I solved it, but that was apparently only one of the conditions that triggered this problem. I'm finding that sometimes encrypted numbers are still not decryptable. And I can't find the cause. None of the numbers are equal to each other. Is it possible that certain mathematical relationships between some of the numbers that are extremely unlikely to occur in 1024bit numbers (but are fatal to the RSA algorithm if they do occur) are highly likely when working with small numbers? Is there something I'm missing, or is there a mistake in the article somewhere? 76.104.145.19 (talk) 10:14, 4 January 2014 (UTC)

If you give an example of all the numbers where your decryption goes wrong, someone might be able to pinpoint where it goes wrong. Please do give all of p, q, d, e, m, and c. And if I just now forgot an important one, include that one as well ;). Digital Brains (talk) 10:18, 4 January 2014 (UTC)

It seems that when E is equal to the modulo this also happens. The result is that the encrypted value is 0. And there's no way to decrypt the value of 0 it seems. And also it seems if for any reason the input number encrypts to the value of 1, then it also is not decryptable. So basically if it encrypts to 0 or 1 then it gets "stuck" at 0 or 1, and can't be decrypted. Of course that makes sense because 0 to the power of anything is 0, and 1 to the power of anything is 1. How an encrypted value could end up being 0 or 1, I don't know. Theoretically that shouldn't happen if everything else in the algorithm is correct. But that's not the only times it has failed. Here's one that makes no sense at all.

P=7
Q=11
Totient=60
Modulo=77
E=37
D=13
input number = 79
encrypted number = 51
result of decrypting encrypted number = 2

Something is VERY wrong here. Any idea what's happening? 76.104.145.19 (talk) 10:53, 4 January 2014 (UTC)

  • Choose an integer e such that 1 < e < φ(n), so e can not be as large as the modulo which is larger than φ(n)
  • He first turns M into an integer m, such that 0 ≤ m < n, so your example m = 79 is not valid. In fact, 79 ≡ 2 (mod 77), so your message is 2, and it decrypts fine.
Since everything is done either modulo φ(n) or modulo n, numbers in general can't be bigger than that because they'll get "truncated". Digital Brains (talk) 11:12, 4 January 2014 (UTC)

I finally got it working. Thanks for all the help you guys provided. 76.104.145.19 (talk) 02:34, 5 January 2014 (UTC)

key generation[edit]

"Using λ instead of φ(n) allows more choices for d " ? this is not the contrary? λ is smaller than φ(n). In fact with the mod. we have the same computing...if you talk about lcm it's important maybe to compare the key generation by Euler and by Carmichael. For example with Euler way, computation is faster than with Carmichael way. With Carmichael in reseach it s more clear because the Interval is smaller and more clear, we don't have repetitions. --Mbachkat (talk) 23:02, 14 May 2014 (UTC)

what if m=p or m=q?[edit]

The Euler theorem says m and n=p*q should be coprime, but in practice, m might be p or qo. What will happen in that case? Jackzhp (talk) 22:17, 23 June 2014 (UTC)

this is answered in the section titled "Proof using Fermat's little theorem" Jackzhp (talk) 22:30, 23 June 2014 (UTC)

open a file[edit]

I am unable to open my picture files. How can I fix this? — Preceding unsigned comment added by Njblondie (talkcontribs) 22:26, 28 December 2014 (UTC)