<div class="protonmail_signature_block"><div>Hi,<br></div></div><div><br></div><div>Even though I have used openssl or ssh-keygen for years to generate key pairs mainly for SSH purposes, I don't know much about the underlying theory and finer details of cryptography.<br></div><div><br></div><div>I want to use JSON Web Encryption (JWE) and there we have this concept of Key Encryption. Key Encryption can be done using RSAES-PKCS1-v1_5 or RSA-OAEP or RSA-OAEP-256 (c.f. <a href="https://tools.ietf.org/html/rfc7518#section-4.2">https://tools.ietf.org/html/rfc7518#section-4.2</a> and <a href="https://tools.ietf.org/html/rfc7518#section-4.3">https://tools.ietf.org/html/rfc7518#section-4.3</a>).<br></div><div><br></div><div>The question is how can I use openssl command line tool to create a public key using RSAES-PKCS1-v1_5, RSA-OAEP, or RSA-OAEP-256 (paddings?)?<br></div><div><br></div><div>At the moment, I use the following command to create a PEM file:<br></div><div><br></div><div>openssl genrsa -out example.pem 2048<br></div><div><br></div><div>Then I use the following command to extract the public key:<br></div><div><br></div><div>openssl rsa -in example.pem -pubout example.pub<br></div><div><br></div><div>What padding is used for this public key? How can I specify that I want it to be generated with RSAES-PKCS1-v1_5, RSA-OAEP, or RSA-OAEP-256 paddings?<br></div><div><br></div><div>Thanks in advance,<br></div><div>Socrates<br></div><div><br></div>