The PGP or Pretty Good Privacy is a hybrid implementation of conventional cryptography as well as public key encryption.

1 JDK Prerrequisites

The needed version of JDK installed is Java 8 Update 151 and higher. This is to avoid a policy that only allows restricted cryptography key sizes due to US export laws.

  • Java 9 and higher: The Unlimited Strength Jurisdiction Policy Files are included with Java 9 and used by default.
  • Java 8 Update 161 and higher: Starting with Java 8 Update 161, Java 8 defaults to the Unlimited Strength Jurisdiction Policy.
  • Java 8 Update 151 and higher: Starting with Java 8 Update 151, the Unlimited Strength Jurisdiction Policy is included with Java 8 but not used by default. To enable it, you need to edit the java.security file in $JAVA_HOME/jre/lib/security (for JDK) or $JAVA_HOME/lib/security (for JRE). Uncomment (or include) the line

    Copy
    crypto.policy=unlimited

    The policy change only takes effect after restarting the JVM.

  • Before Java 8 Update 151: For Java 8 Update 144 and earlier, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files (available at Oracle).

The tag function script has the following grammar:

2 crypt.pgp.encode

<crypt.pgp.encode
    identity='identity'
    password='password'
>
    <key_secret /> !
    <message /> !
</crypt.pgp.encode>