...A person who commits either of the following acts is guilty of a felony and may be sentenced to imprisonment for not more than five years or to payment of a fine of not more than $10,000, or both:(1) possesses a dangerous weapon, ammunition, or explosives within any courthouse complex; or(2) possesses a dangerous weapon, ammunition, or explosives in any state building within the Capitol Area described in chapter 15B....

...this subdivision does not apply to...persons who carry pistols according to the terms of a permit issued under section 624.714 and who so notify...the commissioner of public safety....