org.metastatic.callbacks
Class CertificateCallback
java.lang.Object
org.metastatic.callbacks.CertificateCallback
- Callback
public class CertificateCallback
extends java.lang.Object
implements Callback
A callback for determining whether or not a certificate chain, the
trust of which could not be established, should be accepted by an
application.
The questionable certificate chain is included in this callback,
and handlers that accept this callback should provide some mechanism
for displaying these certificates when asking for confirmation. When
the user allows the certificates, the callback handler should set the
selected index to
ACCEPT
. Otherwise,
REJECT
.
static int | ACCEPT - Index for when the certificates in question should be accepted.
|
static int | REJECT - Index for when the certificates in question should be rejected.
|
CertificateCallback(String prompt, Certificate[] certs) - Create a new callback with the given prompt and certificates.
|
CertificateCallback(String prompt, Certificate[] certs, int defaultIndex) - Create a new callback with the given prompt, certificates, and default
index.
|
ACCEPT
public static final int ACCEPT
Index for when the certificates in question should be accepted.
REJECT
public static final int REJECT
Index for when the certificates in question should be rejected.
CertificateCallback
public CertificateCallback(String prompt,
Certificate[] certs)
Create a new callback with the given prompt and certificates. The
default index will be set to
REJECT
.
prompt
- The prompt.certs
- The certificates.
CertificateCallback
public CertificateCallback(String prompt,
Certificate[] certs,
int defaultIndex)
Create a new callback with the given prompt, certificates, and default
index.
prompt
- The prompt.certs
- The certificates.defaultIndex
- The default index.
getCertificates
public Certificate[] getCertificates()
Returns the certificate chain as an array of certificates. The
certificate array is cloned to prevent susequent modification.
getDefaultIndex
public int getDefaultIndex()
Returns the default index.
getPrompt
public String getPrompt()
Returns the prompt.
getSelectedIndex
public int getSelectedIndex()
Returns the selected index, or -1 if this value has not been set.
setSelectedIndex
public void setSelectedIndex(int index)
Sets the selected index.
index
- The selected index.