mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-19 03:57:17 +02:00
databroker: add encryption for records (#1168)
This commit is contained in:
parent
8cae3f27bb
commit
29fb96a955
8 changed files with 332 additions and 7 deletions
|
@ -4,6 +4,8 @@ import (
|
|||
"encoding/base64"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEncodeAndDecodeAccessToken(t *testing.T) {
|
||||
|
@ -61,6 +63,22 @@ func TestNewAEADCipher(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func BenchmarkAEADCipher(b *testing.B) {
|
||||
plaintext := []byte("my plain text value")
|
||||
|
||||
key := NewKey()
|
||||
c, err := NewAEADCipher(key)
|
||||
if !assert.NoError(b, err) {
|
||||
return
|
||||
}
|
||||
|
||||
ciphertext := Encrypt(c, plaintext, nil)
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
Decrypt(c, ciphertext, nil)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewAEADCipherFromBase64(t *testing.T) {
|
||||
t.Parallel()
|
||||
tests := []struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue