public void handle(Callback[] callbacks)
throws IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof PublicKeyCallback) {
PublicKeyCallback pc = (PublicKeyCallback) callbacks[i];
java.security.PublicKey publicKey = pc.getPublicKey();
if (publicKey == null || !pc.verifyTrust(keyStore)) {
throw new IOException("Authentication of public key failed");
}
} else {
throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
}