Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
1df741a3
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看板
提交
1df741a3
编写于
5月 18, 2015
作者:
A
asmotrak
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8079138: Additional negative tests for XML signature processing
Reviewed-by: mullan
上级
bf150d4b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
48 addition
and
5 deletion
+48
-5
test/javax/xml/crypto/dsig/ValidationTests.java
test/javax/xml/crypto/dsig/ValidationTests.java
+29
-5
test/javax/xml/crypto/dsig/data/signature-extra-text-in-signed-info.xml
.../crypto/dsig/data/signature-extra-text-in-signed-info.xml
+3
-0
test/javax/xml/crypto/dsig/data/signature-no-reference-uri.xml
...javax/xml/crypto/dsig/data/signature-no-reference-uri.xml
+3
-0
test/javax/xml/crypto/dsig/data/signature-wrong-canonicalization-method-algorithm.xml
...ata/signature-wrong-canonicalization-method-algorithm.xml
+3
-0
test/javax/xml/crypto/dsig/data/signature-wrong-signature-method-algorithm.xml
.../dsig/data/signature-wrong-signature-method-algorithm.xml
+3
-0
test/javax/xml/crypto/dsig/data/signature-wrong-tag-names.xml
.../javax/xml/crypto/dsig/data/signature-wrong-tag-names.xml
+3
-0
test/javax/xml/crypto/dsig/data/signature-wrong-transform-algorithm.xml
.../crypto/dsig/data/signature-wrong-transform-algorithm.xml
+4
-0
未找到文件。
test/javax/xml/crypto/dsig/ValidationTests.java
浏览文件 @
1df741a3
...
...
@@ -35,6 +35,7 @@ import java.io.FileInputStream;
import
java.security.*
;
import
javax.xml.crypto.Data
;
import
javax.xml.crypto.KeySelector
;
import
javax.xml.crypto.MarshalException
;
import
javax.xml.crypto.OctetStreamData
;
import
javax.xml.crypto.URIDereferencer
;
import
javax.xml.crypto.URIReference
;
...
...
@@ -60,9 +61,17 @@ public class ValidationTests {
static
class
Test
{
String
file
;
KeySelector
ks
;
Test
(
String
file
,
KeySelector
ks
)
{
Class
exception
;
Test
(
String
file
,
KeySelector
ks
,
Class
exception
)
{
this
.
file
=
file
;
this
.
ks
=
ks
;
this
.
exception
=
exception
;
}
// XMLSignatureException is expected by default
Test
(
String
file
,
KeySelector
ks
)
{
this
(
file
,
ks
,
XMLSignatureException
.
class
);
}
}
...
...
@@ -109,7 +118,17 @@ public class ValidationTests {
private
final
static
Test
[]
INVALID_TESTS
=
{
new
Test
(
"signature-enveloping-hmac-sha1-40.xml"
,
SKKS
),
new
Test
(
"signature-enveloping-hmac-sha1-trunclen-0-attack.xml"
,
SKKS
),
new
Test
(
"signature-enveloping-hmac-sha1-trunclen-8-attack.xml"
,
SKKS
)
new
Test
(
"signature-enveloping-hmac-sha1-trunclen-8-attack.xml"
,
SKKS
),
new
Test
(
"signature-extra-text-in-signed-info.xml"
,
SKKS
,
MarshalException
.
class
),
new
Test
(
"signature-wrong-canonicalization-method-algorithm.xml"
,
SKKS
,
MarshalException
.
class
),
new
Test
(
"signature-wrong-transform-algorithm.xml"
,
SKKS
,
MarshalException
.
class
),
new
Test
(
"signature-no-reference-uri.xml"
,
SKKS
),
new
Test
(
"signature-wrong-signature-method-algorithm.xml"
,
SKKS
,
MarshalException
.
class
),
new
Test
(
"signature-wrong-tag-names.xml"
,
SKKS
,
MarshalException
.
class
)
};
public
static
void
main
(
String
args
[])
throws
Exception
{
...
...
@@ -142,9 +161,14 @@ public class ValidationTests {
test_signature
(
test
);
System
.
out
.
println
(
"FAILED"
);
atLeastOneFailed
=
true
;
}
catch
(
XMLSignatureException
xse
)
{
System
.
out
.
println
(
xse
.
getMessage
());
System
.
out
.
println
(
"PASSED"
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Exception: "
+
e
);
if
(
e
.
getClass
()
!=
test
.
exception
)
{
System
.
out
.
println
(
"FAILED: unexpected exception"
);
atLeastOneFailed
=
true
;
}
else
{
System
.
out
.
println
(
"PASSED"
);
}
}
}
...
...
test/javax/xml/crypto/dsig/data/signature-extra-text-in-signed-info.xml
0 → 100644
浏览文件 @
1df741a3
<test
xmlns=
"http://example.org/envelope"
>
test
<Signature
xmlns=
"http://www.w3.org/2000/09/xmldsig#"
><SignedInfo
xmlns=
"http://www.w3.org/2000/09/xmldsig#"
><CanonicalizationMethod
Algorithm=
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
></CanonicalizationMethod><SignatureMethod
Algorithm=
"http://www.w3.org/2000/09/xmldsig#rsa-sha1"
></SignatureMethod><Reference
URI=
""
><Transforms><Transform
Algorithm=
"http://www.w3.org/2000/09/xmldsig#enveloped-signature"
></Transform></Transforms><DigestMethod
Algorithm=
"http://www.w3.org/2000/09/xmldsig#sha1"
></DigestMethod><DigestValue>
1Bq8FsjajUBYPD7stQeJSc66GlM=
</DigestValue><test>
extra text
</test></Reference></SignedInfo><SignatureValue>
iTrgJERmYeD5hFwY8/MwJpkF+nd++AAOgf/Kxt9SwdE6BIYq2Vyxq4CQPhD+t2971BGTgvF6ejZd
+/Ko4Zs5Dqf4Lt65Vck0q43rM0PdP1e8gJov0IPYnZ1zeqFpah+N/OjmqTbshaZWRIjf3eqS6en5
ZKjn+TkCQ1kOX/YUNDc=
</SignatureValue></Signature></test>
\ No newline at end of file
test/javax/xml/crypto/dsig/data/signature-no-reference-uri.xml
0 → 100644
浏览文件 @
1df741a3
<test
xmlns=
"http://example.org/envelope"
>
test
<Signature
xmlns=
"http://www.w3.org/2000/09/xmldsig#"
><SignedInfo
xmlns=
"http://www.w3.org/2000/09/xmldsig#"
><CanonicalizationMethod
Algorithm=
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
></CanonicalizationMethod><SignatureMethod
Algorithm=
"http://www.w3.org/2000/09/xmldsig#rsa-sha1"
></SignatureMethod><Reference><Transforms><Transform
Algorithm=
"http://www.w3.org/2000/09/xmldsig#enveloped-signature"
></Transform></Transforms><DigestMethod
Algorithm=
"http://www.w3.org/2000/09/xmldsig#sha1"
></DigestMethod><DigestValue>
1Bq8FsjajUBYPD7stQeJSc66GlM=
</DigestValue></Reference></SignedInfo><SignatureValue>
BNPSYlNcyXcO/Tc1tr9mQ/KAZ40eFybLTDyB/HH1EHHMpc972A+nOX2EWBaLsVgG8apl0Isp1ZqV
gmoDHNF6xrcJJQVydVJzU08GVV4GiXHMqRYQbted7STQLhlhssvNNdMEoVApsX5ByL66wxKZQXrT
z1kZtOHAi88DOrmIJu0=
</SignatureValue></Signature></test>
\ No newline at end of file
test/javax/xml/crypto/dsig/data/signature-wrong-canonicalization-method-algorithm.xml
0 → 100644
浏览文件 @
1df741a3
<test
xmlns=
"http://example.org/envelope"
>
test
<Signature
xmlns=
"http://www.w3.org/2000/09/xmldsig#"
><SignedInfo
xmlns=
"http://www.w3.org/2000/09/xmldsig#"
><CanonicalizationMethod
Algorithm=
"http://oracle.com"
></CanonicalizationMethod><SignatureMethod
Algorithm=
"http://www.w3.org/2000/09/xmldsig#rsa-sha1"
></SignatureMethod><Reference
URI=
""
><Transforms><Transform
Algorithm=
"http://www.w3.org/2000/09/xmldsig#enveloped-signature"
></Transform></Transforms><DigestMethod
Algorithm=
"http://www.w3.org/2000/09/xmldsig#sha1"
></DigestMethod><DigestValue>
1Bq8FsjajUBYPD7stQeJSc66GlM=
</DigestValue></Reference></SignedInfo><SignatureValue>
EBbyEV7e+1CTUsyCTyxiN8p+U3/za1oTjK7q+kF8Q87r8e/7C1z4ndGWbk6zyI3w6leT+I2suW9U
KkdvkrDXX2OyLw0GfgJfLkNn+1pGK6kyWpL95NoWJZhHkUAKKBZ0ikfZ4j33gYxrYK+IYCLeZYzr
hlZjdXXXCiSH0Sq+weQ=
</SignatureValue></Signature></test>
\ No newline at end of file
test/javax/xml/crypto/dsig/data/signature-wrong-signature-method-algorithm.xml
0 → 100644
浏览文件 @
1df741a3
<test
xmlns=
"http://example.org/envelope"
>
test
<Signature
xmlns=
"http://www.w3.org/2000/09/xmldsig#"
><SignedInfo
xmlns=
"http://www.w3.org/2000/09/xmldsig#"
><CanonicalizationMethod
Algorithm=
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
></CanonicalizationMethod><SignatureMethod
Algorithm=
"bogus://bogus"
></SignatureMethod><Reference
URI=
""
><Transforms><Transform
Algorithm=
"http://www.w3.org/2000/09/xmldsig#enveloped-signature"
></Transform></Transforms><DigestMethod
Algorithm=
"http://www.w3.org/2000/09/xmldsig#sha1"
></DigestMethod><DigestValue>
1Bq8FsjajUBYPD7stQeJSc66GlM=
</DigestValue></Reference></SignedInfo><SignatureValue>
RjL9nfQg9u6+KEFfAlBBH7E7ilFgB7YEQ5MxOIJN/fOdQmc5iDD+YuhiHzNGXGi/UOyo6t8LxTxl
X4oFE1RNlPVkSAZK4LcTWhVa757WwgW1/EZo8PQYWp5NScLq6PumYaujoovSYBKW2N6+jQpnD/L6
4cuEVNnwEFqvOLrjogY=
</SignatureValue></Signature></test>
\ No newline at end of file
test/javax/xml/crypto/dsig/data/signature-wrong-tag-names.xml
0 → 100644
浏览文件 @
1df741a3
<test
xmlns=
"http://example.org/envelope"
>
test
<Signature
xmlns=
"http://www.w3.org/2000/09/xmldsig#"
><aSignedInfo
xmlns=
"http://www.w3.org/2000/09/xmldsig#"
><aCanonicalizationMethod
Algorithm=
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
></aCanonicalizationMethod><aSignatureMethod
Algorithm=
"http://www.w3.org/2000/09/xmldsig#rsa-sha1"
></aSignatureMethod><aReference
URI=
""
><Transforms><aTransform
Algorithm=
"http://www.w3.org/2000/09/xmldsig#enveloped-signature"
></aTransform></Transforms><aDigestMethod
Algorithm=
"http://www.w3.org/2000/09/xmldsig#sha1"
></aDigestMethod><aDigestValue>
1Bq8FsjajUBYPD7stQeJSc66GlM=
</aDigestValue></aReference></aSignedInfo><aSignatureValue>
cbNpPGavhM0BGUtrvLxvy2SCIt+I27BPpVEt0Q9mXrdPYurMqWF/67AdY9m5RqS7+ZZlwUtem083
MczRYbKoOIq7sMbCqKKdzbSE/U6rfmky/ACQ5wgemZl8jtipwu5LhAUzjhzT8hhTjVqOYpHdkVJz
l9dnd9eWbLmEr3BI0VA=
</aSignatureValue></Signature></test>
\ No newline at end of file
test/javax/xml/crypto/dsig/data/signature-wrong-transform-algorithm.xml
0 → 100644
浏览文件 @
1df741a3
<!-- This XML signature contains a Transform with wrong algorithm -->
<test
xmlns=
"http://example.org/envelope"
>
test
<Signature
xmlns=
"http://www.w3.org/2000/09/xmldsig#"
><SignedInfo
xmlns=
"http://www.w3.org/2000/09/xmldsig#"
><CanonicalizationMethod
Algorithm=
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
></CanonicalizationMethod><SignatureMethod
Algorithm=
"http://www.w3.org/2000/09/xmldsig#rsa-sha1"
></SignatureMethod><Reference
URI=
""
><Transforms><Transform
Algorithm=
"bogus://bogus"
></Transform></Transforms><DigestMethod
Algorithm=
"http://www.w3.org/2000/09/xmldsig#sha1"
></DigestMethod><DigestValue>
1Bq8FsjajUBYPD7stQeJSc66GlM=
</DigestValue></Reference></SignedInfo><SignatureValue>
Wzyx3jgEKGwY+pBXBmqWLWhASHQYCCGZVii5sKKKeZUBKxNBthjiSVfzKANuLgX6zAt16XRycrSL
zFKTPuvGeWVPDvd+KTNKCJxN9ccrG7v23EM7RY2eMJGu2r5DLfKwV7H6YuJPsOuWifVkKAhvq7gd
6akJshxyAj9Ud+mjo48=
</SignatureValue></Signature></test>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录