在12c上使用utl_http&wallets:证书验证失败

Ton*_*eed 9 oracle ssl plsql oracle12c

希望有人可以发现我做错了什么,因为我正在秃顶.

我已经使用utl_http和钱包在11gR1上调用https而没有太大的麻烦,但我们新的12c安装让我感到非常悲痛.

我尝试使用oracle钱包管理器和命令行导入可信证书,但没有任何成功.我知道oracle可以挑剔缓存钱包,所以我尝试了多次没有运气的新会话.

我已经为*.presstogo.com,Geotrust SSL CA和Geotrust Global CA下载了三个必要的证书.

我构建钱包的命令行版本如下:

orapki wallet create -wallet /oracle/product/12.0.1/owm/wallets/test1237 -pwd test=1237 -auto_login  
orapki wallet add -wallet /oracle/product/12.0.1/owm/wallets/test1237 -trusted_cert -cert "*.presstogo.com" -pwd test=1237  
orapki wallet add -wallet /oracle/product/12.0.1/owm/wallets/test1237 -trusted_cert -cert "GeoTrust SSL CA" -pwd test=1237  
orapki wallet add -wallet /oracle/product/12.0.1/owm/wallets/test1237 -trusted_cert -cert "Geotrust Global CA" -pwd test=1237  
orapki wallet display -wallet /oracle/product/12.0.1/owm/wallets/test1237   
Oracle PKI Tool : Version 12.1.0.1  
Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.  
Requested Certificates:   
User Certificates:  
Trusted Certificates:   
Subject:        OU=Class 3 Public Primary Certification Authority,O=VeriSign\, Inc.,C=US  
Subject:        CN=GTE CyberTrust Global Root,OU=GTE CyberTrust Solutions\, Inc.,O=GTE Corporation,C=US  
Subject:        CN=GeoTrust SSL CA,O=GeoTrust\, Inc.,C=US  
Subject:        OU=Class 2 Public Primary Certification Authority,O=VeriSign\, Inc.,C=US  
Subject:        OU=Class 1 Public Primary Certification Authority,O=VeriSign\, Inc.,C=US  
Subject:        CN=GeoTrust Global CA,O=GeoTrust Inc.,C=US  
Subject:        CN=*.presstogo.com,OU=IT,O=Press to go AS,L=Oslo,ST=Norway,C=NO,SERIAL_NUM=SJYpOHrRdCDHE8KZ6dRFGMJthOjs7-v3  
Run Code Online (Sandbox Code Playgroud)

好的,我们来测试一下.登录sqlplus并运行以下命令:

declare  
    lo_req    utl_http.req;  
    lo_resp   utl_http.resp;  
begin  
    utl_http.set_detailed_excp_support ( true );  
    utl_http.set_wallet ( 'file:/oracle/product/12.0.1/owm/wallets/test1237', 'test=1237');  
    lo_req := utl_http.begin_request ( 'https://production.presstogo.com/mars/hello' );  
    lo_resp := utl_http.get_response ( lo_req );  
    -- A successfull request would have the status code "200".   
    dbms_output.put_line ( lo_resp.status_code );  
    utl_http.end_response ( lo_resp );  
exception  
  when others then    
    utl_http.end_response ( lo_resp );  
    raise;  
end;  
Run Code Online (Sandbox Code Playgroud)

宣布

*

第1行的错误:

ORA-29273:HTTP请求失败

ORA-06512:在"SYS.UTL_HTTP",第1130行

ORA-29024:证书验证失败

ORA-06512:第6行

为了记录,值得注意的是以下工作:

declare  
    lo_req    utl_http.req;  
    lo_resp   utl_http.resp;  
begin  
    utl_http.set_wallet ( 'file:/oracle/product/12.0.1/owm/wallets/test1237', 'test=1237');  
    lo_req := utl_http.begin_request ( 'https://www.google.be' );  
    lo_resp := utl_http.get_response ( lo_req );  
    dbms_output.put_line ( lo_resp.status_code );  
    utl_http.end_response ( lo_resp );  
end;  
/  
Run Code Online (Sandbox Code Playgroud)

帮助我欧比旺,你是我唯一的希望.

Ton*_*eed 22

为了别人的利益回答我自己的问题.

根据Oracle Support,只应导入证书链,而不是最终站点证书.在上面使用的示例中,仅将以下证书导入钱包:

Geotrust SSL CA & Geotrust Global CA

请勿导入*.presstogo.com证书

引用Oracle支持:

选择在12c中失败的原因是12c不希望将钱包中的用户证书视为可信证书.

这在以前的版本中显然不是问题,但从钱包中删除该证书可解决此问题.

这与我在网上发现的关于使用utl_http连接到Https网站的所有信息相矛盾,并且让我感到很困惑.

希望在我的情况下,这将有助于其他人.