Class PasswordSecret
java.lang.Object
jadex.ipc.impl.security.authentication.AbstractAuthenticationSecret
jadex.ipc.impl.security.authentication.SharedSecret
jadex.ipc.impl.security.authentication.PasswordSecret
- All Implemented Interfaces:
Cloneable
A secret password used for authentication.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Password length weakness threshold.protected String
The password.static final String
Prefix used to encode secret type as strings.Fields inherited from class jadex.ipc.impl.security.authentication.AbstractAuthenticationSecret
SECRET_TYPES
-
Constructor Summary
ConstructorsConstructorDescriptionCreates the secret.PasswordSecret
(String encodedpassword) Creates the secret.PasswordSecret
(String password, boolean encoded) Creates the secret. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
deriveKey
(int keysize, byte[] salt) Derives a key from the password with appropriate hardening.byte[]
deriveKey
(int keysize, byte[] salt, byte[] dfparams) Derives a key from the password with appropriate hardening.byte[]
Gets the key derivation parameters.Gets the password.boolean
isWeak()
Returns if the password is weak.void
setPassword
(String password) Sets the password.toString()
Creates encoded secret.Methods inherited from class jadex.ipc.impl.security.authentication.SharedSecret
canSign
Methods inherited from class jadex.ipc.impl.security.authentication.AbstractAuthenticationSecret
clone, equals, fromKeyPair, fromString, fromString, hashCode, main
-
Field Details
-
MIN_GOOD_PASSWORD_LENGTH
public static final int MIN_GOOD_PASSWORD_LENGTHPassword length weakness threshold.- See Also:
-
PREFIX
Prefix used to encode secret type as strings.- See Also:
-
password
The password.
-
-
Constructor Details
-
PasswordSecret
public PasswordSecret()Creates the secret. -
PasswordSecret
Creates the secret. -
PasswordSecret
Creates the secret.
-
-
Method Details
-
getPassword
Gets the password.- Returns:
- The password.
-
setPassword
Sets the password.- Parameters:
password
- The password.
-
getKdfParams
public byte[] getKdfParams()Gets the key derivation parameters.- Returns:
- Key derivation parameters.
-
deriveKey
public byte[] deriveKey(int keysize, byte[] salt) Derives a key from the password with appropriate hardening.- Specified by:
deriveKey
in classSharedSecret
- Parameters:
keysize
- The target key size in bytes to generate.salt
- Salt to use.- Returns:
- Derived key.
-
deriveKey
public byte[] deriveKey(int keysize, byte[] salt, byte[] dfparams) Derives a key from the password with appropriate hardening.- Parameters:
keysize
- The target key size in bytes to generate.salt
- Salt to use.dfparams
- Key derivation parameters.- Returns:
- Derived key.
-
isWeak
public boolean isWeak()Returns if the password is weak.- Returns:
- True, if weak.
-
toString
Creates encoded secret.
-