RSA

RSA is the most widespread and used public key algorithm. Its security is based on the difficulty of factoring large integers. The algorithm has withstood attacks for more than 30 years, and it is therefore considered reasonably secure for new designs.

The algorithm can be used for both confidentiality (encryption) and authentication (digital signature). It is worth noting that signing and decryption are significantly slower than verification and encryption.

The cryptographic strength is primarily linked to the length of the RSA modulus n. In 2017, a sufficient length is deemed to be 2048 bits.

[RSA Key Generation]

RSA Key Size(bit)

공개키(Public Key, PEM)

개인키(Private Key, PEM)

키 요소: 공개키(n, e), 개인키(n, e, d, p, q, u)
\[\begin{split}\begin{align} p*q &= n \\ e*d &\equiv 1 ( \text{mod LCM} [(p-1)(q-1)]) \\ p*u &\equiv 1 ( \text{mod } q) \end{align}\end{split}\]

[RSA 암/복호화: PKCS1_OAEP]


공개키 암호화

입력(평문)

공개키(PEM)

암호문=\(평문^{e} \text{mod }n\)  (base64)

개인키 복호화

입력 암호문(base64)

개인키(PEM)

평문=\(암호문^{d} \text{mod }n\)

[Digital Sign: PKCS#1 v1.5 (RSA, SHA256)]


전자 서명

입력(평문)

개인키(PEM)


해쉬값(SHA256, hex)

서명값(hex)

서명 검증

원문(평문)

서명값(hex)

공개키(PEM)

검증 결과