Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c899ae3a
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看板
提交
c899ae3a
编写于
3月 21, 2016
作者:
M
mullan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8072463: Remove requirement that AKID and SKID have to match when building certificate chain
Reviewed-by: xuelei
上级
b1db35f1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
65 addition
and
35 deletion
+65
-35
src/share/classes/sun/security/provider/certpath/AdaptableX509CertSelector.java
...security/provider/certpath/AdaptableX509CertSelector.java
+1
-9
src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java
.../security/provider/certpath/DistributionPointFetcher.java
+3
-7
src/share/classes/sun/security/provider/certpath/ForwardBuilder.java
...lasses/sun/security/provider/certpath/ForwardBuilder.java
+49
-19
src/share/classes/sun/security/x509/AuthorityKeyIdentifierExtension.java
...es/sun/security/x509/AuthorityKeyIdentifierExtension.java
+12
-0
未找到文件。
src/share/classes/sun/security/provider/certpath/AdaptableX509CertSelector.java
浏览文件 @
c899ae3a
...
@@ -36,9 +36,7 @@ import java.util.Date;
...
@@ -36,9 +36,7 @@ import java.util.Date;
import
sun.security.util.Debug
;
import
sun.security.util.Debug
;
import
sun.security.util.DerInputStream
;
import
sun.security.util.DerInputStream
;
import
sun.security.util.DerOutputStream
;
import
sun.security.x509.SerialNumber
;
import
sun.security.x509.SerialNumber
;
import
sun.security.x509.KeyIdentifier
;
import
sun.security.x509.AuthorityKeyIdentifierExtension
;
import
sun.security.x509.AuthorityKeyIdentifierExtension
;
/**
/**
...
@@ -131,13 +129,7 @@ class AdaptableX509CertSelector extends X509CertSelector {
...
@@ -131,13 +129,7 @@ class AdaptableX509CertSelector extends X509CertSelector {
serial
=
null
;
serial
=
null
;
if
(
ext
!=
null
)
{
if
(
ext
!=
null
)
{
KeyIdentifier
akid
=
(
KeyIdentifier
)
ext
.
get
(
ski
=
ext
.
getEncodedKeyIdentifier
();
AuthorityKeyIdentifierExtension
.
KEY_ID
);
if
(
akid
!=
null
)
{
DerOutputStream
derout
=
new
DerOutputStream
();
derout
.
putOctetString
(
akid
.
getIdentifier
());
ski
=
derout
.
toByteArray
();
}
SerialNumber
asn
=
(
SerialNumber
)
ext
.
get
(
SerialNumber
asn
=
(
SerialNumber
)
ext
.
get
(
AuthorityKeyIdentifierExtension
.
SERIAL_NUMBER
);
AuthorityKeyIdentifierExtension
.
SERIAL_NUMBER
);
if
(
asn
!=
null
)
{
if
(
asn
!=
null
)
{
...
...
src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java
浏览文件 @
c899ae3a
...
@@ -33,7 +33,6 @@ import javax.security.auth.x500.X500Principal;
...
@@ -33,7 +33,6 @@ import javax.security.auth.x500.X500Principal;
import
java.util.*
;
import
java.util.*
;
import
sun.security.util.Debug
;
import
sun.security.util.Debug
;
import
sun.security.util.DerOutputStream
;
import
static
sun
.
security
.
x509
.
PKIXExtensions
.*;
import
static
sun
.
security
.
x509
.
PKIXExtensions
.*;
import
sun.security.x509.*
;
import
sun.security.x509.*
;
...
@@ -608,12 +607,9 @@ public class DistributionPointFetcher {
...
@@ -608,12 +607,9 @@ public class DistributionPointFetcher {
AuthorityKeyIdentifierExtension
akidext
=
AuthorityKeyIdentifierExtension
akidext
=
crlImpl
.
getAuthKeyIdExtension
();
crlImpl
.
getAuthKeyIdExtension
();
if
(
akidext
!=
null
)
{
if
(
akidext
!=
null
)
{
KeyIdentifier
akid
=
(
KeyIdentifier
)
akidext
.
get
(
byte
[]
kid
=
akidext
.
getEncodedKeyIdentifier
();
AuthorityKeyIdentifierExtension
.
KEY_ID
);
if
(
kid
!=
null
)
{
if
(
akid
!=
null
)
{
certSel
.
setSubjectKeyIdentifier
(
kid
);
DerOutputStream
derout
=
new
DerOutputStream
();
derout
.
putOctetString
(
akid
.
getIdentifier
());
certSel
.
setSubjectKeyIdentifier
(
derout
.
toByteArray
());
}
}
SerialNumber
asn
=
(
SerialNumber
)
akidext
.
get
(
SerialNumber
asn
=
(
SerialNumber
)
akidext
.
get
(
...
...
src/share/classes/sun/security/provider/certpath/ForwardBuilder.java
浏览文件 @
c899ae3a
...
@@ -46,9 +46,10 @@ import sun.security.provider.certpath.PKIX.BuilderParams;
...
@@ -46,9 +46,10 @@ import sun.security.provider.certpath.PKIX.BuilderParams;
import
sun.security.util.Debug
;
import
sun.security.util.Debug
;
import
sun.security.x509.AccessDescription
;
import
sun.security.x509.AccessDescription
;
import
sun.security.x509.AuthorityInfoAccessExtension
;
import
sun.security.x509.AuthorityInfoAccessExtension
;
import
sun.security.x509.AuthorityKeyIdentifierExtension
;
import
static
sun
.
security
.
x509
.
PKIXExtensions
.*;
import
static
sun
.
security
.
x509
.
PKIXExtensions
.*;
import
sun.security.x509.X500Name
;
import
sun.security.x509.X500Name
;
import
sun.security.x509.
AuthorityKeyIdentifierExtension
;
import
sun.security.x509.
X509CertImpl
;
/**
/**
* This class represents a forward builder, which is able to retrieve
* This class represents a forward builder, which is able to retrieve
...
@@ -69,7 +70,6 @@ class ForwardBuilder extends Builder {
...
@@ -69,7 +70,6 @@ class ForwardBuilder extends Builder {
private
AdaptableX509CertSelector
caSelector
;
private
AdaptableX509CertSelector
caSelector
;
private
X509CertSelector
caTargetSelector
;
private
X509CertSelector
caTargetSelector
;
TrustAnchor
trustAnchor
;
TrustAnchor
trustAnchor
;
private
Comparator
<
X509Certificate
>
comparator
;
private
boolean
searchAllCertStores
=
true
;
private
boolean
searchAllCertStores
=
true
;
/**
/**
...
@@ -93,7 +93,6 @@ class ForwardBuilder extends Builder {
...
@@ -93,7 +93,6 @@ class ForwardBuilder extends Builder {
trustedSubjectDNs
.
add
(
anchor
.
getCA
());
trustedSubjectDNs
.
add
(
anchor
.
getCA
());
}
}
}
}
comparator
=
new
PKIXCertComparator
(
trustedSubjectDNs
);
this
.
searchAllCertStores
=
searchAllCertStores
;
this
.
searchAllCertStores
=
searchAllCertStores
;
}
}
...
@@ -122,6 +121,8 @@ class ForwardBuilder extends Builder {
...
@@ -122,6 +121,8 @@ class ForwardBuilder extends Builder {
* As each cert is added, it is sorted based on the PKIXCertComparator
* As each cert is added, it is sorted based on the PKIXCertComparator
* algorithm.
* algorithm.
*/
*/
Comparator
<
X509Certificate
>
comparator
=
new
PKIXCertComparator
(
trustedSubjectDNs
,
currState
.
cert
);
Set
<
X509Certificate
>
certs
=
new
TreeSet
<>(
comparator
);
Set
<
X509Certificate
>
certs
=
new
TreeSet
<>(
comparator
);
/*
/*
...
@@ -264,14 +265,6 @@ class ForwardBuilder extends Builder {
...
@@ -264,14 +265,6 @@ class ForwardBuilder extends Builder {
CertPathHelper
.
setPathToNames
CertPathHelper
.
setPathToNames
(
caSelector
,
currentState
.
subjectNamesTraversed
);
(
caSelector
,
currentState
.
subjectNamesTraversed
);
/*
* Facilitate certification path construction with authority
* key identifier and subject key identifier.
*/
AuthorityKeyIdentifierExtension
akidext
=
currentState
.
cert
.
getAuthorityKeyIdentifierExtension
();
caSelector
.
setSkiAndSerialNumber
(
akidext
);
/*
/*
* check the validity period
* check the validity period
*/
*/
...
@@ -404,41 +397,68 @@ class ForwardBuilder extends Builder {
...
@@ -404,41 +397,68 @@ class ForwardBuilder extends Builder {
*
*
* Preference order for current cert:
* Preference order for current cert:
*
*
* 1) Issuer matches a trusted subject
* 1) The key identifier of an AKID extension (if present) in the
* previous certificate matches the key identifier in the SKID extension
*
* 2) Issuer matches a trusted subject
* Issuer: ou=D,ou=C,o=B,c=A
* Issuer: ou=D,ou=C,o=B,c=A
*
*
*
2
) Issuer is a descendant of a trusted subject (in order of
*
3
) Issuer is a descendant of a trusted subject (in order of
* number of links to the trusted subject)
* number of links to the trusted subject)
* a) Issuer: ou=E,ou=D,ou=C,o=B,c=A [links=1]
* a) Issuer: ou=E,ou=D,ou=C,o=B,c=A [links=1]
* b) Issuer: ou=F,ou=E,ou=D,ou=C,ou=B,c=A [links=2]
* b) Issuer: ou=F,ou=E,ou=D,ou=C,ou=B,c=A [links=2]
*
*
*
3
) Issuer is an ancestor of a trusted subject (in order of number of
*
4
) Issuer is an ancestor of a trusted subject (in order of number of
* links to the trusted subject)
* links to the trusted subject)
* a) Issuer: ou=C,o=B,c=A [links=1]
* a) Issuer: ou=C,o=B,c=A [links=1]
* b) Issuer: o=B,c=A [links=2]
* b) Issuer: o=B,c=A [links=2]
*
*
*
4
) Issuer is in the same namespace as a trusted subject (in order of
*
5
) Issuer is in the same namespace as a trusted subject (in order of
* number of links to the trusted subject)
* number of links to the trusted subject)
* a) Issuer: ou=G,ou=C,o=B,c=A [links=2]
* a) Issuer: ou=G,ou=C,o=B,c=A [links=2]
* b) Issuer: ou=H,o=B,c=A [links=3]
* b) Issuer: ou=H,o=B,c=A [links=3]
*
*
*
5
) Issuer is an ancestor of certificate subject (in order of number
*
6
) Issuer is an ancestor of certificate subject (in order of number
* of links to the certificate subject)
* of links to the certificate subject)
* a) Issuer: ou=K,o=J,c=A
* a) Issuer: ou=K,o=J,c=A
* Subject: ou=L,ou=K,o=J,c=A
* Subject: ou=L,ou=K,o=J,c=A
* b) Issuer: o=J,c=A
* b) Issuer: o=J,c=A
* Subject: ou=L,ou=K,0=J,c=A
* Subject: ou=L,ou=K,0=J,c=A
*
*
*
6
) Any other certificates
*
7
) Any other certificates
*/
*/
static
class
PKIXCertComparator
implements
Comparator
<
X509Certificate
>
{
static
class
PKIXCertComparator
implements
Comparator
<
X509Certificate
>
{
final
static
String
METHOD_NME
=
"PKIXCertComparator.compare()"
;
static
final
String
METHOD_NME
=
"PKIXCertComparator.compare()"
;
private
final
Set
<
X500Principal
>
trustedSubjectDNs
;
private
final
Set
<
X500Principal
>
trustedSubjectDNs
;
private
final
X509CertSelector
certSkidSelector
;
PKIXCertComparator
(
Set
<
X500Principal
>
trustedSubjectDNs
)
{
PKIXCertComparator
(
Set
<
X500Principal
>
trustedSubjectDNs
,
X509CertImpl
previousCert
)
throws
IOException
{
this
.
trustedSubjectDNs
=
trustedSubjectDNs
;
this
.
trustedSubjectDNs
=
trustedSubjectDNs
;
this
.
certSkidSelector
=
getSelector
(
previousCert
);
}
/**
* Returns an X509CertSelector for matching on the authority key
* identifier, or null if not applicable.
*/
private
X509CertSelector
getSelector
(
X509CertImpl
previousCert
)
throws
IOException
{
if
(
previousCert
!=
null
)
{
AuthorityKeyIdentifierExtension
akidExt
=
previousCert
.
getAuthorityKeyIdentifierExtension
();
if
(
akidExt
!=
null
)
{
byte
[]
skid
=
akidExt
.
getEncodedKeyIdentifier
();
if
(
skid
!=
null
)
{
X509CertSelector
selector
=
new
X509CertSelector
();
selector
.
setSubjectKeyIdentifier
(
skid
);
return
selector
;
}
}
}
return
null
;
}
}
/**
/**
...
@@ -462,6 +482,16 @@ class ForwardBuilder extends Builder {
...
@@ -462,6 +482,16 @@ class ForwardBuilder extends Builder {
// if certs are the same, return 0
// if certs are the same, return 0
if
(
oCert1
.
equals
(
oCert2
))
return
0
;
if
(
oCert1
.
equals
(
oCert2
))
return
0
;
// If akid/skid match then it is preferable
if
(
certSkidSelector
!=
null
)
{
if
(
certSkidSelector
.
match
(
oCert1
))
{
return
-
1
;
}
if
(
certSkidSelector
.
match
(
oCert2
))
{
return
1
;
}
}
X500Principal
cIssuer1
=
oCert1
.
getIssuerX500Principal
();
X500Principal
cIssuer1
=
oCert1
.
getIssuerX500Principal
();
X500Principal
cIssuer2
=
oCert2
.
getIssuerX500Principal
();
X500Principal
cIssuer2
=
oCert2
.
getIssuerX500Principal
();
X500Name
cIssuer1Name
=
X500Name
.
asX500Name
(
cIssuer1
);
X500Name
cIssuer1Name
=
X500Name
.
asX500Name
(
cIssuer1
);
...
...
src/share/classes/sun/security/x509/AuthorityKeyIdentifierExtension.java
浏览文件 @
c899ae3a
...
@@ -307,4 +307,16 @@ implements CertAttrSet<String> {
...
@@ -307,4 +307,16 @@ implements CertAttrSet<String> {
public
String
getName
()
{
public
String
getName
()
{
return
(
NAME
);
return
(
NAME
);
}
}
/**
* Return the encoded key identifier, or null if not specified.
*/
public
byte
[]
getEncodedKeyIdentifier
()
throws
IOException
{
if
(
id
!=
null
)
{
DerOutputStream
derOut
=
new
DerOutputStream
();
id
.
encode
(
derOut
);
return
derOut
.
toByteArray
();
}
return
null
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录