#!/bin/sh

test_description="Check multiple recipients"
. $SHARNESS_TEST_SRCDIR/sharness.sh

dd if=/dev/urandom of=enc.data bs=300K count=1 2>/dev/null

test_expect_success "0: pub generation" "cmkeytool \
    -algo sntrup761-x25519 -ku kem -sub N=0 5>enc.0.pub 9>enc.0.prv"
test_expect_success "1: pub generation" "cmkeytool \
    -algo sntrup761-x25519 -ku kem -sub N=1 5>enc.1.pub 9>enc.1.prv"

test_expect_success "encrypting" "
    cat enc.0.pub enc.1.pub | cmenctool 4<&0 <enc.data >enc.enc"

test_expect_success "0: decrypting" "
    cmenctool -d 8<enc.0.prv <enc.enc >enc.data.got"
test_expect_success "0: comparing" "test_cmp enc.data enc.data.got"

test_expect_success "1: decrypting" "
    cmenctool -d 8<enc.1.prv <enc.enc >enc.data.got"
test_expect_success "1: comparing" "test_cmp enc.data enc.data.got"

test_done
