# Decrypt AES key with RSA public key

So here's my problem: I have 3 files. One is ciphertext.enc, which is a text encrypted using AES 256. The second one is key.cipher, which is ciphertext.enc's key. This key.cipher was encrypted using a public RSA key. The third file is pub.key, the public RSA key used to encrypt key.cipher. Is also known that openssl was used to perform these encryptions. No more information is given.

The objective is to obtain the original text contained in ciphertext.enc, but i'm a little lost on how to procceed. I understand the basics behind AES and RSA, but i'm not familiar with them in practice, specially openssl. How should i procceed with this problem?

UPDATE

The pub.key may actually be the RSA private. This is part of an exercise which i couldn't find an answer.

Also, just to clearify the problem: I have a message encrypted with AES. I also have the AES key, but the key was encrypted using the RSA key pub.key (which acording to the exercise is a public key). The objective is to find out what is the message - probably breaking key.cypher in order to decrypt ciphertext.enc.

• Is that a school/course excercise? As the problem is - lets assume pub.key is an RSA public key nad key.cipher is the encrypted AES key. To decrypt the key.cipher you need a private key (not the public one). So - either the pub.key is the private key (just naming is wrong) or (when properly done) you cannot do much about it. For some excercises (homeworks) there are apparent weaknesses/mistakes, but that is not obvious in your question. Or - maybe the key is already decrypted (available), however without proper encryption mode you may just guess (try all available) – gusto2 Nov 23 '17 at 8:26
• I'm voting this as "unclear what you are asking" for the reasons gusto2 gave. Basically you are asking to reverse AES or RSA without the secret or private key. Well, that's not possible unless there were mistakes during key generation or encryption. – Maarten Bodewes Nov 23 '17 at 11:47
• Yes, it is an exercise, but i found no answers to it. It was said that key.cipher was encrypted with a public RSA key and this key is contained in pub.key. I'll update OP saying it may be the private key, but this isn't what the problem say. Also will try to be more specific about what i need. – Fuga Nov 23 '17 at 17:25
• How big is N in the public key? - A real life N would be 1000+ bits, but if your N is more in the range of 100 bits, then factoring N to break the RSA key becomes much more feasible – Eugene Styer Nov 23 '17 at 17:38