Class PrivateKey


  • public class PrivateKey
    extends AbstractKey
    PrivateKey is an X25519 private key wrapper (64 bytes).
    • 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 - PublicKey
        nonce - byte[]
        Returns:
        byte[] byte [ ]
      • getPublicKey

        public PublicKey getPublicKey()
        PublicKey getter
        Returns:
        PublicKey public key