readSecretKey
public static org.bouncycastle.openpgp.PGPSecretKey readSecretKey(InputStream in,
org.bouncycastle.openpgp.operator.PGPDigestCalculatorProvider calculatorProvider,
SecretKeys.PassphraseSupplier passphraseSupplier,
org.bouncycastle.openpgp.PGPPublicKey publicKey)
throws IOException,
org.bouncycastle.openpgp.PGPException,
CanceledException,
UnsupportedCredentialItem,
URISyntaxException
Reads a GPG secret key from the given stream.
- Parameters:
in
- InputStream
to read from, doesn't need to be buffered
calculatorProvider
- for checking digests
passphraseSupplier
- for decrypting encrypted keys
publicKey
- the secret key should be for
- Returns:
- the secret key
- Throws:
IOException
- if the stream cannot be parsed
org.bouncycastle.openpgp.PGPException
- if thrown by the underlying S-Expression parser, for instance
when the passphrase is wrong
CanceledException
- if thrown by the passphraseSupplier
UnsupportedCredentialItem
- if thrown by the passphraseSupplier
URISyntaxException
- if thrown by the passphraseSupplier