Installing the Java Cryptography Extension (JCE) Unlimited Strength Policy Files:
Download the archive jce_policy-6.zip from JavaSE Downloads page.
Copy the files local_policy.jar and US_export_policy.jar from the archive to the folder %JAVA_HOME%\jre\lib\security, overwriting the files already present in the directory.
Generating KeyPair
KeyPair caKeyPair = null; try { KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(1024); caKeyPair = keyGen.generateKeyPair(); } catch (NoSuchAlgorithmException ex) { }