Package i5.las2peer.security
Class PassphraseAgentImpl
java.lang.Object
i5.las2peer.security.AgentImpl
i5.las2peer.security.PassphraseAgentImpl
- All Implemented Interfaces:
Agent,PassphraseAgent,MessageReceiver,XmlAble,java.lang.Cloneable
- Direct Known Subclasses:
MonitoringAgent,ServiceAgentImpl,UserAgentImpl
public abstract class PassphraseAgentImpl extends AgentImpl implements PassphraseAgent
Base class for pass phrase protected agents.
-
Constructor Summary
Constructors Modifier Constructor Description protectedPassphraseAgentImpl(java.security.KeyPair pair, java.lang.String passphrase, byte[] salt)atm constructor for the MockAgent class, just don't know, how agent creation will take place laterprotectedPassphraseAgentImpl(java.security.PublicKey pubKey, byte[] encodedPrivate, byte[] salt)create an agent with a locked private key used withinAgentImpl.createFromXml(java.io.File) -
Method Summary
Modifier and Type Method Description voidchangePassphrase(java.lang.String passphrase)Change the passphrase for unlocking the private key.java.lang.StringgetPassphrase()Gets the current passphraseprotected byte[]getSalt()provide access to salt for subclasses (security risk?voidlockPrivateKey()(Re-)Lock the private key.voidunlock(java.lang.String passphrase)Unlocks this agent.voidunlockPrivateKey(java.lang.String passphrase)Methods inherited from class i5.las2peer.security.AgentImpl
cloneLocked, createFromXml, createFromXml, createFromXml, createFromXml, createSignature, decryptSymmetricKey, encryptPrivateKey, equals, getEncodedPrivate, getIdentifier, getPublicKey, getResponsibleForAgentSafeId, getRunningAtNode, isLocked, notifyRegistrationTo, notifyUnregister, receiveMessage, signContent, unlockPrivateKey
-
Constructor Details
-
PassphraseAgentImpl
protected PassphraseAgentImpl(java.security.KeyPair pair, java.lang.String passphrase, byte[] salt) throws AgentOperationFailedException, CryptoExceptionatm constructor for the MockAgent class, just don't know, how agent creation will take place later- Parameters:
pair-passphrase-salt-- Throws:
AgentOperationFailedExceptionCryptoException
-
PassphraseAgentImpl
protected PassphraseAgentImpl(java.security.PublicKey pubKey, byte[] encodedPrivate, byte[] salt)create an agent with a locked private key used withinAgentImpl.createFromXml(java.io.File)- Parameters:
pubKey-encodedPrivate-salt-
-
-
Method Details
-
unlock
public void unlock(java.lang.String passphrase) throws AgentAccessDeniedException, AgentOperationFailedExceptionDescription copied from interface:PassphraseAgentUnlocks this agent.- Specified by:
unlockin interfacePassphraseAgent- Parameters:
passphrase- The passphrase to unlock this agent.- Throws:
AgentAccessDeniedException- If the passphrase is not valid.AgentOperationFailedException- If the agent's private key can not be deserialized.
-
unlockPrivateKey
public void unlockPrivateKey(java.lang.String passphrase) throws AgentAccessDeniedException, AgentOperationFailedException- Specified by:
unlockPrivateKeyin interfacePassphraseAgent- Parameters:
passphrase- The passphrase to unlock this agent.- Throws:
AgentAccessDeniedException- If the passphrase is not valid.AgentOperationFailedException- If the agent's private key can not be deserialized.
-
getSalt
protected byte[] getSalt()provide access to salt for subclasses (security risk? - probably not)- Returns:
- the random salt used to encode the private key
-
changePassphrase
public void changePassphrase(java.lang.String passphrase) throws AgentOperationFailedException, AgentLockedExceptionChange the passphrase for unlocking the private key. The key has to be unlocked first, of course.- Parameters:
passphrase-- Throws:
AgentOperationFailedExceptionAgentLockedException
-
lockPrivateKey
public void lockPrivateKey()Description copied from class:AgentImpl(Re-)Lock the private key.- Overrides:
lockPrivateKeyin classAgentImpl
-
getPassphrase
Gets the current passphrase- Returns:
- Returns the passphrase of this agent
- Throws:
AgentLockedException
-