Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
64584636
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看板
提交
64584636
编写于
4月 21, 2016
作者:
A
alexp
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8143377: Test PKCS8Test.java fails
Reviewed-by: coffeys Contributed-by: artem.kosarev@oracle.com
上级
507b61bf
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
22 deletion
+15
-22
test/sun/security/pkcs/pkcs8/PKCS8Test.java
test/sun/security/pkcs/pkcs8/PKCS8Test.java
+15
-22
未找到文件。
test/sun/security/pkcs/pkcs8/PKCS8Test.java
浏览文件 @
64584636
...
@@ -25,9 +25,15 @@
...
@@ -25,9 +25,15 @@
* @test
* @test
* @bug 8048357
* @bug 8048357
* @summary PKCS8 Standards Conformance Tests
* @summary PKCS8 Standards Conformance Tests
* @requires (os.family != "solaris")
* @compile -XDignore.symbol.file PKCS8Test.java
* @compile -XDignore.symbol.file PKCS8Test.java
* @run main PKCS8Test
* @run main PKCS8Test
*/
*/
/*
* Skip Solaris since the DSAPrivateKeys returned by
* SunPKCS11 Provider are not subclasses of PKCS8Key
*/
import
java.io.IOException
;
import
java.io.IOException
;
import
java.math.BigInteger
;
import
java.math.BigInteger
;
import
java.security.InvalidKeyException
;
import
java.security.InvalidKeyException
;
...
@@ -38,7 +44,6 @@ import sun.security.provider.DSAPrivateKey;
...
@@ -38,7 +44,6 @@ import sun.security.provider.DSAPrivateKey;
import
sun.security.util.DerOutputStream
;
import
sun.security.util.DerOutputStream
;
import
sun.security.util.DerValue
;
import
sun.security.util.DerValue
;
import
sun.security.x509.AlgorithmId
;
import
sun.security.x509.AlgorithmId
;
import
static
java
.
lang
.
System
.
out
;
import
static
java
.
lang
.
System
.
out
;
public
class
PKCS8Test
{
public
class
PKCS8Test
{
...
@@ -186,7 +191,14 @@ public class PKCS8Test {
...
@@ -186,7 +191,14 @@ public class PKCS8Test {
public
static
void
main
(
String
[]
args
)
public
static
void
main
(
String
[]
args
)
throws
IOException
,
InvalidKeyException
{
throws
IOException
,
InvalidKeyException
{
byte
[]
encodedKey
=
getEncodedKey
();
BigInteger
p
=
BigInteger
.
valueOf
(
1
);
BigInteger
q
=
BigInteger
.
valueOf
(
2
);
BigInteger
g
=
BigInteger
.
valueOf
(
3
);
BigInteger
x
=
BigInteger
.
valueOf
(
4
);
DSAPrivateKey
priv
=
new
DSAPrivateKey
(
p
,
q
,
g
,
x
);
byte
[]
encodedKey
=
priv
.
getEncoded
();
byte
[]
expectedBytes
=
new
byte
[
EXPECTED
.
length
];
byte
[]
expectedBytes
=
new
byte
[
EXPECTED
.
length
];
for
(
int
i
=
0
;
i
<
EXPECTED
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
EXPECTED
.
length
;
i
++)
{
expectedBytes
[
i
]
=
(
byte
)
EXPECTED
[
i
];
expectedBytes
[
i
]
=
(
byte
)
EXPECTED
[
i
];
...
@@ -198,6 +210,7 @@ public class PKCS8Test {
...
@@ -198,6 +210,7 @@ public class PKCS8Test {
}
}
PKCS8Key
decodedKey
=
PKCS8Key
.
parse
(
new
DerValue
(
encodedKey
));
PKCS8Key
decodedKey
=
PKCS8Key
.
parse
(
new
DerValue
(
encodedKey
));
String
alg
=
decodedKey
.
getAlgorithm
();
String
alg
=
decodedKey
.
getAlgorithm
();
AlgorithmId
algId
=
decodedKey
.
getAlgorithmId
();
AlgorithmId
algId
=
decodedKey
.
getAlgorithmId
();
out
.
println
(
"Algorithm :"
+
alg
);
out
.
println
(
"Algorithm :"
+
alg
);
...
@@ -260,30 +273,10 @@ public class PKCS8Test {
...
@@ -260,30 +273,10 @@ public class PKCS8Test {
+
EXCEPTION_MESSAGE
+
" get: "
+
e
.
getMessage
());
+
EXCEPTION_MESSAGE
+
" get: "
+
e
.
getMessage
());
}
}
}
}
}
// get a byte array from somewhere
static
byte
[]
getEncodedKey
()
throws
InvalidKeyException
{
BigInteger
p
=
BigInteger
.
valueOf
(
1
);
BigInteger
q
=
BigInteger
.
valueOf
(
2
);
BigInteger
g
=
BigInteger
.
valueOf
(
3
);
BigInteger
x
=
BigInteger
.
valueOf
(
4
);
DSAPrivateKey
priv
=
new
DSAPrivateKey
(
p
,
q
,
g
,
x
);
return
priv
.
getEncoded
();
}
}
static
void
dumpByteArray
(
String
nm
,
byte
[]
bytes
)
throws
IOException
{
static
void
dumpByteArray
(
String
nm
,
byte
[]
bytes
)
throws
IOException
{
out
.
println
(
nm
+
" length: "
+
bytes
.
length
);
out
.
println
(
nm
+
" length: "
+
bytes
.
length
);
hexDump
.
encodeBuffer
(
bytes
,
out
);
hexDump
.
encodeBuffer
(
bytes
,
out
);
}
}
static
String
toString
(
PKCS8Key
key
)
{
StringBuilder
builder
=
new
StringBuilder
(
key
.
getAlgorithm
());
builder
.
append
(
'\n'
).
append
(
"parameters:"
)
.
append
(
key
.
getAlgorithmId
().
toString
());
return
builder
.
toString
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录