The complexity of promise problems with applications to public-key cryptography