Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3bc55a5b
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看板
提交
3bc55a5b
编写于
7月 08, 2009
作者:
A
asaha
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
938e310d
ef9ca2ce
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
35 addition
and
8 deletion
+35
-8
src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/IntegrityHmac.java
...al/security/algorithms/implementations/IntegrityHmac.java
+3
-1
test/com/sun/org/apache/xml/internal/security/TruncateHMAC.java
...om/sun/org/apache/xml/internal/security/TruncateHMAC.java
+17
-7
test/com/sun/org/apache/xml/internal/security/signature-enveloping-hmac-sha1.xml
.../xml/internal/security/signature-enveloping-hmac-sha1.xml
+15
-0
未找到文件。
src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/IntegrityHmac.java
浏览文件 @
3bc55a5b
...
@@ -107,6 +107,8 @@ public abstract class IntegrityHmac extends SignatureAlgorithmSpi {
...
@@ -107,6 +107,8 @@ public abstract class IntegrityHmac extends SignatureAlgorithmSpi {
public
void
reset
()
{
public
void
reset
()
{
_HMACOutputLength
=
0
;
_HMACOutputLength
=
0
;
_HMACOutputLengthSet
=
false
;
_macAlgorithm
.
reset
();
}
}
/**
/**
...
...
test/com/sun/org/apache/xml/internal/security/TruncateHMAC.java
浏览文件 @
3bc55a5b
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
/**
/**
* @test %I% %E%
* @test %I% %E%
* @bug 6824440
* @bug 6824440
6858484
* @summary Check that Apache XMLSec APIs will not accept HMAC truncation
* @summary Check that Apache XMLSec APIs will not accept HMAC truncation
* lengths less than minimum bound
* lengths less than minimum bound
* @compile -XDignore.symbol.file TruncateHMAC.java
* @compile -XDignore.symbol.file TruncateHMAC.java
...
@@ -56,8 +56,10 @@ public class TruncateHMAC {
...
@@ -56,8 +56,10 @@ public class TruncateHMAC {
dbf
=
DocumentBuilderFactory
.
newInstance
();
dbf
=
DocumentBuilderFactory
.
newInstance
();
dbf
.
setNamespaceAware
(
true
);
dbf
.
setNamespaceAware
(
true
);
dbf
.
setValidating
(
false
);
dbf
.
setValidating
(
false
);
validate
(
"signature-enveloping-hmac-sha1-trunclen-0-attack.xml"
);
validate
(
"signature-enveloping-hmac-sha1-trunclen-0-attack.xml"
,
false
);
validate
(
"signature-enveloping-hmac-sha1-trunclen-8-attack.xml"
);
validate
(
"signature-enveloping-hmac-sha1-trunclen-8-attack.xml"
,
false
);
// this one should pass
validate
(
"signature-enveloping-hmac-sha1.xml"
,
true
);
generate_hmac_sha1_40
();
generate_hmac_sha1_40
();
if
(
atLeastOneFailed
)
{
if
(
atLeastOneFailed
)
{
...
@@ -66,7 +68,7 @@ public class TruncateHMAC {
...
@@ -66,7 +68,7 @@ public class TruncateHMAC {
}
}
}
}
private
static
void
validate
(
String
data
)
throws
Exception
{
private
static
void
validate
(
String
data
,
boolean
pass
)
throws
Exception
{
System
.
out
.
println
(
"Validating "
+
data
);
System
.
out
.
println
(
"Validating "
+
data
);
File
file
=
new
File
(
DIR
,
data
);
File
file
=
new
File
(
DIR
,
data
);
...
@@ -83,11 +85,19 @@ public class TruncateHMAC {
...
@@ -83,11 +85,19 @@ public class TruncateHMAC {
try
{
try
{
System
.
out
.
println
System
.
out
.
println
(
"Validation status: "
+
signature
.
checkSignatureValue
(
sk
));
(
"Validation status: "
+
signature
.
checkSignatureValue
(
sk
));
if
(!
pass
)
{
System
.
out
.
println
(
"FAILED"
);
System
.
out
.
println
(
"FAILED"
);
atLeastOneFailed
=
true
;
atLeastOneFailed
=
true
;
}
else
{
System
.
out
.
println
(
"PASSED"
);
}
}
catch
(
XMLSignatureException
xse
)
{
}
catch
(
XMLSignatureException
xse
)
{
System
.
out
.
println
(
xse
.
getMessage
());
System
.
out
.
println
(
xse
.
getMessage
());
if
(!
pass
)
{
System
.
out
.
println
(
"PASSED"
);
System
.
out
.
println
(
"PASSED"
);
}
else
{
System
.
out
.
println
(
"FAILED"
);
}
}
}
}
}
...
...
test/com/sun/org/apache/xml/internal/security/signature-enveloping-hmac-sha1.xml
0 → 100644
浏览文件 @
3bc55a5b
<?xml version="1.0" encoding="UTF-8"?>
<Signature
xmlns=
"http://www.w3.org/2000/09/xmldsig#"
>
<SignedInfo>
<CanonicalizationMethod
Algorithm=
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
/>
<SignatureMethod
Algorithm=
"http://www.w3.org/2000/09/xmldsig#hmac-sha1"
/>
<Reference
URI=
"#object"
>
<DigestMethod
Algorithm=
"http://www.w3.org/2000/09/xmldsig#sha1"
/>
<DigestValue>
7/XTsHaBSOnJ/jXD5v0zL6VKYsk=
</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>
JElPttIT4Am7Q+MNoMyv+WDfAZw=
</SignatureValue>
<Object
Id=
"object"
>
some text
</Object>
</Signature>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录