Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
b747d99c
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b747d99c
编写于
1月 21, 2014
作者:
A
asmotrak
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8028431: NullPointerException in DerValue.equals(DerValue)
Reviewed-by: mullan
上级
4b6febd6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
93 addition
and
15 deletion
+93
-15
src/share/classes/sun/security/util/DerValue.java
src/share/classes/sun/security/util/DerValue.java
+9
-15
test/java/security/cert/X509Certificate/X509BadCertificate.java
...ava/security/cert/X509Certificate/X509BadCertificate.java
+63
-0
test/java/security/cert/X509Certificate/bad-cert-1.pem
test/java/security/cert/X509Certificate/bad-cert-1.pem
+21
-0
未找到文件。
src/share/classes/sun/security/util/DerValue.java
浏览文件 @
b747d99c
...
...
@@ -779,19 +779,6 @@ public class DerValue {
return
buffer
.
getGeneralizedTime
(
data
.
available
());
}
/**
* Returns true iff the other object is a DER value which
* is bitwise equal to this one.
*
* @param other the object being compared with this one
*/
public
boolean
equals
(
Object
other
)
{
if
(
other
instanceof
DerValue
)
return
equals
((
DerValue
)
other
);
else
return
false
;
}
/**
* Bitwise equality comparison. DER encoded values have a single
* encoding, so that bitwise equality of the encoded values is an
...
...
@@ -799,10 +786,15 @@ public class DerValue {
*
* @param other the object being compared with this one
*/
public
boolean
equals
(
DerValue
other
)
{
if
(
this
==
other
)
{
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(!(
o
instanceof
DerValue
))
{
return
false
;
}
DerValue
other
=
(
DerValue
)
o
;
if
(
tag
!=
other
.
tag
)
{
return
false
;
}
...
...
@@ -835,6 +827,7 @@ public class DerValue {
*
* @return printable representation of the value
*/
@Override
public
String
toString
()
{
try
{
...
...
@@ -962,6 +955,7 @@ public class DerValue {
*
* @return a hashcode for this DerValue.
*/
@Override
public
int
hashCode
()
{
return
toString
().
hashCode
();
}
...
...
test/java/security/cert/X509Certificate/X509BadCertificate.java
0 → 100644
浏览文件 @
b747d99c
/*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8028431
* @summary Make sure that proper CertificateException is thrown
* when loading bad x509 certificate
* @author Artem Smotrakov
*/
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.security.cert.CertificateFactory
;
import
java.security.cert.X509Certificate
;
import
java.security.cert.CertificateException
;
public
class
X509BadCertificate
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
test
(
"bad-cert-1.pem"
);
}
/**
* Parse X509 certificates.
*/
static
void
test
(
String
filename
)
throws
Exception
{
try
{
System
.
out
.
println
(
"Parse file "
+
filename
);
File
f
=
new
File
(
System
.
getProperty
(
"test.src"
,
"."
),
filename
);
try
(
FileInputStream
fis
=
new
FileInputStream
(
f
))
{
CertificateFactory
cf
=
CertificateFactory
.
getInstance
(
"X509"
);
X509Certificate
cert
=
(
X509Certificate
)
cf
.
generateCertificate
(
fis
);
}
throw
new
Exception
(
"Test failed: "
+
"expected CertificateParsingException was not thrown"
);
}
catch
(
CertificateException
e
)
{
System
.
out
.
println
(
"Test passed: expected exception was thrown: "
+
e
.
toString
());
}
}
}
test/java/security/cert/X509Certificate/bad-cert-1.pem
0 → 100644
浏览文件 @
b747d99c
-----BEGIN CERTIFICATE-----
MIIDZzCCAk+gAwIBAgIJAJYB3qu9C2kiMA0GCSqGSIb3DQEBBQUAMEoxDTALBgNV
BAMMBFRlc3QxDTALBgNVBAsMBEphdmExDzANBgNVBAoMBk9yYWNsZTEMMAoGA1UE
BwwDU1BCMQswCQYDVQQGEwJSVTAeFw0xMzEyMjMwNzA4MDhaFw0yMzEyMjEwNzA4
MDhaMEoxDTALBgNVBAMMBFRlc3QxDTALBgNVBAsMBEphdmExDzANBgNVBAoMBk9y
YWNsZTEMMAoGA1UMBwwDU1BCMQswCQYDVQQGEwJSVTCCASIwDQYJKoZIhvcNAQEB
BQADggEPADCCAQoCggEBAOqiCN4gFxehl547Q7/VNGbGApr+wszLdanHPucAH6Wf
LtcRhKNUSqtBAQxEpFrTpMNEqm2GElAjiPa6m48qIjLVSvOb/9w3G/yXB8zyZbIm
/Nfp2sT4OEaa1JSEZSpolhS4FfqYzjGQp5cn4Xn4zKjDgiceHgfLls5x2dRydQZO
Yf91qSIioZxVHUtlo8yztkieiSaqPWt3nJ4PIwhFbsu1HVmWaYZD+nBYCKgVHqrS
cueO98Ca4Doz73O27X1dVbQBdLS0JI7qVAG8LD388iPL8qbsOkgWPzmEQ+kLRKO4
g7RpuwlXuwaMSh95NWaxlu4Ob6GRJQmpconYoe13+7ECAwEAAaNQME4wHQYDVR0O
BBYEFIG8TPobXcbNbDi+zKudd9whpxoNMB8GA1UdIwQYMBaAFIG8TPobXcbNbDi+
zKudd9whpxoNMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFRQADggEBAAynN+e7
h+ufT5SBKN/gBuJAnF1mKIPESiipuv5KoYUGZOY8ShgYLcwY+qnbuHYFUlvq6Zns
K4/e+x/16h32vD7dEPkNvukbvER4YJQQiN6osDfXpTPzixYftWdmtX0u8xQfwb/g
R8DS7bazz99jVXk+jTK4yWBY+gMwEat+LyNQ5cyq8Qhi1oBKUbGRbiOts19B97fn
Rv8TsyXN3INLGYhdVxZoD7E5tyG1ydSFmOMadulAC2epBXDHOXZnz2UWauJc0XW5
1L/YQVri47VkdHS3tisBzELEJdLmdMDb+5tAU+lItXmTXe2/PB53WIvsEIb4t+eQ
wY0hCj9lVJlajTQ=
-----END CERTIFICATE-----
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录