Most visited

Recently visited

Added in API level 1

KeyStore.PasswordProtection

public static class KeyStore.PasswordProtection
extends Object implements KeyStore.ProtectionParameter, Destroyable

java.lang.Object
   ↳ java.security.KeyStore.PasswordProtection


A password-based implementation of ProtectionParameter.

Summary

Public constructors

KeyStore.PasswordProtection(char[] password)

Creates a password parameter.

Public methods

void destroy()

Clears the password.

char[] getPassword()

Gets the password.

boolean isDestroyed()

Determines if password has been cleared.

Inherited methods

From class java.lang.Object
From interface javax.security.auth.Destroyable

Public constructors

KeyStore.PasswordProtection

Added in API level 1
KeyStore.PasswordProtection (char[] password)

Creates a password parameter.

The specified password is cloned before it is stored in the new PasswordProtection object.

Parameters
password char: the password, which may be null

Public methods

destroy

Added in API level 1
void destroy ()

Clears the password.

Throws
if this method was unable to clear the password
DestroyFailedException

getPassword

Added in API level 1
char[] getPassword ()

Gets the password.

Note that this method returns a reference to the password. If a clone of the array is created it is the caller's responsibility to zero out the password information after it is no longer needed.

Returns
char[] the password, which may be null
Throws
IllegalStateException if the password has been cleared (destroyed)

See also:

isDestroyed

Added in API level 1
boolean isDestroyed ()

Determines if password has been cleared.

Returns
boolean true if the password has been cleared, false otherwise

Hooray!