Discuss this help topic in SecureBlackbox Forum

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,

  1. Load your encryption and signing keys into encryptionKeys and signingKeys keyrings:
    myKeys.Load(“pubring.pkr”, “secring.skr”);
    encryptionKeys.AddPublicKey(myKeys.get_PublicKeys(encKeyIndex));
    signingKeys.AddSecretKey(myKeys.get_SecretKeys(sigKeyIndex));
    
  2. Attach the keyrings to your TElPGPWriter object:
    pgpWriter.EncryptingKeys = encryptionKeys;
    pgpWriter.SigningKeys = signingKeys;
    
  3. Tune-up encryption and signing settings:
    pgpWriter. SymmetricKeyAlgorithm = SBPGPConstants.Unit.SB_PGP_ALGORITHM_SK_AES256;
    
  4. Tune-up additional settings, e.g. armouring:
    pgpWriter.Armor = true;
    
  5. Call EncryptAndSignFile():
    pgpWriter.EncryptAndSignFile("picture.jpg", "picture.jpg.pgp");
    

How To articles about file encryption and signing with OpenPGP

Discuss this help topic in SecureBlackbox Forum