An application that I maintain uses Sparkle Update to update itself. I expect attacks from high level attackers (China, USA's NSA, etc.) and have some questions about how secure the cryptography Sparkle uses actually is. Specific examples of good practices would be much appreciated.
- Creating public/private signing keys.
Sparkle uses the following to create public/private signing keys:
openssl dsaparam 2048 < /dev/urandom > dsaparam.pem openssl gendsa dsaparam.pem -out dsa_priv.pem openssl dsa -in dsa_priv.pem -pubout -out dsa_pub.pem
1.1 Is using "/dev/urandom" a good idea on OS X?
1.2 Are there any other problems here? (I will probably generate a 4096-bit or larger key instead of the 2048-bit one.)
- Signing the application
Sparkle protects from forged updates by signing the updates. It uses the following to generate a signature:
openssl dgst -sha1 -binary < in-file | openssl dgst -dss1 -sign private-key-file
Would changing it to
openssl dgst -sha256 -binary < in-file | openssl dgst -dss1 -sign private-key-file
(and changing the signature verification to verify the signature on a SHA256 hash, of course)
be enough to avoid the weakness in SHA1?
Or is there also a problem with "openssl dgst -dss1"?
Thanks in advance.