PKCS 1 explained
In cryptography, PKCS #1 is the first of a family of standards called Public-Key Cryptography Standards (PKCS), published by RSA Laboratories. It provides the basic definitions of and recommendations for implementing the RSA algorithm for public-key cryptography. It defines the mathematical properties of public and private keys, primitive operations for encryption and signatures, secure cryptographic schemes, and related ASN.1 syntax representations.
The current version is 2.2 (2012-10-27). Compared to 2.1 (2002-06-14), which was republished as RFC 3447, version 2.2 updates the list of allowed hashing algorithms to align them with FIPS 180-4, therefore adding SHA-224, SHA-512/224 and SHA-512/256.
Keys
The PKCS #1 standard defines the mathematical definitions and properties that RSA public and private keys must have. The traditional key pair is based on a modulus,, that is the product of two distinct large prime numbers, and, such that
.
Starting with version 2.1, this definition was generalized to allow for multi-prime keys, where the number of distinct primes may be two or more. When dealing with multi-prime keys, the prime factors are all generally labeled as
for some, such that:
for
As a notational convenience,
and
.
The RSA public key is represented as the tuple
, where the integer is the public exponent.
The RSA private key may have two representations. The first compact form is the tuple
, where is the private exponent. The second form has at least five terms, or more for multi-prime keys. Although mathematically redundant to the compact form, the additional terms allow for certain computational optimizations when using the key. In particular, the second format allows to derive the public key.
[1] Primitives
The standard defines several basic primitives. The primitive operations provide the fundamental instructions for turning the raw mathematical formulas into computable algorithms.
- I2OSP - Integer to Octet String Primitive - Converts a (potentially very large) non-negative integer into a sequence of bytes (octet string).
- OS2IP - Octet String to Integer Primitive - Interprets a sequence of bytes as a non-negative integer
- RSAEP - RSA Encryption Primitive - Encrypts a message using a public key
- RSADP - RSA Decryption Primitive - Decrypts ciphertext using a private key
- RSASP1 - RSA Signature Primitive 1 - Creates a signature over a message using a private key
- RSAVP1 - RSA Verification Primitive 1 - Verifies a signature is for a message using a public key
Schemes
By themselves the primitive operations do not necessarily provide any security. The concept of a cryptographic scheme is to define higher level algorithms or uses of the primitives so they achieve certain security goals.
There are two schemes for encryption and decryption:
There are also two schemes for dealing with signatures:
- : old Signature Scheme with Appendix (SSA) as first standardized in version 1.5 of PKCS #1. Unforgeable, according to Jager et al. (2018).[2]
- : improved SSA; based on the probabilistic signature scheme (PSS) originally invented by Bellare and Rogaway. Recommended for new applications.
The two signature schemes make use of separately defined encoding methods:
- : old encoding method for signature appendix (EMSA) as first standardized in version 1.5 of PKCS #1.
- : improved EMSA, based on the probabilistic signature scheme. Recommended for new applications.
The signature schemes are actually signatures with appendix, which means that rather than signing some input data directly, a hash function is used first to produce an intermediary representation of the data, and then the result of the hash is signed. This technique is almost always used with RSA because the amount of data that can be directly signed is proportional to the size of the keys; which is almost always much smaller than the amount of data an application may wish to sign.
Version history
- Versions 1.1–1.3, February through March 1991, privately distributed.
- Version 1.4, June 1991, published for NIST/OSI Implementors' Workshop.
- Version 1.5, November 1993. First public publication. Republished as .
- Version 2.0, September 1998. Republished as . Introduced the RSAEP-OAEP encryption scheme.
- Version 2.1, June 2002. Republished as . Introduced multi-prime RSA and the RSASSA-PSS signature scheme
- Version 2.2, October 2012. Republished as .
Implementations
Below is a list of cryptography libraries that provide support for PKCS#1:
Attacks
Multiple attacks were discovered against PKCS #1 v1.5, specifically its padding scheme.[3]
In 1998, Daniel Bleichenbacher published a seminal paper on what became known as Bleichenbacher's attack (also known as "million message attack"). The attack uses the padding as an oracle.[4] [5] PKCS #1 was subsequently updated in the release 2.0 and patches were issued to users wishing to continue using the old version of the standard.[3] However, the vulnerable padding scheme remains in use and has resulted in subsequent attacks:
- Bardou et al. (2012) find that several models of PKCS 11 tokens still use the v1.5 padding scheme for RSA. They propose an improved version of Bleichenbacher's attack that requires fewer messages. As a result of this improvement, they managed to extract the secret key from several models in under an hour. They also show that the AES-CBC scheme is vulnerable to a different padding oracle attack.[4] [6]
- Böck et al. (2018) report that many modern HTTPS servers are vulnerable to a variation of the attack. TLS 1.2 contains anti-Bleichenbacher countermeasures, but the workarounds are not correctly implemented in many software due to their sheer complexity.[7]
In 2006, Bleichenbacher presented a new forgery attack against the signature scheme RSASSA-PKCS1-v1_5.[8] Variants of this attack are reported in 2008[9] and 2014.[10] This class of attack exploits a flawed implementation of the signature verification; a proper implementation would not be vulnerable.[2]
See also
External links
- - PKCS #1: RSA Cryptography Specifications Version 2.2
Notes and References
- Web site: Can I get a public key from an RSA private key?. Ilmari Karonen. 27 October 2017. Stack Exchange.
- Jager . Tibor . Kakvi . Saqib A. . May . Alexander . On the Security of the PKCS#1 v1.5 Signature Scheme . 15 October 2018 . 1195–1208 . 10.1145/3243734.3243798 . The Second International Conference on Availability, Reliability and Security (ARES'07).
- Book: Jean-Sébastien Coron, Marc Joye, David Naccache, and Pascal Paillier. Advances in Cryptology — EUROCRYPT 2000 . 1807. EUROCRYPT. 2000. 369–381. 10.1007/3-540-45539-6. 978-3-540-67517-4. Lecture Notes in Computer Science. 8447520.
- Efficient Padding Oracle Attacks on Cryptographic Hardware. Romain Bardou . Riccardo Focardi . Yusuke Kawamoto . Lorenzo Simionato . Graham Steel . Joe-Kai Tsay. Rr-7944. INRIA. 2012. 19. report.
- – Preventing the Million Message Attack on Cryptographic Message Syntax
- Web site: A bad couple of years for the cryptographic token industry . A Few Thoughts on Cryptographic Engineering . en . 21 June 2012 . Matthew . Green .
- Web site: ROBOT attack: Return Of Bleichenbacher's Oracle Threat . Hanno Böck . Juraj Somorovsky . Craig Young . February 27, 2018 .
- Book: Analysis on Bleichenbacher's Forgery Attack. Tetsuya Izu . Masahiko Takenaka . Takeshi Shimoyama. The Second International Conference on Availability, Reliability and Security (ARES'07). 1167–1174. IEEE. April 2007. 10.1109/ARES.2007.38. 978-0-7695-2775-8. 2459509.
- Kühn, Ulrich; Pyshkin, Andrei; Tews, Erik; Weinmann, Ralf-Philipp (2008): Variants of Bleichenbacher’s Low-Exponent Attack on PKCS#1 RSA Signatures. SICHERHEIT 2008 – Sicherheit, Schutz und Zuverlässigkeit. Beiträge der 4. Jahrestagung des Fachbereichs Sicherheit der Gesellschaft für Informatik e.V. (GI). Bonn: Gesellschaft für Informatik e. V.. PISSN 1617-5468. . pp. 97–109. Regular Research Papers. Saarbrücken. 2.- 4. April 2008
- Web site: Advanced Threat Research Intel Security . 1 April 2015. https://web.archive.org/web/20150401143322/http://www.intelsecurity.com/advanced-threat-research/berserk.html . 2015-04-01 .