Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
e09f38d3
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e09f38d3
编写于
12月 10, 2009
作者:
C
chegar
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
2fdfaba3
21f0a02d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
58 addition
and
3 deletion
+58
-3
src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
...lasses/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
+4
-1
test/javax/xml/crypto/dsig/GenerationTests.java
test/javax/xml/crypto/dsig/GenerationTests.java
+54
-2
未找到文件。
src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
浏览文件 @
e09f38d3
...
...
@@ -326,7 +326,7 @@ public final class DOMXMLSignature extends DOMStructure
}
// generate references and signature value
List
allReferences
=
new
ArrayList
(
si
.
getReferences
()
);
List
allReferences
=
new
ArrayList
();
// traverse the Signature and register all objects with IDs that
// may contain References
...
...
@@ -356,6 +356,9 @@ public final class DOMXMLSignature extends DOMStructure
}
}
}
// always add SignedInfo references after Manifest references so
// that Manifest reference are digested first
allReferences
.
addAll
(
si
.
getReferences
());
// generate/digest each reference
for
(
int
i
=
0
,
size
=
allReferences
.
size
();
i
<
size
;
i
++)
{
...
...
test/javax/xml/crypto/dsig/GenerationTests.java
浏览文件 @
e09f38d3
...
...
@@ -23,7 +23,7 @@
/**
* @test
* @bug 4635230 6283345 6303830 6824440
* @bug 4635230 6283345 6303830 6824440
6867348
* @summary Basic unit tests for generating XML Signatures with JSR 105
* @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
* X509KeySelector.java GenerationTests.java
...
...
@@ -126,13 +126,14 @@ public class GenerationTests {
test_create_signature_x509_is
();
test_create_signature_x509_ski
();
test_create_signature_x509_sn
();
//
test_create_signature();
test_create_signature
();
test_create_exc_signature
();
test_create_sign_spec
();
test_create_signature_enveloping_sha256_dsa
();
test_create_signature_enveloping_sha384_rsa_sha256
();
test_create_signature_enveloping_sha512_rsa_sha384
();
test_create_signature_enveloping_sha512_rsa_sha512
();
test_create_signature_reference_dependency
();
}
private
static
void
setup
()
throws
Exception
{
...
...
@@ -410,6 +411,55 @@ public class GenerationTests {
System
.
out
.
println
();
}
static
void
test_create_signature_reference_dependency
()
throws
Exception
{
System
.
out
.
println
(
"* Generating signature-reference-dependency.xml"
);
// create references
List
<
Reference
>
refs
=
Collections
.
singletonList
(
fac
.
newReference
(
"#object-1"
,
sha1
));
// create SignedInfo
SignedInfo
si
=
fac
.
newSignedInfo
(
withoutComments
,
rsaSha1
,
refs
);
// create objects
List
<
XMLStructure
>
objs
=
new
ArrayList
<
XMLStructure
>();
// Object 1
List
<
Reference
>
manRefs
=
Collections
.
singletonList
(
fac
.
newReference
(
"#object-2"
,
sha1
));
objs
.
add
(
fac
.
newXMLObject
(
Collections
.
singletonList
(
fac
.
newManifest
(
manRefs
,
"manifest-1"
)),
"object-1"
,
null
,
null
));
// Object 2
Document
doc
=
db
.
newDocument
();
Element
nc
=
doc
.
createElementNS
(
null
,
"NonCommentandus"
);
nc
.
setAttributeNS
(
"http://www.w3.org/2000/xmlns/"
,
"xmlns"
,
""
);
nc
.
appendChild
(
doc
.
createComment
(
" Commentandum "
));
objs
.
add
(
fac
.
newXMLObject
(
Collections
.
singletonList
(
new
DOMStructure
(
nc
)),
"object-2"
,
null
,
null
));
// create XMLSignature
XMLSignature
sig
=
fac
.
newXMLSignature
(
si
,
rsa
,
objs
,
"signature"
,
null
);
DOMSignContext
dsc
=
new
DOMSignContext
(
getPrivateKey
(
"RSA"
),
doc
);
sig
.
sign
(
dsc
);
// dumpDocument(doc, new PrintWriter(System.out));
DOMValidateContext
dvc
=
new
DOMValidateContext
(
kvks
,
doc
.
getDocumentElement
());
XMLSignature
sig2
=
fac
.
unmarshalXMLSignature
(
dvc
);
if
(
sig
.
equals
(
sig2
)
==
false
)
{
throw
new
Exception
(
"Unmarshalled signature is not equal to generated signature"
);
}
if
(
sig2
.
validate
(
dvc
)
==
false
)
{
throw
new
Exception
(
"Validation of generated signature failed"
);
}
System
.
out
.
println
();
}
static
void
test_create_signature
()
throws
Exception
{
System
.
out
.
println
(
"* Generating signature.xml"
);
...
...
@@ -645,6 +695,7 @@ public class GenerationTests {
envDoc
.
getElementsByTagName
(
"YoursSincerely"
).
item
(
0
);
DOMSignContext
dsc
=
new
DOMSignContext
(
signingKey
,
ys
);
dsc
.
setURIDereferencer
(
httpUd
);
sig
.
sign
(
dsc
);
...
...
@@ -660,6 +711,7 @@ public class GenerationTests {
DOMValidateContext
dvc
=
new
DOMValidateContext
(
new
X509KeySelector
(
ks
),
sigElement
);
dvc
.
setURIDereferencer
(
httpUd
);
File
f
=
new
File
(
System
.
getProperty
(
"dir.test.vector.baltimore"
)
+
System
.
getProperty
(
"file.separator"
)
+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录