Ferguson
Ferguson

Reputation: 547

Java stored procedure SHA256 with RSA Signature not available

I have a problem with java stored procedure on oracle database version "Oracle Database 11g Enterprise Edition 11.2.0.3.0 64bit Production".

I need to use sha256withRsa to sign some datas. In this case I have used java stored procedure. The same source code work on Netbeans ide with JDK1.5 or JDK1.7 (tryed to change).

When I execute the same code on database side i get:

ORA-29532: Java call terminated by uncaught Java exception: java.security.NoSuchAlgorithmException: SHA256WithRSAEncryption Signature not available

This line of code is the cause:

Signature podpis = Signature.getInstance("SHA256withRSA");

How to solve this problem?

Java on database side is: JDK 1.5.0_10

Upvotes: 0

Views: 2789

Answers (1)

Arkadiusz Łukasiewicz
Arkadiusz Łukasiewicz

Reputation: 6366

Run this class in netbeans and in plsql. To view output in plsql execute. set serveroutput on; dbms_java.set_output(20000); And you are looking for Signature.SHA256withRSA.

import java.security.Provider;
import java.security.Security;
import java.util.Enumeration;

/**
 *
 * @author alukasiewicz
 */
public class TestSignature {

   public static void print() throws Exception {
    try {
        Provider p[] = Security.getProviders();
      for (int i = 0; i < p.length; i++) {
          System.out.println(p[i]);
          for (Enumeration e = p[i].keys(); e.hasMoreElements();)
              System.out.println("\t" + e.nextElement());
      }
    } catch (Exception e) {
      System.out.println(e);
    }
  }
}

Upvotes: 1

Related Questions