try {
if (!(key instanceof PublicKey)) {
throw new InvalidKeyException("key must be PublicKey");
}
signature.initVerify((PublicKey) key);
si.canonicalize(context, new SignerOutputStream(signature));
// avoid overhead of converting key to String unless necessary
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "verifying with key: " + key);
}