Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f0301d69
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看板
提交
f0301d69
编写于
1月 30, 2018
作者:
I
igerasim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8193409: Improve AES supporting classes
Reviewed-by: valeriep
上级
3bed2a14
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
8 deletion
+31
-8
src/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java
...are/classes/com/sun/crypto/provider/DESedeWrapCipher.java
+16
-2
src/share/classes/com/sun/crypto/provider/FeedbackCipher.java
...share/classes/com/sun/crypto/provider/FeedbackCipher.java
+4
-2
src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java
...re/classes/com/sun/crypto/provider/GaloisCounterMode.java
+11
-4
未找到文件。
src/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java
浏览文件 @
f0301d69
...
...
@@ -473,6 +473,9 @@ public final class DESedeWrapCipher extends CipherSpi {
}
catch
(
InvalidKeyException
ike
)
{
// should never happen
throw
new
RuntimeException
(
"Internal cipher key is corrupted"
);
}
catch
(
InvalidAlgorithmParameterException
iape
)
{
// should never happen
throw
new
RuntimeException
(
"Internal cipher IV is invalid"
);
}
byte
[]
out2
=
new
byte
[
out
.
length
];
cipher
.
encrypt
(
out
,
0
,
out
.
length
,
out2
,
0
);
...
...
@@ -484,6 +487,9 @@ public final class DESedeWrapCipher extends CipherSpi {
}
catch
(
InvalidKeyException
ike
)
{
// should never happen
throw
new
RuntimeException
(
"Internal cipher key is corrupted"
);
}
catch
(
InvalidAlgorithmParameterException
iape
)
{
// should never happen
throw
new
RuntimeException
(
"Internal cipher IV is invalid"
);
}
return
out2
;
}
...
...
@@ -527,8 +533,12 @@ public final class DESedeWrapCipher extends CipherSpi {
}
iv
=
new
byte
[
IV_LEN
];
System
.
arraycopy
(
buffer
,
0
,
iv
,
0
,
iv
.
length
);
cipher
.
init
(
true
,
cipherKey
.
getAlgorithm
(),
cipherKey
.
getEncoded
(),
try
{
cipher
.
init
(
true
,
cipherKey
.
getAlgorithm
(),
cipherKey
.
getEncoded
(),
iv
);
}
catch
(
InvalidAlgorithmParameterException
iape
)
{
throw
new
InvalidKeyException
(
"IV in wrapped key is invalid"
);
}
byte
[]
buffer2
=
new
byte
[
buffer
.
length
-
iv
.
length
];
cipher
.
decrypt
(
buffer
,
iv
.
length
,
buffer2
.
length
,
buffer2
,
0
);
...
...
@@ -541,8 +551,12 @@ public final class DESedeWrapCipher extends CipherSpi {
}
}
// restore cipher state to prior to this call
cipher
.
init
(
decrypting
,
cipherKey
.
getAlgorithm
(),
try
{
cipher
.
init
(
decrypting
,
cipherKey
.
getAlgorithm
(),
cipherKey
.
getEncoded
(),
IV2
);
}
catch
(
InvalidAlgorithmParameterException
iape
)
{
throw
new
InvalidKeyException
(
"IV in wrapped key is invalid"
);
}
byte
[]
out
=
new
byte
[
keyValLen
];
System
.
arraycopy
(
buffer2
,
0
,
out
,
0
,
keyValLen
);
return
ConstructKeys
.
constructKey
(
out
,
wrappedKeyAlgorithm
,
...
...
src/share/classes/com/sun/crypto/provider/FeedbackCipher.java
浏览文件 @
f0301d69
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
7
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -26,6 +26,7 @@
package
com.sun.crypto.provider
;
import
java.security.InvalidKeyException
;
import
java.security.InvalidAlgorithmParameterException
;
import
javax.crypto.*
;
/**
...
...
@@ -99,7 +100,8 @@ abstract class FeedbackCipher {
* initializing this cipher
*/
abstract
void
init
(
boolean
decrypting
,
String
algorithm
,
byte
[]
key
,
byte
[]
iv
)
throws
InvalidKeyException
;
byte
[]
iv
)
throws
InvalidKeyException
,
InvalidAlgorithmParameterException
;
/**
* Gets the initialization vector.
...
...
src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java
浏览文件 @
f0301d69
/*
* Copyright (c) 2013, 201
6
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 201
7
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -262,8 +262,9 @@ final class GaloisCounterMode extends FeedbackCipher {
* @exception InvalidKeyException if the given key is inappropriate for
* initializing this cipher
*/
@Override
void
init
(
boolean
decrypting
,
String
algorithm
,
byte
[]
key
,
byte
[]
iv
)
throws
InvalidKeyException
{
throws
InvalidKeyException
,
InvalidAlgorithmParameterException
{
init
(
decrypting
,
algorithm
,
key
,
iv
,
DEFAULT_TAG_LEN
);
}
...
...
@@ -282,10 +283,16 @@ final class GaloisCounterMode extends FeedbackCipher {
*/
void
init
(
boolean
decrypting
,
String
algorithm
,
byte
[]
keyValue
,
byte
[]
ivValue
,
int
tagLenBytes
)
throws
InvalidKeyException
{
if
(
keyValue
==
null
||
ivValue
==
null
)
{
throws
InvalidKeyException
,
InvalidAlgorithmParameterException
{
if
(
keyValue
==
null
)
{
throw
new
InvalidKeyException
(
"Internal error"
);
}
if
(
ivValue
==
null
)
{
throw
new
InvalidAlgorithmParameterException
(
"Internal error"
);
}
if
(
ivValue
.
length
==
0
)
{
throw
new
InvalidAlgorithmParameterException
(
"IV is empty"
);
}
// always encrypt mode for embedded cipher
this
.
embeddedCipher
.
init
(
false
,
algorithm
,
keyValue
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录