serialize and deserialize the private key as a PEM