Code example for InvalidKeyException

0
             
            return new GOST3410PublicKeyParameters(k.getY(),
                new GOST3410Parameters(p.getP(), p.getQ(), p.getA()));
        } 
 
        throw new InvalidKeyException("can't identify GOST3410 public key: " + key.getClass().getName());
    } 
 
    static public AsymmetricKeyParameter generatePrivateKeyParameter( 
        PrivateKey    key)
        throws InvalidKeyException
    { 
        if (key instanceof GOST3410PrivateKey)
        { 
            GOST3410PrivateKey         k = (GOST3410PrivateKey)key;
            GOST3410PublicKeyParameterSetSpec p = k.getParameters().getPublicKeyParameters();
             
            return new GOST3410PrivateKeyParameters(k.getX(),
                new GOST3410Parameters(p.getP(), p.getQ(), p.getA()));
        }