1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/cmd/readPipelineEnv_test.go
Egor Balakin 3eb4f165b2
feat(commonPipelineEnvironment): encrypt CPE (#4504)
* encrypt CPE - init

* fix

* disable encrypt on Jenkins

* get PIPER_pipelineEnv_SECRET from vault

* reuse artifactPrepareVersionOptions

* encrypt only with orchestrator.GitHubActions

* Workaround: orchestrators expect json

* add encryptedCPE flag

* remove JSON workaround

* throw error if stepConfigPassword is empty

* fix log messages

---------

Co-authored-by: Egor Balakin <egor.balakin@sap.com>
2023-09-11 12:58:57 +04:00

21 lines
416 B
Go

package cmd
import (
"github.com/stretchr/testify/assert"
"strings"
"testing"
)
func TestCpeEncryption(t *testing.T) {
secret := []byte("testKey!")
payload := []byte(strings.Repeat("testString", 100))
encrypted, err := encrypt(secret, payload)
assert.NoError(t, err)
assert.NotNil(t, encrypted)
decrypted, err := decrypt(secret, encrypted)
assert.NoError(t, err)
assert.Equal(t, decrypted, payload)
}