-1

This error occur while running the following program

import java.security.SecureRandom;
import java.util.Random;

public class IBMSecureRandom1 
{
   public static void main(String[] args) {

   try {
   // get a real random generator
    SecureRandom reallyRandom = SecureRandom.getInstance("IBMSecureRandom","IBMJCECCA");
    System.out.print("Some really random numbers: ");
        for (int i = 0; i < 3; i++) {
            System.out.print(reallyRandom.nextInt() + " ");
        }
    System.out.println();
    // make a pseudo random generator seeded by the real random generator
    Random pseudoRandom = new Random(reallyRandom.nextLong());
    System.out.print("Some pseudo random numbers: ");

    for (int i = 0; i < 3; i++) {
        System.out.print(pseudoRandom.nextInt() + " ");
    }   
    System.out.println();
    }
    catch (Exception e) {
        System.err.println("Something went wrong ...");
        e.printStackTrace();
    }
  }
}

I dont know whether i have to add any jar file or something else

albciff
  • 18,112
  • 4
  • 64
  • 89
Shruti
  • 391
  • 1
  • 5
  • 21
  • Why do you want to use IBMJCECCA? Are you really using [z/OS](http://en.wikipedia.org/?title=Z/OS) and IBM JDK in the first place? – Oleg Estekhin Jul 03 '14 at 06:06
  • no i am not using z/OS – Shruti Jul 03 '14 at 07:14
  • That do not bother with IBMJCECCA provider and `IBMSecureRandom` implementation, just use what is available in [JCE provider](http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#SecureRandom). – Oleg Estekhin Jul 03 '14 at 07:24
  • ya, but still error is coming, do i need to add any jar file?? – Shruti Jul 03 '14 at 07:27
  • Please just use `new SecureRandom()` if you do not understand what strings should be specified as algorithm name and provider name. – Oleg Estekhin Jul 03 '14 at 07:59
  • i understand the algorithm(IBMSecureRandom) use in the code, i am prefering the book Java Security on z/OS - The Complete View , and also download the SDK for z/OS but cant yet install it. – Shruti Jul 03 '14 at 08:50

1 Answers1

0

From : http://www-03.ibm.com/systems/z/os/zos/tools/java/faq/javasecurityfaq.html

You will see this error when an application issues a Service.getInstance(algorithm,provider) and the specified provider is not installed in the JVM. The installation instructions provided in How do I install the IBMJCECCA provider? can be used to install any provider as long as you know the package and class name.

Shivam Verma
  • 7,973
  • 3
  • 26
  • 34