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

pack-priv Class BouncyCastleGpgKeyPassphrasePrompt

extends Object
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Imports
java.net.URISyntaxException, java.nio.file.Path, java.text.MessageFormat, org.bouncycastle.openpgp.PGPException, org.bouncycastle.util.encoders.Hex, org.eclipse.jgit.api.errors.CanceledException, org.eclipse.jgit.errors.UnsupportedCredentialItem, org.eclipse.jgit.transport.CredentialItem.InformationalMessage, .CredentialItem.Password, .CredentialsProvider, .URIish

Prompts for a passphrase and caches it until cleared.

Implements AutoCloseable so it can be used within a try-with-resources block.

Field Summary

Modifier and TypeField and Description
private CredentialsProvider
private CredentialItem.Password

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Clears any cached passphrase

public void
close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

private URIish
createURI(Path keyLocation)

public char[]

Returns:

the passphrase (maybe null)
getPassphrase
(byte[]
the fingerprint to show to the user during prompting
keyFingerprint
,
Path
the location the key was loaded from
keyLocation
)

Prompts use for a passphrase unless one was cached from a previous prompt.

public boolean

Returns:

true if a passphrase is already set, false otherwise
hasPassphrase
()

Determines whether a passphrase was already obtained.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

credentialsProviderback to summary
private CredentialsProvider credentialsProvider
passphraseback to summary
private CredentialItem.Password passphrase

Constructor Detail

BouncyCastleGpgKeyPassphrasePromptback to summary
public BouncyCastleGpgKeyPassphrasePrompt(CredentialsProvider credentialsProvider)

Method Detail

clearback to summary
public void clear()

Clears any cached passphrase

closeback to summary
public void close()

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
createURIback to summary
private URIish createURI(Path keyLocation) throws URISyntaxException
getPassphraseback to summary
public char[] getPassphrase(byte[] keyFingerprint, Path keyLocation) throws PGPException, CanceledException, UnsupportedCredentialItem, URISyntaxException

Prompts use for a passphrase unless one was cached from a previous prompt.

Parameters
keyFingerprint:byte[]

the fingerprint to show to the user during prompting

keyLocation:Path

the location the key was loaded from

Returns:char[]

the passphrase (maybe null)

Exceptions
PGPException:
if a PGP problem occurred
CanceledException:
in case passphrase was not entered by user
UnsupportedCredentialItem:
if a credential item isn't supported
URISyntaxException:
if the URI isn't parseable
hasPassphraseback to summary
public boolean hasPassphrase()

Determines whether a passphrase was already obtained.

Returns:boolean

true if a passphrase is already set, false otherwise