created pgp function