If one effectively guesses the correct passcode to the lock so as to open it without causing any damage and then peacefully enters (seemingly a mere civil trespass) the (previously) secured premises, do they commit any criminal offence?

  • 20
    I belive the OP is alluding to the idea of "brute forcing" a cypher's key: ie trying every possible key until one works, rather than "using brute force to open the door".
    – James K
    Apr 22, 2023 at 20:18
  • 18
    Yes, here "brute force" means trying every combination, not physical force.
    – kaya3
    Apr 22, 2023 at 20:54
  • 6
    Since ‘brute forcing’, while an established term in cryptography, has led people to misunderstand the question, I've submitted an edit to add scare quotes in the title. Apr 23, 2023 at 1:42
  • 4
    @ilkkachu : How about picking a lock? While more sophisticated than brute forcing, it's similar in that it doesn't cause any damage (ideally). Apr 23, 2023 at 14:20
  • 2
    @TobyBartels, similar to an exhaustive (brute force) search of the combination, in that it involves some effort and not just an off-hand attempt, yes.
    – ilkkachu
    Apr 23, 2023 at 15:19

5 Answers 5


None, if the intention is merely trespassing, unlike burglary which requires intent to steal, commit criminal damage, or inflict grevious bodily harm or if the building is a protected site - neither of which isn't evident from the question.

Note, for both offences, the actus reus is entry - there is no requirement for any form of "breaking"

Further to ohwilleke's comment, unless the lock is damaged or destroyed etc, then there is no offence of criminal damage

  • 1
    What if the lock’s useful value is effectively reduced to zero by the code guessers knowing the combo? I suppose it still retains exchange/resale value if there has been no damage as such. Apr 21, 2023 at 21:23
  • 10
    @Seekinganswers Most locks can be re-keyed or have their combinations changed, so someone figuring out your combination shouldn't make the lock worthless.
    – bta
    Apr 22, 2023 at 4:10
  • 1
    I was about to comment "it is also burglary if the intent is to rape" - but I see that was repealed in 2004, and replaced with a separate offence. Apr 24, 2023 at 8:50
  • What would be necessary to charge someone with attempted breaking and entering?
    – supercat
    Apr 24, 2023 at 15:15
  • Does this change if someone else comes along and exploits the security being disabled?
    – Nat
    Apr 24, 2023 at 23:16

This would be breaking and entering contrary to s. 348 of the Criminal Code.

"Breaking" under this offence means "to break any part, internal or external, or ... to open any thing that is or intended to be used to close or cover an internal or external opening" (s. 321).

A person is deemed to have broken and entered if they "enter[] without lawful justification or excuse by a permanent or temporary opening" (s. 350). Even entry through an unlocked door, when it is done without consent, is deemed to be breaking and entering. See Todorov c. R., 2015 QCCA 812.

  • Probably some sort of vandalism/destruction of the lock itself charge as well.
    – ohwilleke
    Apr 21, 2023 at 18:18
  • 8
    Really? By successfully guessing and then entering its correct combination? Apr 21, 2023 at 21:21
  • 3
    @Seekinganswers yes, 'breaking' really refers to circumventing the lock on the door. Whether that is by hitting it with a hammer, or picking it, a crow bar, kicking the door in, or spending an hour guessing combinations until it opens (which is what a safe cracker does by the way), the result is an open door allowing you to walk in.
    – fabspro
    Apr 22, 2023 at 0:57
  • 4
    @ohwilleke I don’t see how you could consider the opening of a lock to be “vandalism/destruction”. Locks are usually meant to be opened without damage, after all. Physically, there is no difference from that and someone who knows the combination already opening the lock. Apr 22, 2023 at 2:14
  • 12
    @ohwilleke ahh, that's a mixup of terminology. In terms of combinations & passwords, "brute forcing" simply involves trying many, many guesses until you get it correctly. One might do "1111", "1112", "1113", and so on. For small enough combinations, this is feasible to do manually. No actual physical damage required. Apr 22, 2023 at 20:03

Unlawful entry on Inclosed Land

Under s4 of the Inclosed Lands Protection Act 1901:

(1) Any person who, without lawful excuse (proof of which lies on the person), enters into inclosed lands without the consent of the owner, occupier or person apparently in charge of those lands, or who remains on those lands after being requested by the owner, occupier or person apparently in charge of those lands to leave those lands, is liable to a penalty not exceeding …

There is an additional penalty if you don’t close the door when you leave. Because the Act is primarily about protecting agricultural land and leaving gates open can lead to stock wandering but it is applicable to all land.

  • 2
    "proof of which lies on the person" ─ Does this mean that the burden of proof lies on the person? That would make more sense than my first reading, which was that the person must be carrying the evidence on their person.
    – kaya3
    Apr 22, 2023 at 20:57
  • 2
    @kaya3 yes, that’s what it means
    – Dale M
    Apr 22, 2023 at 21:20
  • NSW also has "unlawfully on premises" offense, like the other states. This is an additional offense -- in Victoria, it is part of the Crimes act.
    – david
    Apr 24, 2023 at 3:18

This answer assumes no intent of wrongdoing other than opening the lock was proven by the prosecution.

Tampering with security devices is a class 4 felony. The bold text below is mine.

(720 ILCS 5/17-11.5) (was 720 ILCS 5/16-22)
Sec. 17-11.5. Tampering with a security, fire, or life safety system.
(a) A person commits tampering with a security, fire, or life safety system when he or she knowingly damages, sabotages, destroys, or causes a permanent or temporary malfunction in any physical or electronic security, fire, or life safety system or any component part of any of those systems including, but not limited to, [...] (a long list of devices) [...].
(b) Sentence. A violation of this Section is a Class 4 felony.

The lock suffered a temporary malfunction, as it was not doing its job of keeping the door closed. The security feature was also sabotaged (though not harmed), not fulfilling its function, when it was left open.


Sabotage is the act of hampering, deliberating subverting, or hurting the efforts of another.

In this case, the efforts of whoever wanted the door to stay locked were sabotaged.

Did the intruder tamper with the lock?


Tampering is an intentional act of interfering improperly or in a harmful manner. [...]

By switching the lock to "open" without permission, the person exposed the secured area to intruders (and became one in the process). Testing combinations until the correct one was entered is an intentional act. The opening of the lock is harmful as it compromises the security of the venue.

The trespasser, aside from civil charges, can also face 1 to 3 years in prison and fines up to USD 25k. (730 ILCS 5/5-4.5-45)


Summary Offences Act 1966, Section 9(1)(e)

without express or implied authority given by the owner or occupier or given on behalf of the owner or occupier by a person authorised to give it or without any other lawful excuse, wilfully enters any private place or Scheduled public place, unless for a legitimate purpose; or

Normally prosecuted as "unlawfully on premises". Note: for whatever reason, section 9 is titled Wilful destruction, damage etc. of property, which makes it a little harder to find. This is a summary offense tried by a magistrate without a jury, so "lawful" and "legitimate" are not complicated legal terms: they limit rather than extend the terms "excuse" and "purpose".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .