public static class KeyStore.PasswordProtection
extends Object implements KeyStore.ProtectionParameter, Destroyable
| java.lang.Object | |
| ↳ | java.security.KeyStore.PasswordProtection |
基于密码的实现 ProtectionParameter 。
Public constructors |
|
|---|---|
KeyStore.PasswordProtection(char[] password) 创建一个密码参数。 |
|
Public methods |
|
|---|---|
void |
destroy() 清除密码。 |
char[] |
getPassword() 获取密码。 |
boolean |
isDestroyed() 确定密码是否已被清除。 |
Inherited methods |
|
|---|---|
java.lang.Object
|
|
javax.security.auth.Destroyable
|
|
KeyStore.PasswordProtection (char[] password)
创建一个密码参数。
指定的 password在存储到新的 PasswordProtection对象中之前被克隆。
| Parameters | |
|---|---|
password |
char: the password, which may be null |
void destroy ()
清除密码。
| Throws | |
|---|---|
|
if this method was unable to clear the password |
DestroyFailedException |
|
char[] getPassword ()
获取密码。
请注意,此方法返回对密码的引用。 如果创建了一个数组的克隆,则调用者有责任在密码信息不再需要后将其清零。
| Returns | |
|---|---|
char[] |
the password, which may be null |
| Throws | |
|---|---|
IllegalStateException |
if the password has been cleared (destroyed) |
也可以看看:
boolean isDestroyed ()
确定密码是否已被清除。
| Returns | |
|---|---|
boolean |
true if the password has been cleared, false otherwise |