Class MatchMakingSecretKeyRingProtector

  • All Implemented Interfaces:
    org.pgpainless.key.protection.SecretKeyRingProtector

    public class MatchMakingSecretKeyRingProtector
    extends java.lang.Object
    implements org.pgpainless.key.protection.SecretKeyRingProtector
    Implementation of the SecretKeyRingProtector which can be handed passphrases and keys separately, and which then matches up passphrases and keys when needed.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPassphrase​(org.pgpainless.util.Passphrase passphrase)
      Add a single passphrase to the protector.
      void addSecretKey​(org.bouncycastle.openpgp.PGPSecretKeyRing key)
      Add a single PGPSecretKeyRing to the protector.
      void clear()
      Clear all known passphrases from the protector.
      @Nullable org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor getDecryptor​(java.lang.Long keyId)  
      @Nullable org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor getEncryptor​(java.lang.Long keyId)  
      boolean hasPassphraseFor​(java.lang.Long keyId)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MatchMakingSecretKeyRingProtector

        public MatchMakingSecretKeyRingProtector()
    • Method Detail

      • addPassphrase

        public void addPassphrase​(org.pgpainless.util.Passphrase passphrase)
        Add a single passphrase to the protector.
        Parameters:
        passphrase - passphrase
      • addSecretKey

        public void addSecretKey​(org.bouncycastle.openpgp.PGPSecretKeyRing key)
        Add a single PGPSecretKeyRing to the protector.
        Parameters:
        key - secret keys
      • hasPassphraseFor

        public boolean hasPassphraseFor​(java.lang.Long keyId)
        Specified by:
        hasPassphraseFor in interface org.pgpainless.key.protection.SecretKeyRingProtector
      • getDecryptor

        @Nullable
        public @Nullable org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor getDecryptor​(java.lang.Long keyId)
                                                                                       throws org.bouncycastle.openpgp.PGPException
        Specified by:
        getDecryptor in interface org.pgpainless.key.protection.SecretKeyRingProtector
        Throws:
        org.bouncycastle.openpgp.PGPException
      • getEncryptor

        @Nullable
        public @Nullable org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor getEncryptor​(java.lang.Long keyId)
                                                                                       throws org.bouncycastle.openpgp.PGPException
        Specified by:
        getEncryptor in interface org.pgpainless.key.protection.SecretKeyRingProtector
        Throws:
        org.bouncycastle.openpgp.PGPException
      • clear

        public void clear()
        Clear all known passphrases from the protector.