How do I encrypt a QR Code with java?
Now I can generate and decode QR code with java base but I want to know how to put a password on my qrcode to protect it or encrypt my qrcode with something
Has anyone done something similar or is there sample code available?
Thank you so much
You can put any data you like in a QR code. For example https://chart.googleapis.com/chart?chs=300x300&cht=qr&chld=M|1&chl=abc123 Will produce a code with the data abc123.
Once you have your encrypted data, you can then generate a QR code.
For example, this QR code https://i.sstatic.net/UsFdQ.png
Contains the message
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.5 (FreeBSD)
Comment: This is what your message looks like after encryption.
hQEOA1e+1x6YuUMCEAP+J/+0smoM/5aWiJZ7r+WsVKwbQ4xYJ1ftqGePeM5EnCAR
3d+Ai/4A3be615RFQ636RguSjJIKuoJCaHt/P6LH78ZX3xmOwucpmNYBCv1wN15X
gpdhOxtBnAx1aqI7sbrfTarKsZIY2Aqblgarq71dr0Kv7wCu1eGCg1YK7O2keOED
/AqTH8US94iceM9bRGIGk/SubV1e0Fw/kMc4J5wr2JHbifD+yNQvKIC87lQydLlC
2ZqOB2ed2OKsplB3zuoaWgV1skhRimLubehxkkJpiooKVVVnhVJh0w6kHWrYTV7T
MOSaduQBakPNoDUGIhvDkpU8N6uUs7F1xvr7vwoIim4C0kYBaDolzRjgmOq0QfvN
vF3Rc6ZlFqCfihpQgAAmboHa/uZxE0cP37UssaL6O0beLhCHWH/X8sUeEHmXEHLh
J+tL3EaO750a
=c8iI
-----END PGP MESSAGE-----
You may need to make sure there are line breaks when generating the data.
There is no way, that I am aware of, to password protect a QR. The best you could do is point it to a URL and then ask for a password on the website.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With