Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
4c8b5981
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4c8b5981
编写于
6月 09, 2008
作者:
W
wetmore
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
9f4b0a82
878c17e5
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
623 addition
and
2 deletion
+623
-2
src/share/classes/sun/security/ssl/ClientHandshaker.java
src/share/classes/sun/security/ssl/ClientHandshaker.java
+62
-2
test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/RSAExport.java
.../sun/net/ssl/internal/ssl/ClientHandshaker/RSAExport.java
+561
-0
未找到文件。
src/share/classes/sun/security/ssl/ClientHandshaker.java
浏览文件 @
4c8b5981
...
...
@@ -32,6 +32,7 @@ import java.security.*;
import
java.util.*
;
import
java.security.interfaces.ECPublicKey
;
import
java.security.interfaces.RSAPublicKey
;
import
java.security.spec.ECParameterSpec
;
import
java.security.cert.X509Certificate
;
...
...
@@ -147,8 +148,33 @@ final class ClientHandshaker extends Handshaker {
case
HandshakeMessage
.
ht_server_key_exchange
:
serverKeyExchangeReceived
=
true
;
switch
(
keyExchange
)
{
case
K_RSA:
case
K_RSA_EXPORT:
/**
* The server key exchange message is sent by the server only
* when the server certificate message does not contain the
* proper amount of data to allow the client to exchange a
* premaster secret, such as when RSA_EXPORT is used and the
* public key in the server certificate is longer than 512 bits.
*/
if
(
serverKey
==
null
)
{
throw
new
SSLProtocolException
(
"Server did not send certificate message"
);
}
if
(!(
serverKey
instanceof
RSAPublicKey
))
{
throw
new
SSLProtocolException
(
"Protocol violation:"
+
" the certificate type must be appropriate for the"
+
" selected cipher suite's key exchange algorithm"
);
}
if
(
JsseJce
.
getRSAKeyLength
(
serverKey
)
<=
512
)
{
throw
new
SSLProtocolException
(
"Protocol violation:"
+
" server sent a server key exchange message for"
+
" key exchange "
+
keyExchange
+
" when the public key in the server certificate"
+
" is less than or equal to 512 bits in length"
);
}
try
{
this
.
serverKeyExchange
(
new
RSA_ServerKeyExchange
(
input
));
}
catch
(
GeneralSecurityException
e
)
{
...
...
@@ -180,6 +206,9 @@ final class ClientHandshaker extends Handshaker {
throwSSLException
(
"Server key"
,
e
);
}
break
;
case
K_RSA:
case
K_DH_RSA:
case
K_DH_DSS:
case
K_ECDH_ECDSA:
case
K_ECDH_RSA:
throw
new
SSLProtocolException
(
"Protocol violation: server sent"
...
...
@@ -580,6 +609,16 @@ final class ClientHandshaker extends Handshaker {
case
K_RSA:
case
K_RSA_EXPORT:
if
(
serverKey
==
null
)
{
throw
new
SSLProtocolException
(
"Server did not send certificate message"
);
}
if
(!(
serverKey
instanceof
RSAPublicKey
))
{
throw
new
SSLProtocolException
(
"Server certificate does not include an RSA key"
);
}
/*
* For RSA key exchange, we randomly generate a new
* pre-master secret and encrypt it with the server's
...
...
@@ -588,8 +627,29 @@ final class ClientHandshaker extends Handshaker {
* it's a performance speedup not to do that until
* the client's waiting for the server response, but
* more of a speedup for the D-H case.
*
* If the RSA_EXPORT scheme is active, when the public
* key in the server certificate is less than or equal
* to 512 bits in length, use the cert's public key,
* otherwise, the ephemeral one.
*/
PublicKey
key
=
(
keyExchange
==
K_RSA
)
?
serverKey
:
ephemeralServerKey
;
PublicKey
key
;
if
(
keyExchange
==
K_RSA
)
{
key
=
serverKey
;
}
else
{
// K_RSA_EXPORT
if
(
JsseJce
.
getRSAKeyLength
(
serverKey
)
<=
512
)
{
// extraneous ephemeralServerKey check done
// above in processMessage()
key
=
serverKey
;
}
else
{
if
(
ephemeralServerKey
==
null
)
{
throw
new
SSLProtocolException
(
"Server did not send"
+
" a RSA_EXPORT Server Key Exchange message"
);
}
key
=
ephemeralServerKey
;
}
}
m2
=
new
RSAClientKeyExchange
(
protocolVersion
,
maxProtocolVersion
,
sslContext
.
getSecureRandom
(),
key
);
break
;
...
...
test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/RSAExport.java
0 → 100644
浏览文件 @
4c8b5981
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录