Class KeyForVerification

java.lang.Object
org.c02e.jpgpj.Key
org.c02e.jpgpj.key.KeyForVerification
All Implemented Interfaces:
Cloneable

public class KeyForVerification extends Key
Key that should be used exclusively for encryption.

Regardless of PGP usage flags associated with the original key source, all subkeys of this key will be flagged to be used for verification and nothing else (so the Decryptor will try all subkeys of this key when verifying, but will ignore all subkeys when decrypting; and the Encryptor will ignore this key entirely).

Use like the following:


 new Decryptor(
     new KeyForVerification(new File("path/to/my/keys/alice-pub.gpg")),
     new KeyForDecryption(new File("path/to/my/keys/bob-sec.gpg"), "b0bru1z!")
 ).decrypt(
     new File("path/to/ciphertext.txt.gpg"),
     new File("path/back-to/plaintext.txt")
 );
 
See Also:
  • Constructor Details

    • KeyForVerification

      public KeyForVerification()
      Constructs a new empty key.
    • KeyForVerification

      public KeyForVerification(List<Subkey> subkeys)
      Constructs a new key with the specified subkeys.
    • KeyForVerification

      public KeyForVerification(String armor) throws IOException, org.bouncycastle.openpgp.PGPException
      Loads first key from the specified armored text.
      Throws:
      org.bouncycastle.openpgp.PGPException - if the text contains no keys.
      IOException
    • KeyForVerification

      public KeyForVerification(File file) throws IOException, org.bouncycastle.openpgp.PGPException
      Loads first key from the specified file.
      Throws:
      org.bouncycastle.openpgp.PGPException - if the file contains no keys.
      IOException
    • KeyForVerification

      public KeyForVerification(InputStream stream) throws IOException, org.bouncycastle.openpgp.PGPException
      Loads first key from the specified input stream.
      Throws:
      org.bouncycastle.openpgp.PGPException - if the input streame contains no keys.
      IOException
  • Method Details

    • setSubkeys

      protected void setSubkeys(List<Subkey> x)
      Description copied from class: Key
      All subkeys, or an empty list.
      Overrides:
      setSubkeys in class Key
    • setSubkeysUsage

      protected void setSubkeysUsage()