Package com.syntifi.crypto.key
Class Ed25519PrivateKey
- java.lang.Object
-
- com.syntifi.crypto.key.AbstractPrivateKey
-
- com.syntifi.crypto.key.Ed25519PrivateKey
-
public class Ed25519PrivateKey extends AbstractPrivateKey
ed25519 implementation ofAbstractPrivateKey- Since:
- 0.1.0
-
-
Constructor Summary
Constructors Constructor Description Ed25519PrivateKey()Ed25519PrivateKey(byte[] privateKey)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(java.lang.Object other)static Ed25519PrivateKeyderiveFromSeed(byte[] seed, int[] path)AbstractPublicKeyderivePublicKey()Derives the public key from the loaded private keystatic Ed25519PrivateKeyderiveRandomKey()booleanequals(java.lang.Object o)inthashCode()voidloadPrivateKey(byte[] privateKey)Loads a private key from a byte arrayvoidreadPrivateKey(java.io.Reader reader)Reads the private key from a streambyte[]sign(byte[] message)Signs a message with the loaded keyvoidwritePrivateKey(java.io.Writer writer)Writes the private key to a file-
Methods inherited from class com.syntifi.crypto.key.AbstractPrivateKey
getKey, readPrivateKey, setKey, toString, writePrivateKey
-
-
-
-
Method Detail
-
loadPrivateKey
public void loadPrivateKey(byte[] privateKey)
Description copied from class:AbstractPrivateKeyLoads a private key from a byte array- Specified by:
loadPrivateKeyin classAbstractPrivateKey- Parameters:
privateKey- the private key bytes
-
readPrivateKey
public void readPrivateKey(java.io.Reader reader) throws java.io.IOExceptionDescription copied from class:AbstractPrivateKeyReads the private key from a stream- Specified by:
readPrivateKeyin classAbstractPrivateKey- Parameters:
reader- the source of the private key- Throws:
java.io.IOException- thrown if an error occurs reading the file
-
writePrivateKey
public void writePrivateKey(java.io.Writer writer) throws java.io.IOExceptionDescription copied from class:AbstractPrivateKeyWrites the private key to a file- Specified by:
writePrivateKeyin classAbstractPrivateKey- Parameters:
writer- the target writer- Throws:
java.io.IOException- thrown if an error occurs writing the file
-
sign
public byte[] sign(byte[] message)
Description copied from class:AbstractPrivateKeySigns a message with the loaded key- Specified by:
signin classAbstractPrivateKey- Parameters:
message- message to sign- Returns:
- signed message
-
derivePublicKey
public AbstractPublicKey derivePublicKey()
Description copied from class:AbstractPrivateKeyDerives the public key from the loaded private key- Specified by:
derivePublicKeyin classAbstractPrivateKey- Returns:
- the derived
AbstractPublicKey
-
deriveFromSeed
public static Ed25519PrivateKey deriveFromSeed(byte[] seed, int[] path) throws java.io.IOException
- Throws:
java.io.IOException
-
deriveRandomKey
public static Ed25519PrivateKey deriveRandomKey()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classAbstractPrivateKey
-
canEqual
protected boolean canEqual(java.lang.Object other)
- Overrides:
canEqualin classAbstractPrivateKey
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractPrivateKey
-
-