Regarding your first question, it is mostly prohibited with some possible exceptions (CYLOR before doing this in practice). I have bolded the specific issues identified by these poskim. Nearly all these issues apply to your second question as well.
R Shlomo Dichovsky (“Ha’azanat Seter” in Torah Shebe’al Peh 35, p. 57) is quoted here as writing
Although it would not be permitted to tap phones in general, and to
listen or publicize others’ conversations (because of prohibitions
such as publicizing others’ secrets, the cherem of R. Gershon, heizek
re’iah, and others, which are discussed by poskim), it would be
permitted for the sake of saving oneself from damage, based on the
principle of avid inish dina lenafsheh.
businesshalacha.com writes
In halachic literature (C.M. 228) [geneivas daas] is classically
described as the act of misleading and deceiving someone in a manner
that will cause this person to mistakenly feel morally indebted, even
though he is not actually indebted. Thus secretly recording someone
does not violate the prohibition of geneivas daas. Nevertheless we do
find authorities who would consider such an act geneivas daas (see
Chikekei Lev 1, Y.D. 49 and Pele Yo’etz, Geneivah).
But there are additional issues to consider. This act may possibly
violate the Cherem D’Rabbeinu Gershom (Be’er Hagolah, Y.D. 334), who
prohibits reading other people’s correspondence. It is debatable
whether this ban extends to all manner of communication or whether it
is limited to written correspondence. It is obvious that, at the very
least, it constitutes a violation of v’ahavta l’rei’acha kamocha (see
Chikekei Lev ibid., which suggests this as the underlying rationale
behind Rabbeinu Gershom’s cherem).
Additionally, some write that it is prohibited to reveal a friend’s
private concerns, which is an extension of the prohibition of
tale-bearing (rechilus). If one may not tell tales to others, one may
certainly not seek tales for himself (Halachos Ketanos 1:6).
Some contend that secretly recording conversations is a form of hezek
re’iyah — the prohibition against causing damage by gazing at another.
It is broadly defined as the prohibition against violating another
person’s privacy, even if he is aware of it, as he might be too
embarrassed to protest.
Chazal relate that when Bilam observed that placement of the tents of
the Jews was done in a way that assured each one’s privacy, he
commented that that made them worthy to receive the Divine presence
(see Shulchan Aruch Harav, Nizkei Mammon 11:13). The obvious extension
of this principle is that secretly recording a conversation is a
violation of privacy and represents a lack of tznius.
Nevertheless, for purposes of chinuch it may be permitted to secretly
record a conversation when necessary (see Rashba 1:557), for example,
to afford one the opportunity to prevent someone from sinning or to be
able to recover money that is owed to him (Pele Yo’etz).