Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
5bd8dd0e
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,发现更多精彩内容 >>
提交
5bd8dd0e
编写于
9月 29, 2014
作者:
V
vinnie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8056026: Debug security logging should print Provider used for each crypto operation
Reviewed-by: mullan
上级
c08f212f
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
190 addition
and
15 deletion
+190
-15
src/share/classes/java/security/KeyPairGenerator.java
src/share/classes/java/security/KeyPairGenerator.java
+18
-1
src/share/classes/java/security/KeyStore.java
src/share/classes/java/security/KeyStore.java
+12
-0
src/share/classes/java/security/MessageDigest.java
src/share/classes/java/security/MessageDigest.java
+19
-7
src/share/classes/java/security/SecureRandom.java
src/share/classes/java/security/SecureRandom.java
+11
-0
src/share/classes/java/security/Signature.java
src/share/classes/java/security/Signature.java
+26
-1
src/share/classes/javax/crypto/Cipher.java
src/share/classes/javax/crypto/Cipher.java
+45
-1
src/share/classes/javax/crypto/KeyAgreement.java
src/share/classes/javax/crypto/KeyAgreement.java
+16
-1
src/share/classes/javax/crypto/KeyGenerator.java
src/share/classes/javax/crypto/KeyGenerator.java
+17
-1
src/share/classes/javax/crypto/Mac.java
src/share/classes/javax/crypto/Mac.java
+16
-1
src/share/classes/sun/security/util/Debug.java
src/share/classes/sun/security/util/Debug.java
+10
-2
未找到文件。
src/share/classes/java/security/KeyPairGenerator.java
浏览文件 @
5bd8dd0e
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
4
, 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
...
...
@@ -33,6 +33,7 @@ import java.security.Provider.Service;
import
sun.security.jca.*
;
import
sun.security.jca.GetInstance.Instance
;
import
sun.security.util.Debug
;
/**
* The KeyPairGenerator class is used to generate pairs of
...
...
@@ -126,6 +127,11 @@ import sun.security.jca.GetInstance.Instance;
public
abstract
class
KeyPairGenerator
extends
KeyPairGeneratorSpi
{
private
static
final
Debug
pdebug
=
Debug
.
getInstance
(
"provider"
,
"Provider"
);
private
static
final
boolean
skipDebug
=
Debug
.
isOn
(
"engine="
)
&&
!
Debug
.
isOn
(
"keypairgenerator"
);
private
final
String
algorithm
;
// The provider
...
...
@@ -167,6 +173,12 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
kpg
=
new
Delegate
(
spi
,
algorithm
);
}
kpg
.
provider
=
instance
.
provider
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"KeyPairGenerator."
+
algorithm
+
" algorithm from: "
+
kpg
.
provider
.
getName
());
}
return
kpg
;
}
...
...
@@ -557,6 +569,11 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
provider
=
instance
.
provider
;
this
.
serviceIterator
=
serviceIterator
;
initType
=
I_NONE
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"KeyPairGenerator."
+
algorithm
+
" algorithm from: "
+
provider
.
getName
());
}
}
/**
...
...
src/share/classes/java/security/KeyStore.java
浏览文件 @
5bd8dd0e
...
...
@@ -37,6 +37,8 @@ import javax.crypto.SecretKey;
import
javax.security.auth.DestroyFailedException
;
import
javax.security.auth.callback.*
;
import
sun.security.util.Debug
;
/**
* This class represents a storage facility for cryptographic
* keys and certificates.
...
...
@@ -177,6 +179,11 @@ import javax.security.auth.callback.*;
public
class
KeyStore
{
private
static
final
Debug
pdebug
=
Debug
.
getInstance
(
"provider"
,
"Provider"
);
private
static
final
boolean
skipDebug
=
Debug
.
isOn
(
"engine="
)
&&
!
Debug
.
isOn
(
"keystore"
);
/*
* Constant to lookup in the Security properties file to determine
* the default keystore type.
...
...
@@ -801,6 +808,11 @@ public class KeyStore {
this
.
keyStoreSpi
=
keyStoreSpi
;
this
.
provider
=
provider
;
this
.
type
=
type
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"KeyStore."
+
type
.
toUpperCase
()
+
" type from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
src/share/classes/java/security/MessageDigest.java
浏览文件 @
5bd8dd0e
...
...
@@ -35,6 +35,8 @@ import java.io.ByteArrayInputStream;
import
java.nio.ByteBuffer
;
import
sun.security.util.Debug
;
/**
* This MessageDigest class provides applications the functionality of a
* message digest algorithm, such as SHA-1 or SHA-256.
...
...
@@ -103,6 +105,11 @@ import java.nio.ByteBuffer;
public
abstract
class
MessageDigest
extends
MessageDigestSpi
{
private
static
final
Debug
pdebug
=
Debug
.
getInstance
(
"provider"
,
"Provider"
);
private
static
final
boolean
skipDebug
=
Debug
.
isOn
(
"engine="
)
&&
!
Debug
.
isOn
(
"messagedigest"
);
private
String
algorithm
;
// The state of this digest
...
...
@@ -156,18 +163,23 @@ public abstract class MessageDigest extends MessageDigestSpi {
public
static
MessageDigest
getInstance
(
String
algorithm
)
throws
NoSuchAlgorithmException
{
try
{
MessageDigest
md
;
Object
[]
objs
=
Security
.
getImpl
(
algorithm
,
"MessageDigest"
,
(
String
)
null
);
if
(
objs
[
0
]
instanceof
MessageDigest
)
{
MessageDigest
md
=
(
MessageDigest
)
objs
[
0
];
md
.
provider
=
(
Provider
)
objs
[
1
];
return
md
;
md
=
(
MessageDigest
)
objs
[
0
];
}
else
{
MessageDigest
delegate
=
new
Delegate
((
MessageDigestSpi
)
objs
[
0
],
algorithm
);
delegate
.
provider
=
(
Provider
)
objs
[
1
];
return
delegate
;
md
=
new
Delegate
((
MessageDigestSpi
)
objs
[
0
],
algorithm
);
}
md
.
provider
=
(
Provider
)
objs
[
1
];
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"MessageDigest."
+
algorithm
+
" algorithm from: "
+
md
.
provider
.
getName
());
}
return
md
;
}
catch
(
NoSuchProviderException
e
)
{
throw
new
NoSuchAlgorithmException
(
algorithm
+
" not found"
);
}
...
...
src/share/classes/java/security/SecureRandom.java
浏览文件 @
5bd8dd0e
...
...
@@ -32,6 +32,7 @@ import java.security.Provider.Service;
import
sun.security.jca.*
;
import
sun.security.jca.GetInstance.Instance
;
import
sun.security.util.Debug
;
/**
* This class provides a cryptographically strong random number
...
...
@@ -92,6 +93,11 @@ import sun.security.jca.GetInstance.Instance;
public
class
SecureRandom
extends
java
.
util
.
Random
{
private
static
final
Debug
pdebug
=
Debug
.
getInstance
(
"provider"
,
"Provider"
);
private
static
final
boolean
skipDebug
=
Debug
.
isOn
(
"engine="
)
&&
!
Debug
.
isOn
(
"securerandom"
);
/**
* The provider.
*
...
...
@@ -234,6 +240,11 @@ public class SecureRandom extends java.util.Random {
this
.
secureRandomSpi
=
secureRandomSpi
;
this
.
provider
=
provider
;
this
.
algorithm
=
algorithm
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"SecureRandom."
+
algorithm
+
" algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
src/share/classes/java/security/Signature.java
浏览文件 @
5bd8dd0e
/*
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
4
, 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
...
...
@@ -121,6 +121,11 @@ public abstract class Signature extends SignatureSpi {
private
static
final
Debug
debug
=
Debug
.
getInstance
(
"jca"
,
"Signature"
);
private
static
final
Debug
pdebug
=
Debug
.
getInstance
(
"provider"
,
"Provider"
);
private
static
final
boolean
skipDebug
=
Debug
.
isOn
(
"engine="
)
&&
!
Debug
.
isOn
(
"signature"
);
/*
* The algorithm for this signature object.
* This value is used to map an OID to the particular algorithm.
...
...
@@ -451,6 +456,11 @@ public abstract class Signature extends SignatureSpi {
throws
InvalidKeyException
{
engineInitVerify
(
publicKey
);
state
=
VERIFY
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"Signature."
+
algorithm
+
" verification algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
@@ -495,6 +505,11 @@ public abstract class Signature extends SignatureSpi {
PublicKey
publicKey
=
certificate
.
getPublicKey
();
engineInitVerify
(
publicKey
);
state
=
VERIFY
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"Signature."
+
algorithm
+
" verification algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
@@ -511,6 +526,11 @@ public abstract class Signature extends SignatureSpi {
throws
InvalidKeyException
{
engineInitSign
(
privateKey
);
state
=
SIGN
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"Signature."
+
algorithm
+
" signing algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
@@ -529,6 +549,11 @@ public abstract class Signature extends SignatureSpi {
throws
InvalidKeyException
{
engineInitSign
(
privateKey
,
random
);
state
=
SIGN
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"Signature."
+
algorithm
+
" signing algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
src/share/classes/javax/crypto/Cipher.java
浏览文件 @
5bd8dd0e
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
4
, 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
...
...
@@ -167,6 +167,11 @@ public class Cipher {
private
static
final
Debug
debug
=
Debug
.
getInstance
(
"jca"
,
"Cipher"
);
private
static
final
Debug
pdebug
=
Debug
.
getInstance
(
"provider"
,
"Provider"
);
private
static
final
boolean
skipDebug
=
Debug
.
isOn
(
"engine="
)
&&
!
Debug
.
isOn
(
"cipher"
);
/**
* Constant used to initialize cipher to encryption mode.
*/
...
...
@@ -1110,6 +1115,21 @@ public class Cipher {
}
}
private
static
String
getOpmodeString
(
int
opmode
)
{
switch
(
opmode
)
{
case
ENCRYPT_MODE:
return
"encryption"
;
case
DECRYPT_MODE:
return
"decryption"
;
case
WRAP_MODE:
return
"key wrapping"
;
case
UNWRAP_MODE:
return
"key unwrapping"
;
default
:
return
""
;
}
}
/**
* Initializes this cipher with a key.
*
...
...
@@ -1235,6 +1255,12 @@ public class Cipher {
initialized
=
true
;
this
.
opmode
=
opmode
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"Cipher."
+
transformation
+
" "
+
getOpmodeString
(
opmode
)
+
" algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
@@ -1372,6 +1398,12 @@ public class Cipher {
initialized
=
true
;
this
.
opmode
=
opmode
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"Cipher."
+
transformation
+
" "
+
getOpmodeString
(
opmode
)
+
" algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
@@ -1509,6 +1541,12 @@ public class Cipher {
initialized
=
true
;
this
.
opmode
=
opmode
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"Cipher."
+
transformation
+
" "
+
getOpmodeString
(
opmode
)
+
" algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
@@ -1693,6 +1731,12 @@ public class Cipher {
initialized
=
true
;
this
.
opmode
=
opmode
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"Cipher."
+
transformation
+
" "
+
getOpmodeString
(
opmode
)
+
" algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
src/share/classes/javax/crypto/KeyAgreement.java
浏览文件 @
5bd8dd0e
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
4
, 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
...
...
@@ -78,6 +78,11 @@ public class KeyAgreement {
private
static
final
Debug
debug
=
Debug
.
getInstance
(
"jca"
,
"KeyAgreement"
);
private
static
final
Debug
pdebug
=
Debug
.
getInstance
(
"provider"
,
"Provider"
);
private
static
final
boolean
skipDebug
=
Debug
.
isOn
(
"engine="
)
&&
!
Debug
.
isOn
(
"keyagreement"
);
// The provider
private
Provider
provider
;
...
...
@@ -468,6 +473,11 @@ public class KeyAgreement {
throw
new
InvalidKeyException
(
e
);
}
}
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"KeyAgreement."
+
algorithm
+
" algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
@@ -524,6 +534,11 @@ public class KeyAgreement {
}
else
{
chooseProvider
(
I_PARAMS
,
key
,
params
,
random
);
}
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"KeyAgreement."
+
algorithm
+
" algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
src/share/classes/javax/crypto/KeyGenerator.java
浏览文件 @
5bd8dd0e
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
4
, 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
...
...
@@ -33,6 +33,7 @@ import java.security.spec.*;
import
sun.security.jca.*
;
import
sun.security.jca.GetInstance.Instance
;
import
sun.security.util.Debug
;
/**
* This class provides the functionality of a secret (symmetric) key generator.
...
...
@@ -108,6 +109,11 @@ import sun.security.jca.GetInstance.Instance;
public
class
KeyGenerator
{
private
static
final
Debug
pdebug
=
Debug
.
getInstance
(
"provider"
,
"Provider"
);
private
static
final
boolean
skipDebug
=
Debug
.
isOn
(
"engine="
)
&&
!
Debug
.
isOn
(
"keygenerator"
);
// see java.security.KeyPairGenerator for failover notes
private
final
static
int
I_NONE
=
1
;
...
...
@@ -145,6 +151,11 @@ public class KeyGenerator {
this
.
spi
=
keyGenSpi
;
this
.
provider
=
provider
;
this
.
algorithm
=
algorithm
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"KeyGenerator."
+
algorithm
+
" algorithm from: "
+
this
.
provider
.
getName
());
}
}
private
KeyGenerator
(
String
algorithm
)
throws
NoSuchAlgorithmException
{
...
...
@@ -158,6 +169,11 @@ public class KeyGenerator {
throw
new
NoSuchAlgorithmException
(
algorithm
+
" KeyGenerator not available"
);
}
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"KeyGenerator."
+
algorithm
+
" algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
src/share/classes/javax/crypto/Mac.java
浏览文件 @
5bd8dd0e
/*
* Copyright (c) 1998, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 201
4
, 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
...
...
@@ -77,6 +77,11 @@ public class Mac implements Cloneable {
private
static
final
Debug
debug
=
Debug
.
getInstance
(
"jca"
,
"Mac"
);
private
static
final
Debug
pdebug
=
Debug
.
getInstance
(
"provider"
,
"Provider"
);
private
static
final
boolean
skipDebug
=
Debug
.
isOn
(
"engine="
)
&&
!
Debug
.
isOn
(
"mac"
);
// The provider
private
Provider
provider
;
...
...
@@ -413,6 +418,11 @@ public class Mac implements Cloneable {
throw
new
InvalidKeyException
(
"init() failed"
,
e
);
}
initialized
=
true
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"Mac."
+
algorithm
+
" algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
@@ -435,6 +445,11 @@ public class Mac implements Cloneable {
chooseProvider
(
key
,
params
);
}
initialized
=
true
;
if
(!
skipDebug
&&
pdebug
!=
null
)
{
pdebug
.
println
(
"Mac."
+
algorithm
+
" algorithm from: "
+
this
.
provider
.
getName
());
}
}
/**
...
...
src/share/classes/sun/security/util/Debug.java
浏览文件 @
5bd8dd0e
/*
* Copyright (c) 1998, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 201
4
, 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
...
...
@@ -104,7 +104,15 @@ public class Debug {
System
.
err
.
println
(
"codebase=<URL>"
);
System
.
err
.
println
(
" only dump output if specified codebase"
);
System
.
err
.
println
(
" is being checked"
);
System
.
err
.
println
();
System
.
err
.
println
(
"The following can be used with provider:"
);
System
.
err
.
println
();
System
.
err
.
println
(
"engine=<engines>"
);
System
.
err
.
println
(
" only dump output for the specified list"
);
System
.
err
.
println
(
" of JCA engines. Supported values:"
);
System
.
err
.
println
(
" Cipher, KeyAgreement, KeyGenerator,"
);
System
.
err
.
println
(
" KeyPairGenerator, KeyStore, Mac,"
);
System
.
err
.
println
(
" MessageDigest, SecureRandom, Signature."
);
System
.
err
.
println
();
System
.
err
.
println
(
"Note: Separate multiple options with a comma"
);
System
.
exit
(
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录