Package org.pgpainless.key.protection

# Class PasswordBasedSecretKeyRingProtector

java.lang.Object
org.pgpainless.key.protection.BaseSecretKeyRingProtector
org.pgpainless.key.protection.PasswordBasedSecretKeyRingProtector

All Implemented Interfaces:
  `SecretKeyRingProtector`

public class PasswordBasedSecretKeyRingProtector extends BaseSecretKeyRingProtector
Provides `PBESecretKeyDecryptor` and `PBESecretKeyEncryptor` objects while getting the passphrases from a `SecretKeyPassphraseProvider` and using settings from an `KeyRingProtectionSettings`.

## Constructor Summary

Constructors
Constructor
Description
`PasswordBasedSecretKeyRingProtector(KeyRingProtectionSettings settings, SecretKeyPassphraseProvider passphraseProvider)`
Constructor.
`PasswordBasedSecretKeyRingProtector(SecretKeyPassphraseProvider passphraseProvider)`

## Method Summary

Modifier and Type
Method
Description
`static PasswordBasedSecretKeyRingProtector`
`forKey(org.bouncycastle.openpgp.PGPKeyRing keyRing, Passphrase passphrase)`
`static PasswordBasedSecretKeyRingProtector`
`forKey(org.bouncycastle.openpgp.PGPSecretKey key, Passphrase passphrase)`
`static PasswordBasedSecretKeyRingProtector`
`forKeyId(long singleKeyId, Passphrase passphrase)`

### Methods inherited from class org.pgpainless.key.protection.BaseSecretKeyRingProtector

`getDecryptor, getEncryptor, hasPassphraseFor`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### PasswordBasedSecretKeyRingProtector

public PasswordBasedSecretKeyRingProtector(@Nonnull SecretKeyPassphraseProvider passphraseProvider)

### 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 Details

### forKey

public static PasswordBasedSecretKeyRingProtector forKey(org.bouncycastle.openpgp.PGPKeyRing keyRing, Passphrase passphrase)

### forKey

public static PasswordBasedSecretKeyRingProtector forKey(org.bouncycastle.openpgp.PGPSecretKey key, Passphrase passphrase)

### forKeyId

public static PasswordBasedSecretKeyRingProtector forKeyId(long singleKeyId, Passphrase passphrase)