Recovering generators of principal ideals using subfield structure and applications to cryptography