What a coincidence! Earlier today, I was wondering whether SSH could be used in place of GPG for encrypting messages; a common answer was that SSH was designed for a different purpose and that it wouldn't make sense to use it this way.
And here you've shown how it could be done. The script is interesting and educational to read through. Thanks for sharing.