Class PrivateKey
- java.lang.Object
-
- com.github.katenachain.crypto.AbstractKey
-
- com.github.katenachain.crypto.Nacl.PrivateKey
-
public class PrivateKey extends AbstractKey
PrivateKey is an X25519 private key wrapper (64 bytes).
-
-
Field Summary
-
Fields inherited from class com.github.katenachain.crypto.AbstractKey
key
-
-
Constructor Summary
Constructors Constructor Description PrivateKey(byte[] key)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[]open(byte[] encryptedMessage, PublicKey senderPublicKey, byte[] nonce)decrypts an encrypted message with the appropriate sender information.Hashtable<String,byte[]>seal(byte[] message, PublicKey publicKey)encrypts a plain text message decipherable afterwards by the recipient private key.-
Methods inherited from class com.github.katenachain.crypto.AbstractKey
getKey
-
-
-
-
Constructor Detail
-
PrivateKey
public PrivateKey(byte[] key)
PrivateKey constructor with byte[].- Parameters:
key- byte[]
-
PrivateKey
public PrivateKey(String privateKeyBase64)
PrivateKey constructor with String.- Parameters:
privateKeyBase64- String
-
-
Method Detail
-
seal
public Hashtable<String,byte[]> seal(byte[] message, PublicKey publicKey)
encrypts a plain text message decipherable afterwards by the recipient private key.- Parameters:
message- byte[]publicKey- PublicKey- Returns:
- Hashtable
hashtable
-
open
public byte[] open(byte[] encryptedMessage, PublicKey senderPublicKey, byte[] nonce)decrypts an encrypted message with the appropriate sender information.- Parameters:
encryptedMessage- byte[]senderPublicKey- PublicKeynonce- byte[]- Returns:
- byte[] byte [ ]
-
getPublicKey
public PublicKey getPublicKey()
PublicKey getter- Returns:
- PublicKey public key
-
-