package tkn20_test import ( "bytes" "crypto/sha256" "fmt" "io" "testing" cpabe "github.com/cloudflare/circl/abe/cpabe/tkn20" "github.com/cloudflare/circl/internal/test" "github.com/cloudflare/circl/xof" ) func TestLongPlaintext(t *testing.T) { // Fixed PRNG for test reproducibility. prng := xof.SHAKE128.New() pk, msk, err := cpabe.Setup(prng) test.CheckNoErr(t, err, "setup failed") attrs := cpabe.Attributes{} attrs.FromMap(map[string]string{ "occupation": "doctor", "country": "US", "age": "16", }) sk, err := msk.KeyGen(prng, attrs) test.CheckNoErr(t, err, "master key generation failed") policy := cpabe.Policy{} err = policy.FromString(`(occupation: doctor) and (country: US)`) test.CheckNoErr(t, err, "policy parsing failed") const N = 20 // 2^N bytes of plaintext buffer := make([]byte, 1<