简体   繁体   English

带有RSA签名的Java存储过程SHA256不可用

[英]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". 我在Oracle数据库版本“ Oracle Database 11g企业版11.2.0.3.0 64位生产”上的Java存储过程有问题。

I need to use sha256withRsa to sign some datas. 我需要使用sha256withRsa对某些数据进行签名。 In this case I have used java stored procedure. 在这种情况下,我使用了Java存储过程。 The same source code work on Netbeans ide with JDK1.5 or JDK1.7 (tryed to change). 相同的源代码在带有JDK1.5或JDK1.7的Netbeans ide上工作(尝试进行更改)。

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 ORA-29532:Java调用因未捕获的Java异常而终止:java.security.NoSuchAlgorithmException:SHA256WithRSAEncryption签名不可用

This line of code is the cause: 这行代码是原因:

Signature podpis = Signature.getInstance("SHA256withRSA"); 签名podpis = Signature.getInstance(“ SHA256withRSA”);

How to solve this problem? 如何解决这个问题呢?

Java on database side is: JDK 1.5.0_10 数据库方面的Java是:JDK 1.5.0_10

Run this class in netbeans and in plsql. 在netbeans和plsql中运行此类。 To view output in plsql execute. 要在plsql中查看输出,请执行。 set serveroutput on; dbms_java.set_output(20000); And you are looking for Signature.SHA256withRSA. 您正在寻找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);
    }
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM