InvalidKeySpecException y = new InvalidKeySpecException(); y.initCause(x); throw y;
throw new InvalidKeySpecException(x.getMessage(), x);
  protected PublicKey engineGeneratePublic(KeySpec keySpec)      throws InvalidKeySpecException  {    if (keySpec instanceof RSAPublicKeySpec)      {        RSAPublicKeySpec spec = (RSAPublicKeySpec) keySpec;        BigInteger n = spec.getModulus();        BigInteger e = spec.getPublicExponent();        return new GnuRSAPublicKey(Registry.X509_ENCODING_ID, n, e);      }    if (keySpec instanceof X509EncodedKeySpec)      {        X509EncodedKeySpec spec = (X509EncodedKeySpec) keySpec;        byte[] encoded = spec.getEncoded();        PublicKey result;        try          {            return new RSAKeyPairX509Codec().decodePublicKey(encoded);          }        catch (RuntimeException x)          {            InvalidKeySpecException y = new InvalidKeySpecException();            y.initCause(x);            throw y;          }      }    throw new InvalidKeySpecException("Unsupported (public) key specification");  }