Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
6774b980
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看板
提交
6774b980
编写于
11月 29, 2017
作者:
I
igerasim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8150530: Improve javax.crypto.BadPaddingException messages
Reviewed-by: xuelei
上级
8954331d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
27 addition
and
11 deletion
+27
-11
src/share/classes/com/sun/crypto/provider/CipherCore.java
src/share/classes/com/sun/crypto/provider/CipherCore.java
+3
-2
src/share/classes/sun/security/pkcs11/P11RSACipher.java
src/share/classes/sun/security/pkcs11/P11RSACipher.java
+3
-1
src/share/classes/sun/security/rsa/RSAPadding.java
src/share/classes/sun/security/rsa/RSAPadding.java
+5
-2
src/share/classes/sun/security/ssl/CipherBox.java
src/share/classes/sun/security/ssl/CipherBox.java
+16
-6
未找到文件。
src/share/classes/com/sun/crypto/provider/CipherCore.java
浏览文件 @
6774b980
...
...
@@ -988,8 +988,9 @@ final class CipherCore {
if
(
padding
!=
null
)
{
int
padStart
=
padding
.
unpad
(
outWithPadding
,
0
,
outLen
);
if
(
padStart
<
0
)
{
throw
new
BadPaddingException
(
"Given final block not "
+
"properly padded"
);
throw
new
BadPaddingException
(
"Given final block not "
+
"properly padded. Such issues can arise if a bad key "
+
"is used during decryption."
);
}
outLen
=
padStart
;
}
...
...
src/share/classes/sun/security/pkcs11/P11RSACipher.java
浏览文件 @
6774b980
...
...
@@ -357,7 +357,9 @@ final class P11RSACipher extends CipherSpi {
System
.
arraycopy
(
buffer
,
0
,
tmpBuffer
,
0
,
bufOfs
);
tmpBuffer
=
p11
.
C_Sign
(
session
.
id
(),
tmpBuffer
);
if
(
tmpBuffer
.
length
>
outLen
)
{
throw
new
BadPaddingException
(
"Output buffer too small"
);
throw
new
BadPaddingException
(
"Output buffer ("
+
outLen
+
") is too small to "
+
"hold the produced data ("
+
tmpBuffer
.
length
+
")"
);
}
System
.
arraycopy
(
tmpBuffer
,
0
,
out
,
outOfs
,
tmpBuffer
.
length
);
n
=
tmpBuffer
.
length
;
...
...
src/share/classes/sun/security/rsa/RSAPadding.java
浏览文件 @
6774b980
...
...
@@ -253,7 +253,8 @@ public final class RSAPadding {
public
byte
[]
pad
(
byte
[]
data
)
throws
BadPaddingException
{
if
(
data
.
length
>
maxDataSize
)
{
throw
new
BadPaddingException
(
"Data must be shorter than "
+
(
maxDataSize
+
1
)
+
" bytes"
);
+
(
maxDataSize
+
1
)
+
" bytes but received "
+
data
.
length
+
" bytes."
);
}
switch
(
type
)
{
case
PAD_NONE:
...
...
@@ -281,7 +282,9 @@ public final class RSAPadding {
*/
public
byte
[]
unpad
(
byte
[]
padded
)
throws
BadPaddingException
{
if
(
padded
.
length
!=
paddedSize
)
{
throw
new
BadPaddingException
(
"Decryption error"
);
throw
new
BadPaddingException
(
"Decryption error."
+
"The padded array length ("
+
padded
.
length
+
") is not the specified padded size ("
+
paddedSize
+
")"
);
}
switch
(
type
)
{
case
PAD_NONE:
...
...
src/share/classes/sun/security/ssl/CipherBox.java
浏览文件 @
6774b980
...
...
@@ -493,7 +493,9 @@ final class CipherBox {
if
(
protocolVersion
.
v
>=
ProtocolVersion
.
TLS11
.
v
)
{
if
(
newLen
<
blockSize
)
{
throw
new
BadPaddingException
(
"invalid explicit IV"
);
throw
new
BadPaddingException
(
"The length after "
+
"padding removal ("
+
newLen
+
") should be larger "
+
"than <"
+
blockSize
+
"> since explicit IV used"
);
}
}
}
...
...
@@ -504,7 +506,6 @@ final class CipherBox {
}
}
/*
* Decrypts a block of data, returning the size of the
* resulting block if padding was required. position and limit
...
...
@@ -575,7 +576,9 @@ final class CipherBox {
// check the explicit IV of TLS v1.1 or later
if
(
protocolVersion
.
v
>=
ProtocolVersion
.
TLS11
.
v
)
{
if
(
newLen
<
blockSize
)
{
throw
new
BadPaddingException
(
"invalid explicit IV"
);
throw
new
BadPaddingException
(
"The length after "
+
"padding removal ("
+
newLen
+
") should be larger "
+
"than <"
+
blockSize
+
"> since explicit IV used"
);
}
// reset the position to the end of the decrypted data
...
...
@@ -756,7 +759,9 @@ final class CipherBox {
// so accept that as well
// v3 does not require any particular value for the other bytes
if
(
padLen
>
blockSize
)
{
throw
new
BadPaddingException
(
"Invalid SSLv3 padding"
);
throw
new
BadPaddingException
(
"Padding length ("
+
padLen
+
") of SSLv3 message should not be bigger "
+
"than the block size ("
+
blockSize
+
")"
);
}
}
return
newLen
;
...
...
@@ -802,7 +807,9 @@ final class CipherBox {
// so accept that as well
// v3 does not require any particular value for the other bytes
if
(
padLen
>
blockSize
)
{
throw
new
BadPaddingException
(
"Invalid SSLv3 padding"
);
throw
new
BadPaddingException
(
"Padding length ("
+
padLen
+
") of SSLv3 message should not be bigger "
+
"than the block size ("
+
blockSize
+
")"
);
}
}
...
...
@@ -925,7 +932,10 @@ final class CipherBox {
case
AEAD_CIPHER:
if
(
bb
.
remaining
()
<
(
recordIvSize
+
tagSize
))
{
throw
new
BadPaddingException
(
"invalid AEAD cipher fragment"
);
"Insufficient buffer remaining for AEAD cipher "
+
"fragment ("
+
bb
.
remaining
()
+
"). Needs to be "
+
"more than or equal to IV size ("
+
recordIvSize
+
") + tag size ("
+
tagSize
+
")"
);
}
// initialize the AEAD cipher for the unique IV
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录