org.metastatic.callbacks

Class CertificateCallback

Implemented Interfaces:
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.

Field Summary

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.

Constructor Summary

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.

Method Summary

Certificate[]
getCertificates()
Returns the certificate chain as an array of certificates.
int
getDefaultIndex()
Returns the default index.
String
getPrompt()
Returns the prompt.
int
getSelectedIndex()
Returns the selected index, or -1 if this value has not been set.
void
setSelectedIndex(int index)
Sets the selected index.

Field Details