mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
3eb4f165b2
* 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>
21 lines
416 B
Go
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)
|
|
}
|