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).
For browser, there is a webapp that can be selfhosted. See here https://github.com/logseq/logseq/blob/master/docs/docker-web-app-guide.md
I think you need chromium browsers due to the API they use, but it should work.