Sign and encrypt the file at the same time
OpenPGPBlackbox allows you to encrypt and sign your files at the same time. In this scenario you get the benefits of both security technologies to provide the confidentiality and authenticity of the data. The file thus is transmitted in encrypted form, and the recipient can verify its integrity by validating your signature over the decrypted data.
Encrypting and signing files with OpenPGPBlackbox is quite straightforward. What you do is set up encryption and signing parts independently – as you would do for just-encryption or just-signing routines – and then make the component use them together by calling EncryptAndSignFile() method. That is,
myKeys.Load(“pubring.pkr”, “secring.skr”); encryptionKeys.AddPublicKey(myKeys.get_PublicKeys(encKeyIndex)); signingKeys.AddSecretKey(myKeys.get_SecretKeys(sigKeyIndex));
pgpWriter.EncryptingKeys = encryptionKeys; pgpWriter.SigningKeys = signingKeys;
pgpWriter. SymmetricKeyAlgorithm = SBPGPConstants.Unit.SB_PGP_ALGORITHM_SK_AES256;
pgpWriter.Armor = true;