Subject: Public-key crypto (aka, rampant CS nerd-out)
Author:
Posted on: 2016-04-20 05:46:00 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Yay, I get to nerd out about theoretical CS!
So, broadly, I'm using a public-key cryptosystem. In this case, GPG. The idea behind this sort of thing is that I generate a keypair, which contains a public and private key. I tell everyone the public key, and keep the private key secret. If you "apply" one key to some message and then apply the other key to the result of that, the original message comes out. However, undoing an application of one key is extremely computationally difficult[1], so the only way to retrieve a message that's been locked with a private/public key is to use the public/private key to unlock it.
If you want to say something to me secretly, you apply the public key and send me the result of that. Then, since I'm the only one who knows the private key, I'm the only one who can finish the math and read your message. In reality, there's a few other things you have to do to make this more secure, but yeah.
Signatures (which is what I'm using) are the opposite process. I take my message[2] and apply my private key to it to create the signature. Then, anyone can take my public key and apply it to the signature. Then, they check if the message they're seeing is what I've signed. If that happens, that means that I (or at least, someone who has my private key) signed the message.
So, no, they can't copy paste the weird block at the end, unless they plan to repost, bit for bit, the message it was attached to. Otherwise, checking the signature will show that the message was tampered with, because the text it's attached to won't match what was signed.
[1]: The underlying cryptography involves choosing two large primes p and q. Then you take N = p * q, and find e and d such that e * d = 1 (mod (p - 1)(q - 1)). This means that (m^e)^d = (m^d)^e = m (mod N), but given N and e, finding d requires factoring a number that's a product of two primes. So, I tell you N and e, but keep d secret. (Finding d from N and e requires time proportional to (something > 1) to the 4096, in our case.)
[2]: Sorry, lied. What I do is run my message through (in this case) SHA256, a function that goes from data to a 256-bit integer in a way that is currently impossible to generate collisions for. That is, if I tell you the SHA356 output (or hash) I want, you have no way to create an input that is different from mine and gives that hash without at least NSA-level computing power. Then, I do the signature thing to the hash, which is close enough to signing the message and avoids some other attacks.
(Let us pray that there is no polytime algorithm for prime factorization, that P != NP, and that quantum computing is impractical)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJXFwk7AAoJECoUIwgjiOkk314QALwxYOst5j1Qnlz/kBTwg+mH
l/Mu9kuJ2E/G9GcvfjnGMlHrk5W0Z6XvuY88OHfEfYr5OML/9PAstOglmzz4ZOA4
j1b2X08JYnrT1HgYfjGOV6lSHcaaTWEC7/N59GRijf/ebuVvg4/hENRxfZenknHd
GOszQlfCP2ilNuop39bK/dKYCcwWi3HPp+JvYBE8rH63f4T7GzpWJmFKfbCuGbaD
7pppOUipn5J2wI7fZsDObHrAFQlbhC7riTuSKL8MAcBpDKVCUavaZy0hinYDDntB
vUkj6nDcmY7GEtinUuWmtX4jJ7MXHfhnSJQBqS5kqx1PCR16W4Qd8XqHDijrgvQO
HgMxknLUdiNFWlLdv/qvTdQkylcs0ZjP1R+NCIMrDSgV4PdDuuf64Xu17HTSWch9
DjBoGQ07nVhMFYQqOY2ArzgZgzbCTQpM0DfTHpXYL0wB59NMiw2Ni3N85fL8ynyx
IID8bqs6/24Po+BK+nALvosUYLwpBpPxwscUrwTFwNCoUKAqC5aeJ1WAEYgf2+wr
fUmewd005PWseqh0Zr1NyVPh/iriSLt/KHWJ+8mBqEoLfMhAcrov6Nc3/t6YmFiK
sJpKGBfO7DouBjs3qeCMOP7M3hSE3A/7oeO9T71It+tKlkuEsM7WF3Hcd36gUubk
ZC4xHxKo1h0qlKGvsMp0
=d7aR
-----END PGP SIGNATURE-----