• Payments and Transfers
  • Disputes and Limitations
  • My Account
  • My Wallet
  • Login & Security
  • Seller Tools

Why did I get the error "Unsupported key size" or "Illegal key size" in Java?

Issue
You received one of the following errors in Java:
  • java.lang.SecurityException: Unsupported key size or algorithm parameters
  • java.security.InvalidKeyException: Illegal key size

Cause
Java Cryptography Extension (JCE) libraries used by the Java Virtual Machine produce these errors. The jurisdiction policy files distributed with Java have cryptographic strength restricted by certain countries. PayPal’s button encryption code uses this encryption technology.

Solution
To overcome these restrictions, Java users must download the JCE Unlimited Strength Jurisdiction Policy Files from Sun. For JDK 1.4.2, these files are available at http://java.sun.com/j2se/1.4.2/download.html. In addition to copyright and README files, the software contains two files:
  • local_policy.jar
  • US_export_policy.jar

Replace the files of the same name that come with the standard Java Runtime Environment (JRE). These files are located in $JAVA_HOME/lib/security, where $JAVA_HOME is the JRE running the PayPal SDK. For Windows users, this will often be in C:\Program Files\Java.
Was this article helpful?

More ways we can help

How are we doing?
Take our survey