github.com/lestrrat-go/jwx/v2@v2.0.21/jwe/internal/cipher/cipher_test.go (about)

     1  package cipher_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/lestrrat-go/jwx/v2/jwa"
     7  	"github.com/lestrrat-go/jwx/v2/jwe/internal/cipher"
     8  	"github.com/stretchr/testify/assert"
     9  )
    10  
    11  func TestAES(t *testing.T) {
    12  	algs := []jwa.ContentEncryptionAlgorithm{
    13  		jwa.A128GCM,
    14  		jwa.A192GCM,
    15  		jwa.A256GCM,
    16  		jwa.A128CBC_HS256,
    17  		jwa.A192CBC_HS384,
    18  		jwa.A256CBC_HS512,
    19  	}
    20  	for _, alg := range algs {
    21  		c, err := cipher.NewAES(alg)
    22  		if !assert.NoError(t, err, "BuildCipher for %s succeeds", alg) {
    23  			return
    24  		}
    25  		t.Logf("keysize = %d", c.KeySize())
    26  	}
    27  }