Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
9097f16a
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
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,体验更适合开发者的 AI 搜索 >>
提交
9097f16a
编写于
2月 27, 2018
作者:
A
asaha
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
73ae96a1
2465a4a3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
20 deletion
+14
-20
.hgtags
.hgtags
+1
-0
src/share/classes/sun/security/provider/DSAParameterGenerator.java
.../classes/sun/security/provider/DSAParameterGenerator.java
+13
-20
未找到文件。
.hgtags
浏览文件 @
9097f16a
...
...
@@ -865,6 +865,7 @@ ac700f67341a20ddae093c319da1c65e41edcacd jdk8u171-b04
863ef3413aa42c15fbdc14fef6732f2741f97046 jdk8u171-b05
6cbe2e5989a85f82833191be05ccb531f685d171 jdk8u171-b06
9cf14f22734a057adceff1764b4bb6c71329088b jdk8u171-b07
9a59252d179a2a488e094cd28b58d86edbf454a0 jdk8u171-b08
64df143be721d3ef031d765d86277c1e114d627a jdk8u172-b00
25f7b0cd25cf13106783050fc8e6f4a78487a7bd jdk8u172-b01
db8272cb8c99eea536a66c4c368c4bf2bf013a81 jdk8u172-b02
...
...
src/share/classes/sun/security/provider/DSAParameterGenerator.java
浏览文件 @
9097f16a
...
...
@@ -68,7 +68,6 @@ public class DSAParameterGenerator extends AlgorithmParameterGeneratorSpi {
private
SecureRandom
random
;
// useful constants
private
static
final
BigInteger
ONE
=
BigInteger
.
valueOf
(
1
);
private
static
final
BigInteger
TWO
=
BigInteger
.
valueOf
(
2
);
public
DSAParameterGenerator
()
{
...
...
@@ -83,16 +82,11 @@ public class DSAParameterGenerator extends AlgorithmParameterGeneratorSpi {
*/
@Override
protected
void
engineInit
(
int
strength
,
SecureRandom
random
)
{
if
((
strength
>=
512
)
&&
(
strength
<=
1024
)
&&
(
strength
%
64
==
0
))
{
this
.
valueN
=
160
;
}
else
if
(
strength
==
2048
)
{
this
.
valueN
=
224
;
}
else
if
(
strength
==
3072
)
{
this
.
valueN
=
256
;
}
else
{
if
((
strength
!=
2048
)
&&
(
strength
!=
3072
)
&&
((
strength
<
512
)
||
(
strength
>
1024
)
||
(
strength
%
64
!=
0
)))
{
throw
new
InvalidParameterException
(
"Unexpected strength (size of prime): "
+
strength
+
". "
+
"
Prime size should be 512 - 1024, or 2048,
3072"
);
"Unexpected strength (size of prime): "
+
strength
+
"
. Prime size should be 512-1024, 2048, or
3072"
);
}
this
.
valueL
=
strength
;
this
.
valueN
=
getDefDSASubprimeSize
(
strength
);
...
...
@@ -205,7 +199,7 @@ public class DSAParameterGenerator extends AlgorithmParameterGeneratorSpi {
int
b
=
(
valueL
-
1
)
%
outLen
;
byte
[]
seedBytes
=
new
byte
[
seedLen
/
8
];
BigInteger
twoSl
=
TWO
.
pow
(
seedLen
);
int
primeCertainty
=
80
;
// for 1024-bit prime P
int
primeCertainty
=
-
1
;
if
(
valueL
<=
1024
)
{
primeCertainty
=
80
;
}
else
if
(
valueL
==
2048
)
{
...
...
@@ -213,7 +207,6 @@ public class DSAParameterGenerator extends AlgorithmParameterGeneratorSpi {
}
else
if
(
valueL
==
3072
)
{
primeCertainty
=
128
;
}
if
(
primeCertainty
<
0
)
{
throw
new
ProviderException
(
"Invalid valueL: "
+
valueL
);
}
...
...
@@ -232,12 +225,12 @@ public class DSAParameterGenerator extends AlgorithmParameterGeneratorSpi {
/* Step 7 */
resultQ
=
TWO
.
pow
(
valueN
-
1
)
.
add
(
U
)
.
add
(
ONE
)
.
add
(
BigInteger
.
ONE
)
.
subtract
(
U
.
mod
(
TWO
));
}
while
(!
resultQ
.
isProbablePrime
(
primeCertainty
));
/* Step 10 */
BigInteger
offset
=
ONE
;
BigInteger
offset
=
BigInteger
.
ONE
;
/* Step 11 */
for
(
counter
=
0
;
counter
<
4
*
valueL
;
counter
++)
{
BigInteger
V
[]
=
new
BigInteger
[
n
+
1
];
...
...
@@ -260,7 +253,7 @@ public class DSAParameterGenerator extends AlgorithmParameterGeneratorSpi {
BigInteger
X
=
W
.
add
(
twoLm1
);
/* Step 11.4, 11.5 */
BigInteger
c
=
X
.
mod
(
resultQ
.
multiply
(
TWO
));
resultP
=
X
.
subtract
(
c
.
subtract
(
ONE
));
resultP
=
X
.
subtract
(
c
.
subtract
(
BigInteger
.
ONE
));
/* Step 11.6, 11.7 */
if
(
resultP
.
compareTo
(
twoLm1
)
>
-
1
&&
resultP
.
isProbablePrime
(
primeCertainty
))
{
...
...
@@ -270,7 +263,7 @@ public class DSAParameterGenerator extends AlgorithmParameterGeneratorSpi {
return
result
;
}
/* Step 11.9 */
offset
=
offset
.
add
(
BigInteger
.
valueOf
(
n
)).
add
(
ONE
);
offset
=
offset
.
add
(
BigInteger
.
valueOf
(
n
)).
add
(
BigInteger
.
ONE
);
}
}
...
...
@@ -285,14 +278,14 @@ public class DSAParameterGenerator extends AlgorithmParameterGeneratorSpi {
* @param the <code>g</code>
*/
private
static
BigInteger
generateG
(
BigInteger
p
,
BigInteger
q
)
{
BigInteger
h
=
ONE
;
BigInteger
h
=
BigInteger
.
ONE
;
/* Step 1 */
BigInteger
pMinusOneOverQ
=
(
p
.
subtract
(
ONE
)).
divide
(
q
);
BigInteger
resultG
=
ONE
;
BigInteger
pMinusOneOverQ
=
(
p
.
subtract
(
BigInteger
.
ONE
)).
divide
(
q
);
BigInteger
resultG
=
BigInteger
.
ONE
;
while
(
resultG
.
compareTo
(
TWO
)
<
0
)
{
/* Step 3 */
resultG
=
h
.
modPow
(
pMinusOneOverQ
,
p
);
h
=
h
.
add
(
ONE
);
h
=
h
.
add
(
BigInteger
.
ONE
);
}
return
resultG
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录