Class PrivateKey
- java.lang.Object
-
- com.github.katenachain.crypto.AbstractKey
-
- com.github.katenachain.crypto.ED25519.PrivateKey
-
public class PrivateKey extends AbstractKey
PrivateKey is an Ed25519 private key wrapper (64 bytes).
-
-
Field Summary
-
Fields inherited from class com.github.katenachain.crypto.AbstractKey
key
-
-
Constructor Summary
Constructors Constructor Description PrivateKey(byte[] privateKey)PrivateKey constructor with byte[].PrivateKey(String privateKeyBase64)PrivateKey constructor with String.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PublicKeygetPublicKey()PublicKey Getterbyte[]sign(byte[] message)accepts a message and returns its corresponding Ed25519 signature.-
Methods inherited from class com.github.katenachain.crypto.AbstractKey
getKey
-
-
-
-
Constructor Detail
-
PrivateKey
public PrivateKey(byte[] privateKey)
PrivateKey constructor with byte[].- Parameters:
privateKey- byte[]
-
PrivateKey
public PrivateKey(String privateKeyBase64)
PrivateKey constructor with String.- Parameters:
privateKeyBase64- String
-
-
Method Detail
-
getPublicKey
public PublicKey getPublicKey()
PublicKey Getter- Returns:
- PublicKey public key
-
sign
public byte[] sign(byte[] message) throws NoSuchAlgorithmException, InvalidKeyException, SignatureExceptionaccepts a message and returns its corresponding Ed25519 signature.- Parameters:
message- byte[]- Returns:
- byte[] byte [ ]
- Throws:
NoSuchAlgorithmException- the no such algorithm exceptionInvalidKeyException- the invalid key exceptionSignatureException- the signature exception
-
-