Package org.c02e.jpgpj.key
Class KeyForVerification
- java.lang.Object
-
- org.c02e.jpgpj.Key
-
- org.c02e.jpgpj.key.KeyForVerification
-
- All Implemented Interfaces:
java.lang.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
Decryptorwill try all subkeys of this key when verifying, but will ignore all subkeys when decrypting; and theEncryptorwill 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:
Key
-
-
Field Summary
-
Fields inherited from class org.c02e.jpgpj.Key
NO_PASSPHRASE, signingUid, subkeys
-
-
Constructor Summary
Constructors Constructor Description KeyForVerification()Constructs a new empty key.KeyForVerification(java.io.File file)Loads first key from the specified file.KeyForVerification(java.io.InputStream stream)Loads first key from the specified input stream.KeyForVerification(java.lang.String armor)Loads first key from the specified armored text.KeyForVerification(java.util.List<Subkey> subkeys)Constructs a new key with the specified subkeys.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidsetSubkeys(java.util.List<Subkey> x)All subkeys, or an empty list.protected voidsetSubkeysUsage()-
Methods inherited from class org.c02e.jpgpj.Key
clearSecrets, clone, findAll, findAll, findById, getDecryption, getEncryption, getMaster, getSigning, getSigningUid, getSubkeys, getUids, getVerification, isForDecryption, isForEncryption, isForSigning, isForVerification, load, load, load, matches, matches, newRing, setNoPassphrase, setPassphrase, setPassphraseChars, setSigningUid, toPublicKey, toString
-
-
-
-
Constructor Detail
-
KeyForVerification
public KeyForVerification()
Constructs a new empty key.
-
KeyForVerification
public KeyForVerification(java.util.List<Subkey> subkeys)
Constructs a new key with the specified subkeys.
-
KeyForVerification
public KeyForVerification(java.lang.String armor) throws java.io.IOException, org.bouncycastle.openpgp.PGPExceptionLoads first key from the specified armored text.- Throws:
org.bouncycastle.openpgp.PGPException- if the text contains no keys.java.io.IOException
-
KeyForVerification
public KeyForVerification(java.io.File file) throws java.io.IOException, org.bouncycastle.openpgp.PGPExceptionLoads first key from the specified file.- Throws:
org.bouncycastle.openpgp.PGPException- if the file contains no keys.java.io.IOException
-
KeyForVerification
public KeyForVerification(java.io.InputStream stream) throws java.io.IOException, org.bouncycastle.openpgp.PGPExceptionLoads first key from the specified input stream.- Throws:
org.bouncycastle.openpgp.PGPException- if the input streame contains no keys.java.io.IOException
-
-
Method Detail
-
setSubkeys
protected void setSubkeys(java.util.List<Subkey> x)
Description copied from class:KeyAll subkeys, or an empty list.- Overrides:
setSubkeysin classKey
-
setSubkeysUsage
protected void setSubkeysUsage()
-
-