Top Description Inners Fields Constructors Methods
org.eclipse.jgit.gpg.bc.internal.keys

public final Class SecretKeys

extends Object
Class Inheritance
Imports
java.io.BufferedInputStream, .IOException, .InputStream, java.net.URISyntaxException, java.text.MessageFormat, org.bouncycastle.bcpg.ECPublicBCPGKey, .PublicKeyAlgorithmTags, org.bouncycastle.gpg.PGPSecretKeyParser, .SExprParser, org.bouncycastle.openpgp.OpenedPGPKeyData, .PGPException, .PGPPublicKey, .PGPSecretKey, org.bouncycastle.openpgp.operator.PBEProtectionRemoverFactory, .PGPDigestCalculatorProvider, org.bouncycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator, .JcePBEProtectionRemoverFactory, org.eclipse.jgit.api.errors.CanceledException, org.eclipse.jgit.errors.UnsupportedCredentialItem, org.eclipse.jgit.gpg.bc.internal.BCText

Utilities for reading GPG secret keys from a gpg-agent key file.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
SecretKeys.PassphraseSupplier

Something that can supply a passphrase to decrypt an encrypted secret key.

Field Summary

Modifier and TypeField and Description
private static final int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static boolean
public static PGPSecretKey

Returns:

the secret key
readSecretKey
(InputStream
InputStream to read from, doesn't need to be buffered
in
,
PGPDigestCalculatorProvider
for checking digests
calculatorProvider
,
SecretKeys.PassphraseSupplier
for decrypting encrypted keys
passphraseSupplier
,
PGPPublicKey
the secret key should be for
publicKey
)

Reads a GPG secret key from the given stream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

MAX_SEXPR_NESTINGback to summary
private static final int MAX_SEXPR_NESTING

Constructor Detail

SecretKeysback to summary
private SecretKeys()

Method Detail

isProtectedback to summary
private static boolean isProtected(OpenedPGPKeyData data)
readSecretKeyback to summary
public static PGPSecretKey readSecretKey(InputStream in, PGPDigestCalculatorProvider calculatorProvider, SecretKeys.PassphraseSupplier passphraseSupplier, PGPPublicKey publicKey) throws IOException, PGPException, CanceledException, UnsupportedCredentialItem, URISyntaxException

Reads a GPG secret key from the given stream.

Parameters
in:InputStream

InputStream to read from, doesn't need to be buffered

calculatorProvider:PGPDigestCalculatorProvider

for checking digests

passphraseSupplier:SecretKeys.PassphraseSupplier

for decrypting encrypted keys

publicKey:PGPPublicKey

the secret key should be for

Returns:PGPSecretKey

the secret key

Exceptions
IOException:
if the stream cannot be parsed
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
org.eclipse.jgit.gpg.bc.internal.keys back to summary

public Interface SecretKeys.PassphraseSupplier


Something that can supply a passphrase to decrypt an encrypted secret key.

Method Summary

Modifier and TypeMethod and Description
public char[]

Returns:

the passphrase
getPassphrase
()

Supplies a passphrase.

Method Detail

getPassphraseback to summary
public char[] getPassphrase() throws PGPException, CanceledException, UnsupportedCredentialItem, URISyntaxException

Supplies a passphrase.

Returns:char[]

the passphrase

Exceptions
PGPException:
if no passphrase can be obtained
CanceledException:
if the user canceled passphrase entry
UnsupportedCredentialItem:
if an internal error occurred
URISyntaxException:
if an internal error occurred