MCPcopy Create free account
hub / github.com/Driver-C/tryssh / TestEncryptDecrypt_WithDerivedKey

Function TestEncryptDecrypt_WithDerivedKey

pkg/utils/crypto_test.go:179–191  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

177}
178
179func TestEncryptDecrypt_WithDerivedKey(t *testing.T) {
180 // Verify that a key derived from deriveKey works with Encrypt/Decrypt
181 key, err := deriveKey([]byte("testpassword123"))
182 require.NoError(t, err)
183
184 plaintext := "hello world with derived key"
185 encrypted, err := Encrypt(plaintext, key)
186 require.NoError(t, err)
187
188 decrypted, err := Decrypt(encrypted, key)
189 require.NoError(t, err)
190 assert.Equal(t, plaintext, decrypted)
191}
192
193func TestEncryptDecrypt_SpecialCharacters(t *testing.T) {
194 key := make([]byte, 32)

Callers

nothing calls this directly

Calls 3

deriveKeyFunction · 0.85
EncryptFunction · 0.85
DecryptFunction · 0.85

Tested by

no test coverage detected