I would make two points in response.
First, your factors that might make someone not remember a password are all real, but the judge can take them into account. The judge can weigh up the different possibilities - that's what they are employed and trained to do - and decide whether it's plausible that the defendant cannot recall the password. Often they will probably conclude that the prosecution hasn't proved that the defendant could remember the password; sometimes, though, there will be enough evidence. Unless you are arguing that there is no amount of evidence that can prove this beyond reasonable doubt - in which case, see my second point, which is that this is not restricted to this situation - I don't think your factors prevent the law working (although obviously they must be borne in mind).
Second, your example of the seemingly pre-meditated murder is at the extreme end of the evidence available, but there are lots of situations that are much more difficult. For example:
i. A person gives incorrect financial information to an investor and profits as a result. If they knew it was incorrect they may be guilty of fraud. Did they know it was incorrect at the time?
ii. A person is a passenger in a stolen car. If they knew it to be stolen at the time they may be guilty of an offence. Did they know it was stolen when they got in (assume they weren't involved in the theft)?
iii. An accountant receives money from his client, which unknown to him was stolen. If he suspected at the time that the client might be engaged in criminal conduct, he may be guilty of a money laundering offence. Did he suspect?
You could find hundreds more examples - those are just three that occurred to me off the top of my head, and probably aren't the most troublesome. The point is that proving whether a defendant actually knew a particular fact, or actually had a particular thought, is a common issue in criminal prosecutions. It can be difficult to prove, but it's not impossible and the courts are used to dealing with these types of case.