Many encryption algorithms rely on the assumption that the factorizations of numbers in prime numbers has an exponential cost and not a polynomial cost (I.e. is a NP problem and not P, and we don’t know if P != NP although many would bet on it). Whether there are infinite prime numbers or not is really irrelevant in the context you are mentioning, because encryption relies on factorizing finite numbers of relatively fixed sizes.
The problem is that for big numbers like n=p*q (where p and q are both prime) it’s expensive to recover p and q given n.
Note that actually more modern ciphers don’t rely on this (like elliptic curve crypto).
Isn’t that a quote from Snatch?