well, if you mean decrypt the data, then now we have webusb, it allows almost any usb device to be used by web script. i still making some research on it so about this i have no sample or idea.
but if you mean just encrypt via OpenPGP, that just require a public key...
you can refer to https://key.stevezmt.top/tools/encrypt_sample.html