Package i5.las2peer.security
Class EthereumGroupAgent
java.lang.Object
i5.las2peer.security.AgentImpl
i5.las2peer.security.GroupAgentImpl
i5.las2peer.security.EthereumGroupAgent
- All Implemented Interfaces:
Agent
,GroupAgent
,MessageReceiver
,XmlAble
,Cloneable
-
Field Summary
Fields inherited from class i5.las2peer.security.GroupAgentImpl
adminList, groupName
-
Constructor Summary
ModifierConstructorDescriptionprotected
EthereumGroupAgent
(KeyPair pair, SecretKey secret, byte[] salt, String groupName, Agent[] members, String ethereumMnemonic) protected
EthereumGroupAgent
(PublicKey pubKey, byte[] encryptedPrivate, HashMap<String, byte[]> htEncryptedKeys, String ethereumMnemonic, String ethereumAddress) -
Method Summary
Modifier and TypeMethodDescriptionstatic EthereumGroupAgent
createEthereumGroupAgentWithClient
(String groupName, ReadWriteRegistryClient regClient, Agent[] members) Creates new agent with given passphrase and login name.static EthereumGroupAgent
createFromXml
(String xml) static EthereumGroupAgent
createFromXml
(Element root) org.web3j.crypto.Credentials
Gets registry client that uses the agent's credentials.boolean
isLocked()
Returns whether the agent is locked or not.void
Removes decrypted private key and the registry client (which contains user credentials).Returns a XML representation of this object.void
Unlock this group using a given agent.Methods inherited from class i5.las2peer.security.GroupAgentImpl
addAdmin, addMember, addMember, apply, createGroupAgent, createGroupAgent, getGroupName, getMemberList, getOpeningAgent, getSize, hasGroupName, hasMember, hasMember, isAdmin, notifyUnregister, receiveMessage, removeMember, removeMember, revokeAdmin, revokeMember
Methods inherited from class i5.las2peer.security.AgentImpl
cloneLocked, createFromXml, createFromXml, createSignature, decryptSymmetricKey, encryptPrivateKey, equals, getEncodedPrivate, getIdentifier, getPublicKey, getResponsibleForAgentSafeId, getRunningAtNode, notifyRegistrationTo, signContent, unlockPrivateKey
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface i5.las2peer.api.security.Agent
getIdentifier
-
Constructor Details
-
EthereumGroupAgent
protected EthereumGroupAgent(KeyPair pair, SecretKey secret, byte[] salt, String groupName, Agent[] members, String ethereumMnemonic) throws AgentOperationFailedException, CryptoException, SerializationException -
EthereumGroupAgent
protected EthereumGroupAgent(PublicKey pubKey, byte[] encryptedPrivate, HashMap<String, byte[]> htEncryptedKeys, String ethereumMnemonic, String ethereumAddress) throws AgentOperationFailedException- Throws:
AgentOperationFailedException
-
-
Method Details
-
lockPrivateKey
public void lockPrivateKey()Removes decrypted private key and the registry client (which contains user credentials).- Overrides:
lockPrivateKey
in classGroupAgentImpl
-
unlock
public void unlock(Agent agent) throws AgentAccessDeniedException, AgentOperationFailedException, AgentLockedException Description copied from interface:GroupAgent
Unlock this group using a given agent. Will not work for transitive memberships.- Specified by:
unlock
in interfaceGroupAgent
- Overrides:
unlock
in classGroupAgentImpl
- Parameters:
agent
- A direct member of this group, must be unlocked.- Throws:
AgentAccessDeniedException
- If the given agent is not a direct member of this group.AgentOperationFailedException
- If the agent's private key can not be deserialized.AgentLockedException
- If agent is locked.
-
isLocked
public boolean isLocked()Description copied from interface:Agent
Returns whether the agent is locked or not. -
toXmlString
Description copied from interface:XmlAble
Returns a XML representation of this object.- Specified by:
toXmlString
in interfaceXmlAble
- Overrides:
toXmlString
in classGroupAgentImpl
- Returns:
- a XML String representation
-
createEthereumGroupAgentWithClient
public static EthereumGroupAgent createEthereumGroupAgentWithClient(String groupName, ReadWriteRegistryClient regClient, Agent[] members) throws CryptoException, AgentOperationFailedException, SerializationException Creates new agent with given passphrase and login name.- Parameters:
groupName
- name matching [a-zA-Z].{3,31} (hopefully UTF-8 characters, let's not get too crazy)- Returns:
- new EthereumAgent instance
- Throws:
CryptoException
- if there is an internal error during Ethereum key creationAgentOperationFailedException
SerializationException
-
getRegistryClient
Gets registry client that uses the agent's credentials. May benull
; will need to add an "at" here use {link #unlock(String)}. -
getEthereumAddress
- Returns:
- address of the Ethereum key pair associated with the agent
-
getEthereumMnemonic
-
getEthereumCredentials
- Throws:
AgentLockedException
-
createFromXml
- Throws:
MalformedXMLException
-
createFromXml
- Throws:
MalformedXMLException
-