Class PasswordBasedSecretKeyRingProtector

    • Constructor Detail

      • PasswordBasedSecretKeyRingProtector

        public PasswordBasedSecretKeyRingProtector​(@Nonnull
                                                   KeyRingProtectionSettings settings,
                                                   @Nonnull
                                                   SecretKeyPassphraseProvider passphraseProvider)
        Constructor. Passphrases for keys are sourced from the passphraseProvider and decryptors/encryptors are constructed following the settings given in settings.
        Parameters:
        settings - S2K settings etc.
        passphraseProvider - provider which provides passphrases.
    • Method Detail

      • getDecryptor

        @Nullable
        public org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor getDecryptor​(java.lang.Long keyId)
                                                                             throws org.bouncycastle.openpgp.PGPException
        Description copied from interface: SecretKeyRingProtector
        Return a decryptor for the key of id keyId. This method returns null if the key is unprotected.
        Specified by:
        getDecryptor in interface SecretKeyRingProtector
        Parameters:
        keyId - id of the key
        Returns:
        decryptor for the key
        Throws:
        org.bouncycastle.openpgp.PGPException
      • getEncryptor

        @Nullable
        public org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor getEncryptor​(java.lang.Long keyId)
                                                                             throws org.bouncycastle.openpgp.PGPException
        Description copied from interface: SecretKeyRingProtector
        Return an encryptor for the key of id keyId. This method returns null if the key is unprotected.
        Specified by:
        getEncryptor in interface SecretKeyRingProtector
        Parameters:
        keyId - id of the key
        Returns:
        encryptor for the key
        Throws:
        org.bouncycastle.openpgp.PGPException - if the encryptor cannot be created for some reason