I seem to have misunderstanding here.
I need to implement public/private key encryption (PKCS) with digital signing. I've found the following classes in .Net framework.
- RSACryptoServiceProvider
- DSACryptoServiceProvider
I want to encrypt files then digitally sign them, and at the receiver verify the signature and then decrypt.
The class DSACryptoServiceProvider has the function VerifySignature which takes both the signed signed value and the un-signed value!
My question here is whether to encrypt-then-sign or sign-then-encrypt?
If i send the un-signed key (along with the signed key) of the encryption key, then any third party will be able to decrypt the text