Hidden convexity in a problem of nonlinear elasticity