Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
62032ff9
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看板
提交
62032ff9
编写于
5月 13, 2013
作者:
M
mullan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8010714: XML DSig API allows a RetrievalMethod to reference another RetrievalMethod
Reviewed-by: xuelei, hawtin
上级
842c54ea
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
114 addition
and
25 deletion
+114
-25
src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java
...om/sun/org/apache/xml/internal/security/keys/KeyInfo.java
+8
-5
src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java
.../org/apache/xml/internal/security/signature/Manifest.java
+12
-2
src/share/classes/com/sun/org/apache/xml/internal/security/signature/ObjectContainer.java
...ache/xml/internal/security/signature/ObjectContainer.java
+2
-3
src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java
...org/apache/xml/internal/security/signature/Reference.java
+1
-2
src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperties.java
.../xml/internal/security/signature/SignatureProperties.java
+18
-3
src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperty.java
...he/xml/internal/security/signature/SignatureProperty.java
+2
-3
src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java
.../apache/xml/internal/security/signature/XMLSignature.java
+36
-3
src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java
...he/xml/internal/security/signature/XMLSignatureInput.java
+3
-3
src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java
.../org/apache/xml/internal/security/utils/ElementProxy.java
+12
-0
src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java
...sses/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java
+1
-1
src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
...ses/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
+15
-0
src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java
src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java
+3
-0
test/com/sun/org/apache/xml/internal/security/TruncateHMAC.java
...om/sun/org/apache/xml/internal/security/TruncateHMAC.java
+1
-0
未找到文件。
src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java
浏览文件 @
62032ff9
...
...
@@ -54,6 +54,7 @@ import com.sun.org.apache.xml.internal.security.utils.Constants;
import
com.sun.org.apache.xml.internal.security.utils.IdResolver
;
import
com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy
;
import
com.sun.org.apache.xml.internal.security.utils.XMLUtils
;
import
org.w3c.dom.Attr
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Element
;
import
org.w3c.dom.Node
;
...
...
@@ -128,8 +129,11 @@ public class KeyInfo extends SignatureElementProxy {
*/
public
KeyInfo
(
Element
element
,
String
BaseURI
)
throws
XMLSecurityException
{
super
(
element
,
BaseURI
);
// _storageResolvers.add(null);
Attr
attr
=
element
.
getAttributeNodeNS
(
null
,
"Id"
);
if
(
attr
!=
null
)
{
element
.
setIdAttributeNode
(
attr
,
true
);
}
}
/**
...
...
@@ -139,9 +143,8 @@ public class KeyInfo extends SignatureElementProxy {
*/
public
void
setId
(
String
Id
)
{
if
((
Id
!=
null
))
{
this
.
_constructionElement
.
setAttributeNS
(
null
,
Constants
.
_ATT_ID
,
Id
);
IdResolver
.
registerElementById
(
this
.
_constructionElement
,
Id
);
if
(
Id
!=
null
)
{
setLocalIdAttribute
(
Constants
.
_ATT_ID
,
Id
);
}
}
...
...
@@ -1008,7 +1011,7 @@ public class KeyInfo extends SignatureElementProxy {
/**
* Stores the individual (per-KeyInfo) {@link KeyResolver}s
*/
List
<
KeyResolverSpi
>
_internalKeyResolvers
=
n
ull
;
List
<
KeyResolverSpi
>
_internalKeyResolvers
=
n
ew
ArrayList
<
KeyResolverSpi
>()
;
/**
* This method is used to add a custom {@link KeyResolverSpi} to a KeyInfo
...
...
src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java
浏览文件 @
62032ff9
...
...
@@ -43,6 +43,7 @@ import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
import
com.sun.org.apache.xml.internal.security.utils.XMLUtils
;
import
com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolver
;
import
com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverSpi
;
import
org.w3c.dom.Attr
;
import
org.w3c.dom.DOMException
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Element
;
...
...
@@ -101,6 +102,11 @@ public class Manifest extends SignatureElementProxy {
super
(
element
,
BaseURI
);
Attr
attr
=
element
.
getAttributeNodeNS
(
null
,
"Id"
);
if
(
attr
!=
null
)
{
element
.
setIdAttributeNode
(
attr
,
true
);
}
// check out Reference children
this
.
_referencesEl
=
XMLUtils
.
selectDsNodes
(
this
.
_constructionElement
.
getFirstChild
(),
Constants
.
_TAG_REFERENCE
);
...
...
@@ -121,6 +127,11 @@ public class Manifest extends SignatureElementProxy {
this
.
_references
=
new
ArrayList
<
Reference
>(
le
);
for
(
int
i
=
0
;
i
<
le
;
i
++)
{
Element
refElem
=
this
.
_referencesEl
[
i
];
Attr
refAttr
=
refElem
.
getAttributeNodeNS
(
null
,
"Id"
);
if
(
refAttr
!=
null
)
{
refElem
.
setIdAttributeNode
(
refAttr
,
true
);
}
this
.
_references
.
add
(
null
);
}
}
...
...
@@ -221,8 +232,7 @@ public class Manifest extends SignatureElementProxy {
public
void
setId
(
String
Id
)
{
if
(
Id
!=
null
)
{
this
.
_constructionElement
.
setAttributeNS
(
null
,
Constants
.
_ATT_ID
,
Id
);
IdResolver
.
registerElementById
(
this
.
_constructionElement
,
Id
);
setLocalIdAttribute
(
Constants
.
_ATT_ID
,
Id
);
}
}
...
...
src/share/classes/com/sun/org/apache/xml/internal/security/signature/ObjectContainer.java
浏览文件 @
62032ff9
...
...
@@ -68,9 +68,8 @@ public class ObjectContainer extends SignatureElementProxy {
*/
public
void
setId
(
String
Id
)
{
if
((
Id
!=
null
))
{
this
.
_constructionElement
.
setAttributeNS
(
null
,
Constants
.
_ATT_ID
,
Id
);
IdResolver
.
registerElementById
(
this
.
_constructionElement
,
Id
);
if
(
Id
!=
null
)
{
setLocalIdAttribute
(
Constants
.
_ATT_ID
,
Id
);
}
}
...
...
src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java
浏览文件 @
62032ff9
...
...
@@ -284,8 +284,7 @@ private Element digestValueElement;
public
void
setId
(
String
Id
)
{
if
(
Id
!=
null
)
{
this
.
_constructionElement
.
setAttributeNS
(
null
,
Constants
.
_ATT_ID
,
Id
);
IdResolver
.
registerElementById
(
this
.
_constructionElement
,
Id
);
setLocalIdAttribute
(
Constants
.
_ATT_ID
,
Id
);
}
}
...
...
src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperties.java
浏览文件 @
62032ff9
...
...
@@ -25,6 +25,7 @@ import com.sun.org.apache.xml.internal.security.utils.Constants;
import
com.sun.org.apache.xml.internal.security.utils.IdResolver
;
import
com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy
;
import
com.sun.org.apache.xml.internal.security.utils.XMLUtils
;
import
org.w3c.dom.Attr
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Element
;
...
...
@@ -61,6 +62,21 @@ public class SignatureProperties extends SignatureElementProxy {
public
SignatureProperties
(
Element
element
,
String
BaseURI
)
throws
XMLSecurityException
{
super
(
element
,
BaseURI
);
Attr
attr
=
element
.
getAttributeNodeNS
(
null
,
"Id"
);
if
(
attr
!=
null
)
{
element
.
setIdAttributeNode
(
attr
,
true
);
}
int
length
=
getLength
();
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
Element
propertyElem
=
XMLUtils
.
selectDsNode
(
getElement
(),
Constants
.
_TAG_SIGNATUREPROPERTY
,
i
);
Attr
propertyAttr
=
propertyElem
.
getAttributeNodeNS
(
null
,
"Id"
);
if
(
propertyAttr
!=
null
)
{
propertyElem
.
setIdAttributeNode
(
propertyAttr
,
true
);
}
}
}
/**
...
...
@@ -109,9 +125,8 @@ public class SignatureProperties extends SignatureElementProxy {
*/
public
void
setId
(
String
Id
)
{
if
((
Id
!=
null
))
{
this
.
_constructionElement
.
setAttributeNS
(
null
,
Constants
.
_ATT_ID
,
Id
);
IdResolver
.
registerElementById
(
this
.
_constructionElement
,
Id
);
if
(
Id
!=
null
)
{
setLocalIdAttribute
(
Constants
.
_ATT_ID
,
Id
);
}
}
...
...
src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperty.java
浏览文件 @
62032ff9
...
...
@@ -80,9 +80,8 @@ public class SignatureProperty extends SignatureElementProxy {
*/
public
void
setId
(
String
Id
)
{
if
((
Id
!=
null
))
{
this
.
_constructionElement
.
setAttributeNS
(
null
,
Constants
.
_ATT_ID
,
Id
);
IdResolver
.
registerElementById
(
this
.
_constructionElement
,
Id
);
if
(
Id
!=
null
)
{
setLocalIdAttribute
(
Constants
.
_ATT_ID
,
Id
);
}
}
...
...
src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java
浏览文件 @
62032ff9
...
...
@@ -49,9 +49,11 @@ import com.sun.org.apache.xml.internal.security.utils.UnsyncBufferedOutputStream
import
com.sun.org.apache.xml.internal.security.utils.XMLUtils
;
import
com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolver
;
import
com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverSpi
;
import
org.w3c.dom.Attr
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Element
;
import
org.w3c.dom.Node
;
import
org.w3c.dom.NodeList
;
import
org.w3c.dom.Text
;
...
...
@@ -306,6 +308,10 @@ private Element signatureValueElement;
throw
new
XMLSignatureException
(
"xml.WrongContent"
,
exArgs
);
}
Attr
signatureValueAttr
=
signatureValueElement
.
getAttributeNodeNS
(
null
,
"Id"
);
if
(
signatureValueAttr
!=
null
)
{
signatureValueElement
.
setIdAttributeNode
(
signatureValueAttr
,
true
);
}
// <element ref="ds:KeyInfo" minOccurs="0"/>
Element
keyInfoElem
=
XMLUtils
.
getNextElement
(
signatureValueElement
.
getNextSibling
());
//XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
...
...
@@ -316,6 +322,34 @@ private Element signatureValueElement;
keyInfoElem
.
getLocalName
().
equals
(
Constants
.
_TAG_KEYINFO
))
)
{
this
.
_keyInfo
=
new
KeyInfo
(
keyInfoElem
,
BaseURI
);
}
// <element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/>
Element
objectElem
=
XMLUtils
.
getNextElement
(
signatureValueElement
.
getNextSibling
());
while
(
objectElem
!=
null
)
{
Attr
objectAttr
=
objectElem
.
getAttributeNodeNS
(
null
,
"Id"
);
if
(
objectAttr
!=
null
)
{
objectElem
.
setIdAttributeNode
(
objectAttr
,
true
);
}
NodeList
nodes
=
objectElem
.
getChildNodes
();
int
length
=
nodes
.
getLength
();
// Register Ids of the Object child elements
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
Node
child
=
nodes
.
item
(
i
);
if
(
child
.
getNodeType
()
==
Node
.
ELEMENT_NODE
)
{
Element
childElem
=
(
Element
)
child
;
String
tag
=
childElem
.
getLocalName
();
if
(
tag
.
equals
(
"Manifest"
))
{
new
Manifest
(
childElem
,
BaseURI
);
}
else
if
(
tag
.
equals
(
"SignatureProperties"
))
{
new
SignatureProperties
(
childElem
,
BaseURI
);
}
}
}
objectElem
=
XMLUtils
.
getNextElement
(
objectElem
.
getNextSibling
());
}
}
/**
...
...
@@ -325,9 +359,8 @@ private Element signatureValueElement;
*/
public
void
setId
(
String
Id
)
{
if
(
(
Id
!=
null
))
{
this
.
_constructionElement
.
setAttributeNS
(
null
,
Constants
.
_ATT_ID
,
Id
);
IdResolver
.
registerElementById
(
this
.
_constructionElement
,
Id
);
if
(
Id
!=
null
)
{
setLocalIdAttribute
(
Constants
.
_ATT_ID
,
Id
);
}
}
...
...
src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java
浏览文件 @
62032ff9
...
...
@@ -27,7 +27,7 @@ import java.io.InputStream;
import
java.io.OutputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.
Linked
HashSet
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -245,13 +245,13 @@ public class XMLSignatureInput implements Cloneable {
if
(
circumvent
)
{
XMLUtils
.
circumventBug2650
(
XMLUtils
.
getOwnerDocument
(
_subNode
));
}
this
.
_inputNodeSet
=
new
HashSet
<
Node
>();
this
.
_inputNodeSet
=
new
Linked
HashSet
<
Node
>();
XMLUtils
.
getSet
(
_subNode
,
this
.
_inputNodeSet
,
excludeNode
,
this
.
excludeComments
);
return
this
.
_inputNodeSet
;
}
else
if
(
this
.
isOctetStream
())
{
convertToNodes
();
HashSet
<
Node
>
result
=
new
HashSet
<
Node
>();
LinkedHashSet
<
Node
>
result
=
new
Linked
HashSet
<
Node
>();
XMLUtils
.
getSet
(
_subNode
,
result
,
null
,
false
);
//this._inputNodeSet=result;
return
result
;
...
...
src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java
浏览文件 @
62032ff9
...
...
@@ -515,4 +515,16 @@ public abstract class ElementProxy {
return
prefixMappings
.
get
(
namespace
);
}
protected
void
setLocalIdAttribute
(
String
attrName
,
String
value
)
{
if
(
value
!=
null
)
{
Attr
attr
=
getDocument
().
createAttributeNS
(
null
,
attrName
);
attr
.
setValue
(
value
);
getElement
().
setAttributeNodeNS
(
attr
);
getElement
().
setIdAttributeNode
(
attr
,
true
);
}
else
{
getElement
().
removeAttributeNS
(
null
,
attrName
);
}
}
}
src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java
浏览文件 @
62032ff9
...
...
@@ -48,7 +48,7 @@ public class ApacheNodeSetData implements ApacheData, NodeSetData {
public
Iterator
iterator
()
{
// If nodefilters are set, must execute them first to create node-set
if
(
xi
.
getNodeFilters
()
!=
null
)
{
if
(
xi
.
getNodeFilters
()
!=
null
&&
!
xi
.
getNodeFilters
().
isEmpty
()
)
{
return
Collections
.
unmodifiableSet
(
getNodeSet
(
xi
.
getNodeFilters
())).
iterator
();
}
...
...
src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
浏览文件 @
62032ff9
...
...
@@ -230,6 +230,21 @@ public final class DOMRetrievalMethod extends DOMStructure
}
catch
(
Exception
e
)
{
throw
new
URIReferenceException
(
e
);
}
// guard against RetrievalMethod loops
if
((
data
instanceof
NodeSetData
)
&&
Utils
.
secureValidation
(
context
))
{
NodeSetData
nsd
=
(
NodeSetData
)
data
;
Iterator
i
=
nsd
.
iterator
();
if
(
i
.
hasNext
())
{
Node
root
=
(
Node
)
i
.
next
();
if
(
"RetrievalMethod"
.
equals
(
root
.
getLocalName
()))
{
throw
new
URIReferenceException
(
"It is forbidden to have one RetrievalMethod point "
+
"to another when secure validation is enabled"
);
}
}
}
return
data
;
}
...
...
src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java
浏览文件 @
62032ff9
...
...
@@ -107,6 +107,9 @@ public final class Utils {
}
static
boolean
secureValidation
(
XMLCryptoContext
xc
)
{
if
(
xc
==
null
)
{
return
false
;
}
return
getBoolean
(
xc
,
"org.jcp.xml.dsig.secureValidation"
);
}
...
...
test/com/sun/org/apache/xml/internal/security/TruncateHMAC.java
浏览文件 @
62032ff9
...
...
@@ -97,6 +97,7 @@ public class TruncateHMAC {
System
.
out
.
println
(
"PASSED"
);
}
else
{
System
.
out
.
println
(
"FAILED"
);
atLeastOneFailed
=
true
;
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录