With RSA or ECC, if I encrypt my private key with my public key, is there a way to recover my private key? Is there an algorithmic, mathematical, technical or implementation &quot;hack&quot; to recover the private key or is it definitively encrypted without any particular mathematical property, like any message M?
Although there is an answer here saying &quot;no&quot; for usual definitions, I want to strongly warn that there is no rigorous basis for that. Specifically, it is true that there is no known way of recovering a private key from an encryption of it with its associated public key. However, there is also no proof whatsoever that it isn't possible. Security of this kind is called &quot;circular security&quot; and there has been researching understanding it. In general, it is possible to achieve this in the random oracle model (quite easily - since the random oracle breaks the mathematical connection between the keys). Specifically, the encryption ${\sf enc}'_{pk}(m) = ({\sf enc}_{pk}(r), H(r) \oplus m)$ is circular secure when $H$ is modelled as a random oracle (meaning that it's secure when taking $m=sk$ or the like), as shown by Camenisch-Lysyanskaya in their EUROCRYPT 2001 paper titled An Efficient System for Non-transferable Anonymous Credentials with Optional Anonymity Revocation. However, in general, there are no reductions from the security of the encryption scheme in general to the case of encrypting the private key, and one should be careful.