In this paper we construct a numerical technique capable of solving Maxwell's equations in frequency domain, both in vacuum and in cold magnetized plasma, with a boundary condition that guarantees the existence of a potential associated with the radiofrequency electric fields tangential to certain surfaces. This potential is of interest to nonlinear sheath physics, since it enables the calculation of the time-dependent sheath current excited by a single-frequency electromagnetic wave, and thereby the associated DC sheath current and sheath potential.