In RSA the message length should not exceed the (keysize/8) bytes. Why is there such a restriction? What is the input(say "abcde") converted into before feeding it into the RSA algorithm and where doest it take into account the size of the the input string "abcde"?
相关问题
- Mechanize getting “Errno::ECONNRESET: Connection r
- Tomcat and SSL Client certificate
- Can we add four protocols to ServicePointManager.S
- .NET Core gives unknown error while processing HTT
- JDK 11. javax.net.ssl.SSLPeerUnverifiedException:
相关文章
- ssl配置问题
- Intermittent “sslv3 alert handshake failure” under
- Making a two way SSL authentication between apache
- decrypt TLS 1.2 AES-GCM packet
- How to use Jetty with Let's Encrypt certificat
- Sending email using php, gmail, and swiftmailer ca
- Can't pip install packages in python 3.6 due t
- How to get the size of a RSA key in Java
The RSA algorithm is essentially:
and to decrypt:
e
andn
together make up your public key, andd
andn
make up your private key.e
is usually one of a few common values, e.g. 65537,n
is the product of two large prime numbersp
andq
which should be unique to you, and defines the key length (e.g. 1024 bits). The value ofd
used to decrypt the ciphertext is calculated usinge
,p
andq
. Wikipedia has more detail if you're interested: http://en.wikipedia.org/wiki/RSA_(algorithm). Your plaintext is basically treated as a large integer when used in the RSA algorithm.In case you're not familiar with the modulo operator, it is basically the remainder when the left side is divided by the right side. E.g.
17 mod 5 = 2
as 5 exactly divides 17 three times (3 * 5 = 15
), leaving a remainder of:17 - 15 = 2
).As a result of the definition of the modulo operator, the result of
a mod b
is always less thanb
. Given this, and the fact that the decrypted value is the result of performing amod n
operation means that when decrypted, the resulting plaintext value will always be less than n. Hence, for this to be the actual plaintext you originally encrypted, the input must be less thann
.To guarantee this, the message is restricted to having fewer bits ("digits") than
n
. Since the number of bits inn
is the key size, it must must have fewer thankeysize bits
, orkeysize / 8 bytes
(since there are 8 bits in a byte).