Code example for InvalidKeyException

            return new ECPublicKeyParameters( 
                EC5Util.convertPoint(pubKey.getParams(), pubKey.getW(), false),
                            new ECDomainParameters(s.getCurve(), s.getG(), s.getN(), s.getH(), s.getSeed()));
        throw new InvalidKeyException("cannot identify EC public key.");
    public static AsymmetricKeyParameter generatePrivateKeyParameter( 
        PrivateKey    key)
        throws InvalidKeyException 
        if (key instanceof ECPrivateKey)
            ECPrivateKey  k = (ECPrivateKey)key;
            ECParameterSpec s = k.getParameters();
            if (s == null)
                s = ProviderUtil.getEcImplicitlyCa();
Connect your IDE to all the code out there  Get Codota for Java