Package com.syntifi.crypto.key
Class Secp256k1PublicKey
- java.lang.Object
-
- com.syntifi.crypto.key.AbstractPublicKey
-
- com.syntifi.crypto.key.Secp256k1PublicKey
-
public class Secp256k1PublicKey extends AbstractPublicKey
secp256k1 implementation ofAbstractPublicKey- Since:
- 0.1.0
-
-
Constructor Summary
Constructors Constructor Description Secp256k1PublicKey()Secp256k1PublicKey(byte[] bytes)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(java.lang.Object other)booleanequals(java.lang.Object o)static byte[]getShortKey(byte[] key)Gets a short keyinthashCode()voidloadPublicKey(byte[] publicKey)Loads a public key from a byte arrayvoidreadPublicKey(java.io.Reader reader)Reads the public key from a filejava.lang.Booleanverify(byte[] message, byte[] signature)Verifies message with given signaturevoidwritePublicKey(java.io.Writer writer)Writes the public key to a file-
Methods inherited from class com.syntifi.crypto.key.AbstractPublicKey
getKey, readPublicKey, setKey, toString, writePublicKey
-
-
-
-
Method Detail
-
loadPublicKey
public void loadPublicKey(byte[] publicKey) throws java.io.IOExceptionDescription copied from class:AbstractPublicKeyLoads a public key from a byte array- Specified by:
loadPublicKeyin classAbstractPublicKey- Parameters:
publicKey- the public key bytes- Throws:
java.io.IOException
-
readPublicKey
public void readPublicKey(java.io.Reader reader) throws java.io.IOExceptionDescription copied from class:AbstractPublicKeyReads the public key from a file- Specified by:
readPublicKeyin classAbstractPublicKey- Parameters:
reader- the source filename- Throws:
java.io.IOException- thrown if an error occurs reading the file
-
writePublicKey
public void writePublicKey(java.io.Writer writer) throws java.io.IOExceptionDescription copied from class:AbstractPublicKeyWrites the public key to a file- Specified by:
writePublicKeyin classAbstractPublicKey- Parameters:
writer- the target to write the public key- Throws:
java.io.IOException- thrown if an error occurs writing the file
-
verify
public java.lang.Boolean verify(byte[] message, byte[] signature) throws java.security.GeneralSecurityExceptionDescription copied from class:AbstractPublicKeyVerifies message with given signature- Specified by:
verifyin classAbstractPublicKey- Parameters:
message- the signed messagesignature- the signature to check against- Returns:
- true if matches, false otherwise
- Throws:
java.security.GeneralSecurityException- thrown if an error occurs processing message and signature
-
getShortKey
public static byte[] getShortKey(byte[] key)
Gets a short key- Parameters:
key- the key as a byte array- Returns:
- short key as byte array
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classAbstractPublicKey
-
canEqual
protected boolean canEqual(java.lang.Object other)
- Overrides:
canEqualin classAbstractPublicKey
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractPublicKey
-
-