How to do a factory reset without access to the phone's system I was preparing to sell my nexus 4, so I encrypted it. Unfortunately I forgot the password, now that I need the phone again.

All I get is:


  To start Android, enter your password


How do I reset it? I removed every data I might need from it.
There is a guide on resetting the Nexus 4 over here. This is what the website says:
1. Turn your Nexus 4 off
2. Press and hold Volume DOWN + POWER
3. In the recovery menu, press volume down twice
4. Press power. You will see a red exclamation mark
5. Press power + volume UP
6. Go to `Wipe data/ Factory reset` and press the power button
7. Scroll to `Yes - delete all user data` and press the power button

The hard reset will take a minute and after that your Android phone will reboot.

All credit goes to hard-reset.com
Keep in mind that the reset may not be as safe against identity fraud as it seems. There is a bug in the reset feature that causes the phone to reset its state to default, but the encryption keys are not wiped. This means that any leftover data can be easily brute-forced and your old (sensitive) data may be decrypted.
I would suggest you reset your phone, encrypt it again with a different PIN just to be sure, and then reset the phone again to make sure nobody can access your data. This way, the encryption keys should be reset and your data would no longer be vulnerable.
If you really want your data to be safe, you could fill the internal storage after the first reset so almost all leftover data is overwritten. Because of things like remapping bad sectors etc. there still might be a little bit of data left, but that is virtually nothing.
Look at this article for more information about this bug