if (! ok)
  protected PublicKey engineGeneratePublic(KeySpec keySpec)      throws InvalidKeySpecException  {    if (keySpec instanceof DSAPublicKeySpec)      return decodeDSSPublicKey((DSAPublicKeySpec) keySpec);    if (keySpec instanceof RSAPublicKeySpec)      return decodeRSAPublicKey((RSAPublicKeySpec) keySpec);    if (keySpec instanceof DHPublicKeySpec)      return decodeDHPublicKey((DHPublicKeySpec) keySpec);    if (! (keySpec instanceof X509EncodedKeySpec))      throw new InvalidKeySpecException("Unsupported key specification");    byte[] input = ((X509EncodedKeySpec) keySpec).getEncoded();    // try DSS    try      {        return DSSPublicKey.valueOf(input);      }    catch (InvalidParameterException ignored)      {      }    // try RSA    try    {      return GnuRSAPublicKey.valueOf(input);    }  catch (InvalidParameterException ignored)    {    }    // try DH    return decodeDHPublicKey(input);  }